From d025e6fb809c6e85f0f3444aae2ae39f744502ad Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 21 Mar 2020 17:36:28 +0100 Subject: fix #43 by clearing it on dead connection --- webAO/client.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 4facca7..6fda3fc 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -478,6 +478,11 @@ class Client extends EventEmitter { */ cleanup() { clearInterval(this.checkUpdater); + + // the connection got rekt, get rid of the old musiclist + document.getElementById("areas").innerHTML = ""; + document.getElementById("client_musiclist").innerHTML = ""; + document.getElementById("client_chartable").innerHTML = ""; } /** @@ -2166,7 +2171,9 @@ export function ReconnectButton() { client = new Client(serverIP); if (client) { mode = "join"; // HACK: see client.onOpen + document.getElementById("client_error").style.display = "none"; + } } window.ReconnectButton = ReconnectButton; -- cgit From 4c61f65b3d94f0a646260e3fc38cadcdd1433c57 Mon Sep 17 00:00:00 2001 From: sD Date: Sun, 22 Mar 2020 18:41:39 +0100 Subject: allow loading local files --- webAO/client.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webAO') diff --git a/webAO/client.html b/webAO/client.html index 69e17e9..c39e117 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -10,9 +10,9 @@ script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ajax.googleapis.com; style-src-elem 'self' 'unsafe-inline' https://golden-layout.com; style-src 'self' 'unsafe-inline' https://golden-layout.com; - img-src 'self' data: https://webao.animatedchatroom.net https://s3.wasabisys.com; - connect-src 'self' ws: https://webao.animatedchatroom.net https://s3.wasabisys.com; - media-src 'self' https://webao.animatedchatroom.net https://s3.wasabisys.com;"> + img-src 'self' data: file: https://webao.animatedchatroom.net https://s3.wasabisys.com; + connect-src 'self' ws: file: https://webao.animatedchatroom.net https://s3.wasabisys.com; + media-src 'self' file: https://webao.animatedchatroom.net https://s3.wasabisys.com;"> -- cgit From 8adfabddb95ba284e642224a346bb0b34a578d95 Mon Sep 17 00:00:00 2001 From: sD Date: Mon, 23 Mar 2020 13:52:01 +0100 Subject: add https and javascript warnings --- webAO/index.html | 9 +++++++++ webAO/master.js | 10 ++++++++++ webAO/styles/master.css | 4 ++++ 3 files changed, 23 insertions(+) (limited to 'webAO') diff --git a/webAO/index.html b/webAO/index.html index a2c1203..3ed0d26 100644 --- a/webAO/index.html +++ b/webAO/index.html @@ -60,6 +60,15 @@

Server List

+ +
  • Localhost

    diff --git a/webAO/master.js b/webAO/master.js index 1607fa5..7ceb748 100644 --- a/webAO/master.js +++ b/webAO/master.js @@ -31,6 +31,8 @@ if (window.requestIdleCallback) { Fingerprint2.get(options, function (components) { hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31); + check_https(); + masterserver = new WebSocket("ws://" + MASTERSERVER_IP); masterserver.onopen = (evt) => onOpen(evt); masterserver.onmessage = (evt) => onMessage(evt); @@ -45,6 +47,8 @@ if (window.requestIdleCallback) { Fingerprint2.get(options, function (components) { hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31); + check_https(); + masterserver = new WebSocket("ws://" + MASTERSERVER_IP); masterserver.onopen = (evt) => onOpen(evt); masterserver.onmessage = (evt) => onMessage(evt); @@ -56,6 +60,12 @@ if (window.requestIdleCallback) { }, 500); } +export function check_https() { + if (document.location.protocol === "https:") { + document.getElementById("https_error").style.display = ""; + } +} + export function setServ(ID) { console.log(server_description[ID]); if (server_description[ID] !== undefined) { diff --git a/webAO/styles/master.css b/webAO/styles/master.css index 4f6d0ad..4b585da 100644 --- a/webAO/styles/master.css +++ b/webAO/styles/master.css @@ -144,6 +144,10 @@ box-shadow: 0 0 0 1px #EFAD21; } +.error { + color: orangered; +} + #content {} ul.navbar-nav.ml-auto { -- cgit From 564a2b87d361a1e3cf3d1ce7774df88b400b3657 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 25 Mar 2020 00:22:01 +0100 Subject: empty css rule --- webAO/styles/master.css | 2 -- 1 file changed, 2 deletions(-) (limited to 'webAO') diff --git a/webAO/styles/master.css b/webAO/styles/master.css index 4b585da..108d0e4 100644 --- a/webAO/styles/master.css +++ b/webAO/styles/master.css @@ -148,8 +148,6 @@ color: orangered; } -#content {} - ul.navbar-nav.ml-auto { display: inline-flex; list-style-type: none; -- cgit From be29ededc43f8b2f0a79d573b25a12e7632c6f03 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 25 Mar 2020 00:22:14 +0100 Subject: add correct word spacing to classic theme --- webAO/styles/classic.css | 2 ++ 1 file changed, 2 insertions(+) (limited to 'webAO') diff --git a/webAO/styles/classic.css b/webAO/styles/classic.css index aea5b34..e40e8d8 100644 --- a/webAO/styles/classic.css +++ b/webAO/styles/classic.css @@ -130,6 +130,8 @@ img { padding: 1% 3.13%; margin: 1px; line-height: 97%; + letter-spacing: 0.05em; + word-spacing: 0.3em; } #client_chatwaiting { -- cgit From a992bc582d72d88925926ed4e9bc4444a68a042c Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 25 Mar 2020 00:27:07 +0100 Subject: nametag is bold --- webAO/styles/classic.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webAO') diff --git a/webAO/styles/classic.css b/webAO/styles/classic.css index e40e8d8..c87d76d 100644 --- a/webAO/styles/classic.css +++ b/webAO/styles/classic.css @@ -93,6 +93,7 @@ img { min-width: 3.25em; text-justify: distribute; letter-spacing: 0.075em; + font-weight: bold; background: rgba(56, 56, 163, 0.5); box-shadow: 0.075em 0.075em rgba(0, 56, 163, 0.5) inset; left: 0; @@ -137,7 +138,7 @@ img { #client_chatwaiting { display: block; right: -6px; - bottom: 0.24em; + bottom: 0.2em; width: 1em; position: absolute; animation: idling 0.4s linear infinite; -- cgit From 2ed9af82f21f1390d507f04638157b63bfd4b949 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 25 Mar 2020 23:12:27 +0100 Subject: move encoding stuff to seperate js file --- webAO/client.js | 92 ++----------------------------------------------------- webAO/encoding.js | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ webAO/master.js | 16 ++-------- 3 files changed, 90 insertions(+), 103 deletions(-) create mode 100644 webAO/encoding.js (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 6fda3fc..2ddfb72 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -6,6 +6,8 @@ import Fingerprint2 from 'fingerprintjs2'; +import { unescapeChat, escapeChat, encodeChat, decodeChat, safe_tags } from './encoding.js'; + // Load some defaults for the background and evidence dropdowns import character_arr from "./characters.js"; import background_arr from "./backgrounds.js"; @@ -13,8 +15,6 @@ import evidence_arr from "./evidence.js"; import { EventEmitter } from "events"; -const version = 2.4; - let client; let viewport; @@ -2617,90 +2617,4 @@ export function toggleShout(shout) { selectedShout = shout; } } -window.toggleShout = toggleShout; - -/** - * Escapes a string to be HTML-safe. - * - * XXX: This is unnecessary if we use `createTextNode` instead! - * @param {string} unsafe an unsanitized string - */ -function safe_tags(unsafe) { - if (unsafe) { - return unsafe - .replace(/&/g, "&") - .replace(/") - .replace(/&/g, "") - .replace(/%/g, "") - .replace(/\$/g, ""); -} - -/** - * Unescapes a string to AO1 escape codes. - * @param {string} estring the string to be unescaped - */ -function unescapeChat(estring) { - return estring - .replace(//g, "#") - .replace(//g, "&") - .replace(//g, "%") - .replace(//g, "$"); -} - -/** - * Encode text on client side. - * @param {string} estring the string to be encoded - */ -function encodeChat(estring) { - const selectedEncoding = document.getElementById("client_encoding").value; - if (selectedEncoding === "unicode") { - // This approach works by escaping all special characters to Unicode escape sequences. - // Source: https://gist.github.com/mathiasbynens/1243213 - return estring.replace(/[^\0-~]/g, function (ch) { - return "\\u" + ("000" + ch.charCodeAt().toString(16)).slice(-4); - }); - } else if (selectedEncoding === "utf16") { - // Source: https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String - const buffer = new ArrayBuffer(estring.length * 2); - const result = new Uint16Array(buffer); - for (let i = 0, strLen = estring.length; i < strLen; i++) { - result[i] = estring.charCodeAt(i); - } - return String(result); - } else { - return estring; - } -} - -/** - * Decodes text on client side. - * @param {string} estring the string to be decoded - */ -function decodeChat(estring) { - const selectedDecoding = document.getElementById("client_decoding").value; - if (selectedDecoding === "unicode") { - // Source: https://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode - return estring.replace(/\\u([\d\w]{1,})/gi, function (match, group) { - return String.fromCharCode(parseInt(group, 16)); - }); - } else if (selectedDecoding === "utf16") { - // Source: https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String - return String.fromCharCode.apply(null, new Uint16Array(estring.split(","))); - } else { - return estring; - } -} \ No newline at end of file +window.toggleShout = toggleShout; \ No newline at end of file diff --git a/webAO/encoding.js b/webAO/encoding.js new file mode 100644 index 0000000..76e0b6d --- /dev/null +++ b/webAO/encoding.js @@ -0,0 +1,85 @@ +/** + * Escapes a string to AO1 escape codes. + * @param {string} estring the string to be escaped + */ +export function escapeChat(estring) { + return estring + .replace(/#/g, "") + .replace(/&/g, "") + .replace(/%/g, "") + .replace(/\$/g, ""); +} + +/** + * Unescapes a string to AO1 escape codes. + * @param {string} estring the string to be unescaped + */ +export function unescapeChat(estring) { + return estring + .replace(//g, "#") + .replace(//g, "&") + .replace(//g, "%") + .replace(//g, "$"); +} + +/** + * Escapes a string to be HTML-safe. + * + * XXX: This is unnecessary if we use `createTextNode` instead! + * @param {string} unsafe an unsanitized string + */ +export function safe_tags(unsafe) { + if (unsafe) { + return unsafe + .replace(/&/g, "&") + .replace(//g, "#") - .replace(//g, "&") - .replace(//g, "%") - .replace(//g, "$"); -} - if (window.requestIdleCallback) { requestIdleCallback(function () { Fingerprint2.get(options, function (components) { @@ -170,7 +158,7 @@ function onMessage(e) { } else if (header === "servercheok") { const args = msg.split("#").slice(1); - document.getElementById("clientinfo").innerHTML = `Client version: ${args[0]}`; + document.getElementById("clientinfo").innerHTML = `Client version: ${version} expected: ${args[0]}`; } else if (header === "SV") { const args = msg.split("#").slice(1); -- cgit From 84d274165022cd910984a1df145db6e1e4cd49a2 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 25 Mar 2020 23:17:34 +0100 Subject: get version from package.json --- webAO/client.js | 2 ++ webAO/master.js | 1 + 2 files changed, 3 insertions(+) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 2ddfb72..014ffb0 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -15,6 +15,8 @@ import evidence_arr from "./evidence.js"; import { EventEmitter } from "events"; +const version = require('../package.json').version; + let client; let viewport; diff --git a/webAO/master.js b/webAO/master.js index 660b6e2..5d1e8a7 100644 --- a/webAO/master.js +++ b/webAO/master.js @@ -1,4 +1,5 @@ const MASTERSERVER_IP = "master.aceattorneyonline.com:27014"; +const version = require('../package.json').version; import Fingerprint2 from 'fingerprintjs2'; import { unescapeChat } from './encoding.js'; -- cgit From 86abb096570c94110bb48edb4b37021eb2cbd273 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 27 Mar 2020 11:22:35 +0100 Subject: add epic charselect music most people probably won't hear it because it is automatically played before the user interacts with the page. this is blocked by most browsers --- webAO/client.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 014ffb0..51669ed 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -893,6 +893,12 @@ class Client extends EventEmitter { document.getElementById("client_charselect").style.display = "none"; } else { document.getElementById("client_charselect").style.display = "block"; + viewport.sfxaudio.pause(); + viewport.sfxaudio.src = "https://s3.wasabisys.com/webao/base/sounds/general/nr_select04.dsp.wav"; + viewport.sfxaudio.play(); + const musicaudio = document.getElementById("client_musicaudio"); + musicaudio.src = "https://s3.wasabisys.com/webao/base/sounds/music/[ssbm] menu 1.mp3"; + musicaudio.play(); } } -- cgit From 85fa666f2d3ee13760ded11e34e89fe349aab75f Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 27 Mar 2020 14:39:51 +0100 Subject: get rid of require --- webAO/client.js | 2 +- webAO/master.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index 51669ed..e68caf0 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -15,7 +15,7 @@ import evidence_arr from "./evidence.js"; import { EventEmitter } from "events"; -const version = require('../package.json').version; +import { version } from '../package.json'; let client; let viewport; diff --git a/webAO/master.js b/webAO/master.js index 5d1e8a7..ec58083 100644 --- a/webAO/master.js +++ b/webAO/master.js @@ -1,5 +1,5 @@ const MASTERSERVER_IP = "master.aceattorneyonline.com:27014"; -const version = require('../package.json').version; +import { version } from '../package.json'; import Fingerprint2 from 'fingerprintjs2'; import { unescapeChat } from './encoding.js'; -- cgit From ebc0bf82313982e0a86b6f15188fbe56e355748a Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 27 Mar 2020 15:18:01 +0100 Subject: remove short class and move ooc name to ooc --- webAO/client.html | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'webAO') diff --git a/webAO/client.html b/webAO/client.html index c39e117..a2596fe 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -218,7 +218,7 @@
    - +

@@ -269,8 +269,6 @@ - - + @@ -345,15 +343,15 @@

- +

- +

- +

Changing these settings will save them as a cookie.
@@ -387,7 +385,10 @@
- + + + +
-- cgit From 96d39ddd608d770d490c41d64dde9fcb7ccf0274 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 27 Mar 2020 15:24:58 +0100 Subject: play the classic annoying modcall sound --- webAO/client.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'webAO') diff --git a/webAO/client.js b/webAO/client.js index e68caf0..27be410 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -975,6 +975,9 @@ class Client extends EventEmitter { if (oocLog.scrollTop > oocLog.scrollHeight - 60) { oocLog.scrollTop = oocLog.scrollHeight; } + viewport.sfxaudio.pause(); + viewport.sfxaudio.src = AO_HOST + "sounds/general/sfx-gallery.wav"; + viewport.sfxaudio.play(); } /** -- cgit From 43f65ab568fc56d3dfbc173080f8095e595aff9a Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 27 Mar 2020 15:51:58 +0100 Subject: move position select from settings to char tab --- webAO/client.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'webAO') diff --git a/webAO/client.html b/webAO/client.html index a2596fe..2416b1b 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -111,6 +111,19 @@ +
+
+ +
Actions @@ -269,19 +282,6 @@ - - -
-