Check if html files contain non ASCII characters.
This commit is contained in:
@@ -249,6 +249,10 @@ ForceInventoryUpdate = False
|
||||
# Default: False
|
||||
LazyCache = False
|
||||
|
||||
# Check if html files contain non ASCII characters.
|
||||
# Default = True
|
||||
CheckHtmlEncoding = True
|
||||
|
||||
# Cache all character names in to memory on server startup
|
||||
# False - names are loaded from Db when they are requested
|
||||
# True - decrease Db usage , increase memory consumption
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<html><body>Gatekeeper Ziggurat:<br>
|
||||
<html><body>Gatekeeper Ziggurat:<br>
|
||||
A Human voice seems to emanate from a shining, blue globe:<br>
|
||||
Behold the gateway to the Forbidden Sacred Area! My job is to guard it, and you cannot pass without my permission.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_teleport OTHER 0">Teleport</Button>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<html><body>Gatekeeper Ziggurat:<br>
|
||||
<html><body>Gatekeeper Ziggurat:<br>
|
||||
A Human voice seems to emanate from a shining, blue globe:<br>
|
||||
Behold the gateway to the Forbidden Sacred Area! My job is to guard it, and you cannot pass without my permission.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_teleport OTHER 0">Teleport</Button>
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
<html><body>
|
||||
Gatekeeper Spirit:<br>
|
||||
A voice seems to emanate from a shining blue sphere:
|
||||
<br>
|
||||
It is a sacred place where <font color="LEVEL">Lilith</font> lays. I guard the path.
|
||||
<br>
|
||||
<font color="LEVEL">
|
||||
Remember, you cannot go back until all of your enemies are destroyed. And if you are unable to defeat them, magic must be used.
|
||||
</font>
|
||||
<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest SevenSignsRBs LILITH_ENTER">Teleport to Lilith’s Sanctum</Button>
|
||||
<html><body>Gatekeeper Spirit:<br>
|
||||
A voice seems to emanate from a shining blue sphere:<br>
|
||||
It is a sacred place where <font color="LEVEL">Lilith</font> lays. I guard the path.<br>
|
||||
<font color="LEVEL">Remember, you cannot go back until all of your enemies are destroyed. And if you are unable to defeat them, magic must be used.</font><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest SevenSignsRBs LILITH_ENTER">Teleport to Lilith's Sanctum</Button>
|
||||
</body></html>
|
||||
@@ -1,12 +1,6 @@
|
||||
<html><body>
|
||||
Gatekeeper Spirit:<br>
|
||||
A voice seems to emanate from a shining blue sphere:
|
||||
<br>
|
||||
It is a sacred place where <font color="LEVEL">Anakim</font> lays. I guard the path.
|
||||
<br>
|
||||
<font color="LEVEL">
|
||||
Remember, you cannot go back until all of your enemies are destroyed. And if you are unable to defeat them, magic must be used.
|
||||
</font>
|
||||
<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest SevenSignsRBs ANAKIM_ENTER">Teleport to Anakim’s Sanctum</Button>
|
||||
<html><body>Gatekeeper Spirit:<br>
|
||||
A voice seems to emanate from a shining blue sphere:<br>
|
||||
It is a sacred place where <font color="LEVEL">Anakim</font> lays. I guard the path.<br>
|
||||
<font color="LEVEL">Remember, you cannot go back until all of your enemies are destroyed. And if you are unable to defeat them, magic must be used.</font><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest SevenSignsRBs ANAKIM_ENTER">Teleport to Anakim's Sanctum</Button>
|
||||
</body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- Translated from Russian -->
|
||||
<!-- Translated from Russian -->
|
||||
<html><body>Tyren:<br>
|
||||
I have already said that it is even harder here than at the top level. Without colleagues you can not do. Be careful. Monsters appear constantly and can surround you.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_teleport OTHER 0">Move to the entrance of the Forge of the Gods</Button>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<html><body>Tores:<br>
|
||||
Have you heard of the Dungeon of Abyss? Especially evil and dangerous monsters are imprisoned there.<br>
|
||||
But someone has recently removed the seal from its gates. If we do nothing… No, only a thought of it scares me. I need your help.<br>
|
||||
But someone has recently removed the seal from its gates. If we do nothing... No, only a thought of it scares me. I need your help.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Tores 1">Go to the West Wing of the Dungeon of Abyss (Level 40-44)</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Tores 2">Go to the East Wing of the Dungeon of Abyss (Level 45-49)</Button>
|
||||
</body></html>
|
||||
@@ -472,6 +472,7 @@ public class Config
|
||||
public static boolean MULTIPLE_ITEM_DROP;
|
||||
public static boolean FORCE_INVENTORY_UPDATE;
|
||||
public static boolean LAZY_CACHE;
|
||||
public static boolean CHECK_HTML_ENCODING;
|
||||
public static boolean CACHE_CHAR_NAMES;
|
||||
public static int MIN_NPC_ANIMATION;
|
||||
public static int MAX_NPC_ANIMATION;
|
||||
@@ -1947,6 +1948,7 @@ public class Config
|
||||
MULTIPLE_ITEM_DROP = General.getBoolean("MultipleItemDrop", true);
|
||||
FORCE_INVENTORY_UPDATE = General.getBoolean("ForceInventoryUpdate", false);
|
||||
LAZY_CACHE = General.getBoolean("LazyCache", true);
|
||||
CHECK_HTML_ENCODING = General.getBoolean("CheckHtmlEncoding", true);
|
||||
CACHE_CHAR_NAMES = General.getBoolean("CacheCharNames", true);
|
||||
MIN_NPC_ANIMATION = General.getInt("MinNpcAnimation", 5);
|
||||
MAX_NPC_ANIMATION = General.getInt("MaxNpcAnimation", 60);
|
||||
@@ -3136,6 +3138,10 @@ public class Config
|
||||
|
||||
MULTILANG_DEFAULT = MultilingualSupport.getString("MultiLangDefault", "en").toLowerCase();
|
||||
MULTILANG_ENABLE = MultilingualSupport.getBoolean("MultiLangEnable", false);
|
||||
if (MULTILANG_ENABLE)
|
||||
{
|
||||
CHECK_HTML_ENCODING = false;
|
||||
}
|
||||
final String[] allowed = MultilingualSupport.getString("MultiLangAllowed", MULTILANG_DEFAULT).split(";");
|
||||
MULTILANG_ALLOWED = new ArrayList<>(allowed.length);
|
||||
for (String lang : allowed)
|
||||
|
||||
@@ -115,6 +115,7 @@ public class HtmCache
|
||||
return null;
|
||||
}
|
||||
|
||||
String filePath = null;
|
||||
String content = null;
|
||||
try (FileInputStream fis = new FileInputStream(file);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
@@ -126,7 +127,13 @@ public class HtmCache
|
||||
content = new String(raw, StandardCharsets.UTF_8);
|
||||
content = content.replaceAll("(?s)<!--.*?-->", ""); // Remove html comments
|
||||
|
||||
final String oldContent = HTML_CACHE.put(file.toURI().getPath().substring(Config.DATAPACK_ROOT.toURI().getPath().length()), content);
|
||||
filePath = file.toURI().getPath().substring(Config.DATAPACK_ROOT.toURI().getPath().length());
|
||||
if (Config.CHECK_HTML_ENCODING && !filePath.startsWith("data/lang") && !StandardCharsets.US_ASCII.newEncoder().canEncode(content))
|
||||
{
|
||||
LOGGER.warning("HTML encoding check: File " + filePath + " contains non ASCII content.");
|
||||
}
|
||||
|
||||
final String oldContent = HTML_CACHE.put(filePath, content);
|
||||
if (oldContent == null)
|
||||
{
|
||||
_bytesBuffLen += bytes;
|
||||
|
||||
Reference in New Issue
Block a user