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> | ||||
| @@ -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> | ||||
| @@ -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; | ||||
| @@ -1928,6 +1929,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); | ||||
| @@ -3117,6 +3119,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
	 MobiusDevelopment
					MobiusDevelopment