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,3 +1,3 @@
|
||||
<html><body>Stone of knowledge:<br>
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of €‹ €‹the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
</body></html>
|
@@ -1,3 +1,3 @@
|
||||
<html><body>Stone of knowledge:<br>
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of €‹ €‹the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
</body></html>
|
@@ -1,3 +1,3 @@
|
||||
<html><body>Stone of knowledge:<br>
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of €‹ €‹the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
</body></html>
|
@@ -1,3 +1,3 @@
|
||||
<html><body>Stone of knowledge:<br>
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of €‹ €‹the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
When the activation of the third Stone of Knowledge ended, he showed the location of the next stone. The fourth Stone of Knowledge is in the area of the Elven Village, and the last Amulet of Resonance is near the stone. Go there.
|
||||
</body></html>
|
@@ -1,3 +1,3 @@
|
||||
<html><body>Тобальд:<br>
|
||||
<html><body>Tobald:<br>
|
||||
Now activate the last stone.
|
||||
</body></html>
|
@@ -1,8 +1,8 @@
|
||||
<html><body>Ancestor Martankus:<br>
|
||||
So hot! So hot! My body feels as if it will burst into flame. Aieee!<br>
|
||||
Wait... what's this? The Flame of Combative Spirit? Truly, this is the mind possessed by the warriors of old. ..<br>
|
||||
What is that, there in the distance? What do my old eyes perceive? Oh! Oh! Stay away! The heat, the heat! Ah! Ah, I see... Is this the Flame of Destruction, which engulfs everything in its path and leaves only black ashes?<br>
|
||||
Is this the end? ...<br>
|
||||
No, there is something more! I see a small flame burning bright in the ash. It is the one — the most sacred flame of all! It is the Flame of Life, the vital energy that moves the whole world...<br>
|
||||
What is that, there in the distance? What do my old eyes perceive? Oh! Oh! Stay away! The heat, the heat! Ah! Ah, I see... Is this the Flame of Destruction, which engulfs everything in its path and leaves only black ashes?<br>
|
||||
Is this the end? ...<br>
|
||||
No, there is something more! I see a small flame burning bright in the ash. It is the one? The most sacred flame of all! It is the Flame of Life, the vital energy that moves the whole world...<br>
|
||||
(O insignificant creature, would you venture to see and hear more of my mind's thoughts? You cannot! Your frail mortal frame cannot bear more of this inferno! Farewell!)
|
||||
</body></html>
|
@@ -1,5 +1,5 @@
|
||||
<html><body>Kakan:<br>
|
||||
Our representative is not himself lately. Hey, you look like a magic user... Would you help us? Perhaps you could just rough him up a bit, you know, scare him a little... You must decide quickly though, he draws nigh...<br>
|
||||
Our representative is not himself lately. Hey, you look like a magic user... Would you help us? Perhaps you could just rough him up a bit, you know, scare him a little... You must decide quickly though, he draws nigh...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Q00227_TestOfTheReformer 30669-03.html">"I will help."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Q00227_TestOfTheReformer 30669-05.html">"You're on your own."</Button>
|
||||
</body></html>
|
@@ -1,3 +1,3 @@
|
||||
<html><body>Kakan:<br>
|
||||
Don't you get it? Either use your magic to help us secretly or deal with him directly and knock him out with one blow. We must show him our strength! Otherwise, the entire pack will be upon us! It would be a bloodbath!
|
||||
Don't you get it? Either use your magic to help us secretly or deal with him directly and knock him out with one blow. We must show him our strength! Otherwise, the entire pack will be upon us! It would be a bloodbath!
|
||||
</body></html>
|
@@ -474,6 +474,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;
|
||||
@@ -1943,6 +1944,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);
|
||||
@@ -3143,6 +3145,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