Reduced dependency on futami API.
This commit is contained in:
parent
604c137671
commit
fbbdfd4f52
7 changed files with 16 additions and 16 deletions
3
build.js
3
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',
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue