[AB-216] replacing js_string with json_string in order to escape characters, because js_string could lead to illegal escape sequences

This commit is contained in:
Sheldan
2021-03-28 17:12:08 +02:00
parent 26879b7952
commit 83ec7fc4cd
37 changed files with 76 additions and 76 deletions

View File

@@ -1 +1 @@
<#macro full_member_info member><@member_user_name member=member/> ${member.asMention?js_string} (${member.idLong?c})</#macro>
<#macro full_member_info member><@member_user_name member=member/> ${member.asMention?json_string} (${member.idLong?c})</#macro>

View File

@@ -1 +1 @@
<#macro member_user_name member>${member.effectiveName?js_string}#${member.user.discriminator}</#macro>
<#macro member_user_name member>${member.effectiveName?json_string}#${member.user.discriminator}</#macro>

View File

@@ -1 +1 @@
<#macro safe_include template_key><#assign rendered><#include "${template_key}"></#assign>${rendered?js_string}</#macro>
<#macro safe_include template_key><#assign rendered><#include "${template_key}"></#assign>${rendered?json_string}</#macro>

View File

@@ -1 +1 @@
<#macro user_user_name user>${user.name?js_string}#${user.discriminator}</#macro>
<#macro user_user_name user>${user.name?json_string}#${user.discriminator}</#macro>

View File

@@ -3,8 +3,8 @@
"title": "<@safe_include "help_command_embed_title"/>"
},
<#include "abstracto_color">,
"description": "<@safe_include "help_command_embed_command_name"/>: **${command.name?js_string}**
<@safe_include "help_command_embed_command_description"/>: <#if command.templated> <@safe_include "${command.name}_description"/> <#else> ${command.description?js_string} </#if>
"description": "<@safe_include "help_command_embed_command_name"/>: **${command.name?json_string}**
<@safe_include "help_command_embed_command_description"/>: <#if command.templated> <@safe_include "${command.name}_description"/> <#else> ${command.description?json_string} </#if>
<#if command.help??>
<#if command.help.templated>
@@ -15,20 +15,20 @@
</#if>
<#else>
**<@safe_include "help_command_embed_command_usage"/>**: `${usage}`
**<@safe_include "help_command_embed_command_detailed_help"/>**: ${command.help.longHelp?js_string}
**<@safe_include "help_command_embed_command_detailed_help"/>**: ${command.help.longHelp?json_string}
<#if command.help.hasExample>
<@safe_include "help_command_embed_command_example"/>:${command.help.example?js_string}
<@safe_include "help_command_embed_command_example"/>:${command.help.example?json_string}
</#if>
</#if>
<#if command.aliases?? && command.aliases?size gt 0>
<@safe_include "help_command_embed_command_aliases"/>: `${command.aliases?join("`, `")?js_string}`
<@safe_include "help_command_embed_command_aliases"/>: `${command.aliases?join("`, `")?json_string}`
</#if>
<#if serverSpecificAliases?size gt 0>
<@safe_include "help_command_embed_command_server_aliases"/>: `${serverSpecificAliases?join("`, `")?js_string}`
<@safe_include "help_command_embed_command_server_aliases"/>: `${serverSpecificAliases?join("`, `")?json_string}`
</#if>
<#if restricted?? && restricted>
<@safe_include "help_command_embed_command_executable_by"/>:<#if allowedRoles??> <#list allowedRoles as allowedRole> ${allowedRole.asMention?js_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_executable_by_nobody"/></#list> </#if>
<#if immuneRoles?? ><@safe_include "help_command_embed_command_immune"/>: <#list immuneRoles as immuneRole> ${immuneRole.asMention?js_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_immune_none"/></#list> </#if>
<@safe_include "help_command_embed_command_executable_by"/>:<#if allowedRoles??> <#list allowedRoles as allowedRole> ${allowedRole.asMention?json_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_executable_by_nobody"/></#list> </#if>
<#if immuneRoles?? ><@safe_include "help_command_embed_command_immune"/>: <#list immuneRoles as immuneRole> ${immuneRole.asMention?json_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_immune_none"/></#list> </#if>
<#else>
<@safe_include "help_command_embed_command_not_restricted"/>
</#if>
@@ -37,7 +37,7 @@
**<@safe_include "help_command_embed_command_parameters"/>**:
<#if command.parameters??>
<#list command.parameters as parameter><#assign parameter=parameter>
<@safe_include "help_command_embed_command_description"/> `${parameter.name?js_string}`: <#if parameter.templated?? && parameter.templated><@safe_include "${command.name}_parameter_${parameter.name}"/><#else>${(parameter.description?js_string)!""}</#if>
<@safe_include "help_command_embed_command_description"/> `${parameter.name?json_string}`: <#if parameter.templated?? && parameter.templated><@safe_include "${command.name}_parameter_${parameter.name}"/><#else>${(parameter.description?json_string)!""}</#if>
<#list parameter.validators as validator><#assign validator=validator><#assign model=validator.templateModel/><@safe_include "${validator.templateName}"/>
</#list>

View File

@@ -5,12 +5,12 @@
},
<#include "abstracto_color">,
"description": "
<@safe_include "help_module_embed_module_name"/>: **${name?js_string}**
<@safe_include "help_module_embed_module_description"/>: <#if module.moduleDefinition.info.templated?? && module.moduleDefinition.info.templated><@safe_include "module_${name}_description"/><#else>${module.moduleDefinition.info.description?js_string}</#if>
<@safe_include "help_module_embed_module_name"/>: **${name?json_string}**
<@safe_include "help_module_embed_module_description"/>: <#if module.moduleDefinition.info.templated?? && module.moduleDefinition.info.templated><@safe_include "module_${name}_description"/><#else>${module.moduleDefinition.info.description?json_string}</#if>
<@safe_include "help_module_embed_commands"/>:
<#list module.commands as command>`${command.configuration.name?js_string}`<#sep>, <#else><@safe_include "help_module_no_commands_available"/></#list>
<#list module.commands as command>`${command.configuration.name?json_string}`<#sep>, <#else><@safe_include "help_module_no_commands_available"/></#list>
<#if subModules?has_content && subModules?size gt 0>
<@safe_include "help_module_embed_sub_modules"/>: <#list subModules as module>`${module.info.name?js_string}`<#sep>, </#list>
<@safe_include "help_module_embed_sub_modules"/>: <#list subModules as module>`${module.info.name?json_string}`<#sep>, </#list>
</#if>
",
"footer": {

View File

@@ -5,8 +5,8 @@
<#include "abstracto_color">,
"description": "
<#list modules as module><#assign module=module/>
**${module.info.name?js_string}**
<#if module.info.templated?? && module.info.templated><@safe_include "module_${module.info.name}_description"/><#else>${module.info.description?js_string}</#if>
**${module.info.name?json_string}**
<#if module.info.templated?? && module.info.templated><@safe_include "module_${module.info.name}_description"/><#else>${module.info.description?json_string}</#if>
</#list>
",
"footer": {

View File

@@ -9,9 +9,9 @@
"fields": [
<#list groups as group>
{
"name": "${group.name?js_string} (<@safe_include "channel_group_type_${group.typeKey}_name"/>)",
"name": "${group.name?json_string} (<@safe_include "channel_group_type_${group.typeKey}_name"/>)",
"value": "
<#list group.channels as channel><#if channel.discordChannel??>${channel.discordChannel.asMention?js_string}<#else>${channel.channel.id?c}</#if><#sep>,<#else> <@safe_include "listChannelGroups_no_channels"/></#list>
<#list group.channels as channel><#if channel.discordChannel??>${channel.discordChannel.asMention?json_string}<#else>${channel.channel.id?c}</#if><#sep>,<#else> <@safe_include "listChannelGroups_no_channels"/></#list>
"
}<#sep>,
</#list>

View File

@@ -5,8 +5,8 @@
<#include "success_color">,
"description": "
<#list postTargets as postTarget><#assign postTarget=postTarget/>
<#assign postTargetName>${postTarget.postTarget.name?js_string}</#assign>
<#assign channelMention><#if postTarget.channel?has_content>${postTarget.channel.asMention?js_string}<#else><@safe_include "posttarget_no_channel"/></#if></#assign>
<#assign postTargetName>${postTarget.postTarget.name?json_string}</#assign>
<#assign channelMention><#if postTarget.channel?has_content>${postTarget.channel.asMention?json_string}<#else><@safe_include "posttarget_no_channel"/></#if></#assign>
<@safe_include "posttarget_post_target_text"/>
<#else>

View File

@@ -5,7 +5,7 @@
<#else>
"author":
{
"name": "${fullUser.user.name?js_string}#${fullUser.user.discriminator}",
"name": "${fullUser.user.name?json_string}#${fullUser.user.discriminator}",
"avatar": "${fullUser.user.effectiveAvatarUrl}"
},
</#if>
@@ -17,8 +17,8 @@
"description": "<@safe_include "${template.templateName}"/>"
</#if>
<#elseif throwable.localizedMessage?has_content>
"description": "${throwable.localizedMessage?js_string}"
"description": "${throwable.localizedMessage?json_string}"
<#else>
"description": "${throwable.class.simpleName?js_string}"
"description": "${throwable.class.simpleName?json_string}"
</#if>
}