diff --git a/build.js b/build.js index 666e30a..e1ff2d6 100644 --- a/build.js +++ b/build.js @@ -17,7 +17,8 @@ const exec = require('util').promisify(require('child_process').exec); vars: { html: { title }, build: { - FUTAMI_DEBUG: isDebug, + DEBUG: isDebug, + TITLE: title, FII_URL: process.env.MAMI_FII_URL ?? '//flashii.net', FUTAMI_URL: process.env.FUTAMI_URL ?? '//futami.flashii.net/common.json', AMI_URL: process.env.AMI_URL ?? '//sockchat.flashii.net', diff --git a/src/mami.js/main.js b/src/mami.js/main.js index 403b723..64b8d2e 100644 --- a/src/mami.js/main.js +++ b/src/mami.js/main.js @@ -89,7 +89,7 @@ const MamiInit = async args => { throw 'Authentication failed.'; } catch(ex) { console.error(ex); - location.assign(futami.get('login')); + location.assign(`${window.FII_URL}/_sockchat/login`); return; } @@ -97,7 +97,7 @@ const MamiInit = async args => { MamiMisuzuAuth.update() .then(auth => { if(!auth.ok) - location.assign(futami.get('login')); + location.assign(`${window.FII_URL}/_sockchat/login`); }) }, 600000); } @@ -140,8 +140,8 @@ const MamiInit = async args => { settings.define('osuKeys').default(false).create(); settings.define('osuKeysV2').type(['no', 'yes', 'rng']).default('no').create(); settings.define('explosionRadius').default(20).min(0).create(); - settings.define('dumpPackets').default(FUTAMI_DEBUG).create(); - settings.define('dumpEvents').default(FUTAMI_DEBUG).create(); + settings.define('dumpPackets').default(window.DEBUG).create(); + settings.define('dumpEvents').default(window.DEBUG).create(); settings.define('marqueeAllNames').default(false).create(); settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create(); settings.define('newLineOnEnter').default(false).create(); @@ -405,7 +405,7 @@ const MamiInit = async args => { sbUsers.addOption({ name: 'profile', text: 'View profile', - onclick: entry => window.open(futami.get('profile').replace('{user:id}', entry.id), '_blank'), + onclick: entry => window.open(`${window.FII_URL}/profile.php?u=${encodeURIComponent(entry.id)}`, '_blank'), }); sbUsers.addOption({ name: 'action', @@ -697,7 +697,7 @@ const MamiInit = async args => { }); - ctx.eeprom = new MamiEEPROM(futami.get('eeprom2')); + ctx.eeprom = new MamiEEPROM(window.FII_URL); sbUploads.addOption({ name: 'view', @@ -949,7 +949,7 @@ const MamiInit = async args => { })(); const MamiDbgCreateFloatingInstance = async () => { - if(!FUTAMI_DEBUG) + if(!window.DEBUG) return; const prefix = $rngs(8); diff --git a/src/mami.js/mszauth.js b/src/mami.js/mszauth.js index 42bb0d3..492d76f 100644 --- a/src/mami.js/mszauth.js +++ b/src/mami.js/mszauth.js @@ -17,7 +17,7 @@ const MamiMisuzuAuth = (() => { }; }, update: async () => { - const { body } = await $xhr.get(futami.get('token'), { authed: true, type: 'json' }); + const { body } = await $xhr.get(`${window.FII_URL}/_sockchat/token`, { authed: true, type: 'json' }); if(body.ok) { userId = body.usr.toString(); authToken = body.tkn; diff --git a/src/mami.js/sockchat/client.js b/src/mami.js/sockchat/client.js index e13027f..36f013d 100644 --- a/src/mami.js/sockchat/client.js +++ b/src/mami.js/sockchat/client.js @@ -19,7 +19,7 @@ const MamiSockChat = function(eventTarget) { client.close(); restarting = false; - client = new SockChatClient(eventTarget.dispatch, { ping: futami.get('ping') }); + client = new SockChatClient(eventTarget.dispatch, { ping: 30 }); client.setDumpPackets(dumpPackets); MamiCompat('Umi.Server', { get: () => client, configurable: true }); diff --git a/src/mami.js/sockchat/handlers.js b/src/mami.js/sockchat/handlers.js index 8c88f90..12156e6 100644 --- a/src/mami.js/sockchat/handlers.js +++ b/src/mami.js/sockchat/handlers.js @@ -117,7 +117,7 @@ const MamiSockChatHandlers = function( } if(ev.detail.session.needsAuth) { - location.assign(futami.get('login')); + location.assign(`${window.FII_URL}/_sockchat/login`); return; } diff --git a/src/mami.js/ui/messages.jsx b/src/mami.js/ui/messages.jsx index f28d7a6..1c04e21 100644 --- a/src/mami.js/ui/messages.jsx +++ b/src/mami.js/ui/messages.jsx @@ -12,7 +12,7 @@ Umi.UI.Messages = (function() { let focusChannelName = ''; const title = new MamiWindowTitle({ - getName: () => futami.get('title'), + getName: () => window.TITLE, }); window.addEventListener('focus', () => title.clear()); diff --git a/src/mami.js/users.js b/src/mami.js/users.js index 61a33f7..b128b4a 100644 --- a/src/mami.js/users.js +++ b/src/mami.js/users.js @@ -33,13 +33,12 @@ const MamiUserAvatarInfo = function(userId = null) { if(typeof userId !== 'string') throw 'userId must be a string or null'; - const template = futami.get('avatar') ?? ''; const changeTime = Date.now(); const getAvatar = res => { - return template.replace('{user:id}', userId) - .replace('{resolution}', res) - .replace('{user:avatar_change}', changeTime); + return !res || res === '0' + ? `${window.FII_URL}/assets/avatar/${encodeURIComponent(userId)}?ver=${encodeURIComponent(changeTime)}` + : `${window.FII_URL}/assets/avatar/${encodeURIComponent(userId)}?res=${encodeURIComponent(res)}&ver=${encodeURIComponent(changeTime)}`; }; return {