diff options
| -rw-r--r-- | webAO/client.ts | 9 | ||||
| -rw-r--r-- | webAO/utils/__tests__/paths.test.ts | 13 | ||||
| -rw-r--r-- | webAO/utils/getResources.js | 8 | ||||
| -rw-r--r-- | webAO/utils/paths.ts | 1 |
4 files changed, 24 insertions, 7 deletions
diff --git a/webAO/client.ts b/webAO/client.ts index c73f975..3876011 100644 --- a/webAO/client.ts +++ b/webAO/client.ts @@ -8,7 +8,7 @@ import FingerprintJS from '@fingerprintjs/fingerprintjs'; import { EventEmitter } from 'events'; import tryUrls from './utils/tryUrls' import { - escapeChat, prepChat, safeTags, + escapeChat, prepChat, safeTags, unescapeChat, } from './encoding'; import mlConfig from './utils/aoml'; // Load some defaults for the background and evidence dropdowns @@ -30,6 +30,7 @@ import getAnimLength from './utils/getAnimLength.js'; import getResources from './utils/getResources.js'; import transparentPng from './constants/transparentPng'; import downloadFile from './services/downloadFile' +import { getFilenameFromPath } from './utils/paths'; const version = process.env.npm_package_version; let client: Client; @@ -1180,7 +1181,9 @@ class Client extends EventEmitter { addTrack(trackname: string) { const newentry = <HTMLOptionElement>document.createElement('OPTION'); - newentry.text = trackname; + const songName = getFilenameFromPath(trackname); + newentry.text = unescapeChat(songName); + newentry.value = trackname; (<HTMLSelectElement>document.getElementById('client_musiclist')).options.add(newentry); this.musics.push(trackname); } @@ -1271,7 +1274,7 @@ class Client extends EventEmitter { for (let i = 1; i < args.length - 1; i++) { // Check when found the song for the first time - const trackname = safeTags(args[i]); + const trackname = args[i]; const trackindex = i - 1; document.getElementById('client_loadingtext').innerHTML = `Loading Music ${i}/${this.music_list_length}`; (<HTMLProgressElement>document.getElementById('client_loadingbar')).value = this.char_list_length + this.evidence_list_length + i; diff --git a/webAO/utils/__tests__/paths.test.ts b/webAO/utils/__tests__/paths.test.ts new file mode 100644 index 0000000..4f41d09 --- /dev/null +++ b/webAO/utils/__tests__/paths.test.ts @@ -0,0 +1,13 @@ +import {getFilenameFromPath} from '../paths' +jest.mock('../fileExists') + +describe('getFilenameFromPath', () => { + const EXAMPLE_PATH = "localhost/stoneddiscord/assets.png" + it('Should get the last value from a path', async () => { + const actual = getFilenameFromPath(EXAMPLE_PATH); + const expected = 'assets.png'; + expect(actual).toBe(expected); + }); +}) + + diff --git a/webAO/utils/getResources.js b/webAO/utils/getResources.js index a0c513e..859e63b 100644 --- a/webAO/utils/getResources.js +++ b/webAO/utils/getResources.js @@ -16,22 +16,22 @@ const getResources = (AO_HOST, THEME) => ({ duration: 840, }, witnesstestimony: { - src: `${AO_HOST}themes/${THEME}/witnesstestimony.gif`, + src: `${AO_HOST}themes/${THEME}/witnesstestimony_bubble.gif`, duration: 1560, sfx: `${AO_HOST}sounds/general/sfx-testimony.opus`, }, crossexamination: { - src: `${AO_HOST}themes/${THEME}/crossexamination.gif`, + src: `${AO_HOST}themes/${THEME}/crossexamination_bubble.gif`, duration: 1600, sfx: `${AO_HOST}sounds/general/sfx-testimony2.opus`, }, guilty: { - src: `${AO_HOST}themes/${THEME}/guilty.gif`, + src: `${AO_HOST}themes/${THEME}/guilty_bubble.gif`, duration: 2870, sfx: `${AO_HOST}sounds/general/sfx-guilty.opus`, }, notguilty: { - src: `${AO_HOST}themes/${THEME}/notguilty.gif`, + src: `${AO_HOST}themes/${THEME}/notguilty_bubble.gif`, duration: 2440, sfx: `${AO_HOST}sounds/general/sfx-notguilty.opus`, }, diff --git a/webAO/utils/paths.ts b/webAO/utils/paths.ts new file mode 100644 index 0000000..f4284b6 --- /dev/null +++ b/webAO/utils/paths.ts @@ -0,0 +1 @@ +export const getFilenameFromPath = (path: string) => path.substring(path.lastIndexOf('/') + 1) |
