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: {
|
vars: {
|
||||||
html: { title },
|
html: { title },
|
||||||
build: {
|
build: {
|
||||||
FUTAMI_DEBUG: isDebug,
|
DEBUG: isDebug,
|
||||||
|
TITLE: title,
|
||||||
FII_URL: process.env.MAMI_FII_URL ?? '//flashii.net',
|
FII_URL: process.env.MAMI_FII_URL ?? '//flashii.net',
|
||||||
FUTAMI_URL: process.env.FUTAMI_URL ?? '//futami.flashii.net/common.json',
|
FUTAMI_URL: process.env.FUTAMI_URL ?? '//futami.flashii.net/common.json',
|
||||||
AMI_URL: process.env.AMI_URL ?? '//sockchat.flashii.net',
|
AMI_URL: process.env.AMI_URL ?? '//sockchat.flashii.net',
|
||||||
|
|
|
@ -89,7 +89,7 @@ const MamiInit = async args => {
|
||||||
throw 'Authentication failed.';
|
throw 'Authentication failed.';
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
console.error(ex);
|
console.error(ex);
|
||||||
location.assign(futami.get('login'));
|
location.assign(`${window.FII_URL}/_sockchat/login`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ const MamiInit = async args => {
|
||||||
MamiMisuzuAuth.update()
|
MamiMisuzuAuth.update()
|
||||||
.then(auth => {
|
.then(auth => {
|
||||||
if(!auth.ok)
|
if(!auth.ok)
|
||||||
location.assign(futami.get('login'));
|
location.assign(`${window.FII_URL}/_sockchat/login`);
|
||||||
})
|
})
|
||||||
}, 600000);
|
}, 600000);
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,8 @@ const MamiInit = async args => {
|
||||||
settings.define('osuKeys').default(false).create();
|
settings.define('osuKeys').default(false).create();
|
||||||
settings.define('osuKeysV2').type(['no', 'yes', 'rng']).default('no').create();
|
settings.define('osuKeysV2').type(['no', 'yes', 'rng']).default('no').create();
|
||||||
settings.define('explosionRadius').default(20).min(0).create();
|
settings.define('explosionRadius').default(20).min(0).create();
|
||||||
settings.define('dumpPackets').default(FUTAMI_DEBUG).create();
|
settings.define('dumpPackets').default(window.DEBUG).create();
|
||||||
settings.define('dumpEvents').default(FUTAMI_DEBUG).create();
|
settings.define('dumpEvents').default(window.DEBUG).create();
|
||||||
settings.define('marqueeAllNames').default(false).create();
|
settings.define('marqueeAllNames').default(false).create();
|
||||||
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
|
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
|
||||||
settings.define('newLineOnEnter').default(false).create();
|
settings.define('newLineOnEnter').default(false).create();
|
||||||
|
@ -405,7 +405,7 @@ const MamiInit = async args => {
|
||||||
sbUsers.addOption({
|
sbUsers.addOption({
|
||||||
name: 'profile',
|
name: 'profile',
|
||||||
text: 'View 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({
|
sbUsers.addOption({
|
||||||
name: 'action',
|
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({
|
sbUploads.addOption({
|
||||||
name: 'view',
|
name: 'view',
|
||||||
|
@ -949,7 +949,7 @@ const MamiInit = async args => {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const MamiDbgCreateFloatingInstance = async () => {
|
const MamiDbgCreateFloatingInstance = async () => {
|
||||||
if(!FUTAMI_DEBUG)
|
if(!window.DEBUG)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const prefix = $rngs(8);
|
const prefix = $rngs(8);
|
||||||
|
|
|
@ -17,7 +17,7 @@ const MamiMisuzuAuth = (() => {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
update: async () => {
|
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) {
|
if(body.ok) {
|
||||||
userId = body.usr.toString();
|
userId = body.usr.toString();
|
||||||
authToken = body.tkn;
|
authToken = body.tkn;
|
||||||
|
|
|
@ -19,7 +19,7 @@ const MamiSockChat = function(eventTarget) {
|
||||||
client.close();
|
client.close();
|
||||||
|
|
||||||
restarting = false;
|
restarting = false;
|
||||||
client = new SockChatClient(eventTarget.dispatch, { ping: futami.get('ping') });
|
client = new SockChatClient(eventTarget.dispatch, { ping: 30 });
|
||||||
client.setDumpPackets(dumpPackets);
|
client.setDumpPackets(dumpPackets);
|
||||||
|
|
||||||
MamiCompat('Umi.Server', { get: () => client, configurable: true });
|
MamiCompat('Umi.Server', { get: () => client, configurable: true });
|
||||||
|
|
|
@ -117,7 +117,7 @@ const MamiSockChatHandlers = function(
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ev.detail.session.needsAuth) {
|
if(ev.detail.session.needsAuth) {
|
||||||
location.assign(futami.get('login'));
|
location.assign(`${window.FII_URL}/_sockchat/login`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ Umi.UI.Messages = (function() {
|
||||||
let focusChannelName = '';
|
let focusChannelName = '';
|
||||||
|
|
||||||
const title = new MamiWindowTitle({
|
const title = new MamiWindowTitle({
|
||||||
getName: () => futami.get('title'),
|
getName: () => window.TITLE,
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('focus', () => title.clear());
|
window.addEventListener('focus', () => title.clear());
|
||||||
|
|
|
@ -33,13 +33,12 @@ const MamiUserAvatarInfo = function(userId = null) {
|
||||||
if(typeof userId !== 'string')
|
if(typeof userId !== 'string')
|
||||||
throw 'userId must be a string or null';
|
throw 'userId must be a string or null';
|
||||||
|
|
||||||
const template = futami.get('avatar') ?? '';
|
|
||||||
const changeTime = Date.now();
|
const changeTime = Date.now();
|
||||||
|
|
||||||
const getAvatar = res => {
|
const getAvatar = res => {
|
||||||
return template.replace('{user:id}', userId)
|
return !res || res === '0'
|
||||||
.replace('{resolution}', res)
|
? `${window.FII_URL}/assets/avatar/${encodeURIComponent(userId)}?ver=${encodeURIComponent(changeTime)}`
|
||||||
.replace('{user:avatar_change}', changeTime);
|
: `${window.FII_URL}/assets/avatar/${encodeURIComponent(userId)}?res=${encodeURIComponent(res)}&ver=${encodeURIComponent(changeTime)}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue