Reduced futami footprint here as well.

This commit is contained in:
flash 2025-04-21 00:27:49 +00:00
parent 5367895f0e
commit dd52d265e1
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
9 changed files with 71 additions and 73 deletions

View file

@ -8,9 +8,9 @@
# Sets the title of the application, might be overridden for the window title by the common settings below once they're loaded # Sets the title of the application, might be overridden for the window title by the common settings below once they're loaded
#AMI_TITLE="Flashii Chat" #AMI_TITLE="Flashii Chat"
# Flashii API base URL # Flashii base URL
# Sets the base URL for Flashii API, without the version part! # Sets the base URL for Flashii
#AMI_API_URL="//flashii.net/api" #AMI_FII_URL="//flashii.net"
# Common configuration location # Common configuration location
# Contains further information shared by the other chat client # Contains further information shared by the other chat client

View file

@ -5,6 +5,7 @@ const exec = require('util').promisify(require('child_process').exec);
(async () => { (async () => {
const isDebug = !!process.env.AMI_DEBUG; const isDebug = !!process.env.AMI_DEBUG;
const title = process.env.AMI_TITLE ?? 'Flashii Chat';
const env = { const env = {
root: __dirname, root: __dirname,
@ -14,12 +15,11 @@ const exec = require('util').promisify(require('child_process').exec);
swc: { es: 'es5' }, swc: { es: 'es5' },
housekeep: [ pathJoin(__dirname, 'public', 'assets') ], housekeep: [ pathJoin(__dirname, 'public', 'assets') ],
vars: { vars: {
html: { html: { title },
title: process.env.AMI_TITLE ?? 'Flashii Chat',
},
build: { build: {
FUTAMI_DEBUG: isDebug, DEBUG: isDebug,
FII_API: process.env.AMI_API_URL ?? '//flashii.net/api', TITLE: title,
FII_URL: process.env.AMI_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',
GIT_HASH: (await exec('git log --pretty="%H" -n1 HEAD')).stdout, GIT_HASH: (await exec('git log --pretty="%H" -n1 HEAD')).stdout,
}, },

98
package-lock.json generated
View file

@ -80,9 +80,9 @@
} }
}, },
"node_modules/@swc/core": { "node_modules/@swc/core": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.11.21.tgz",
"integrity": "sha512-2F0+bQs7+pwbudsxRffLdfpGCQX4Ih5k88f7LqTfj2oC7aTrv7FssduOvcAvfVY/InZmyYEblKl1rqg8bvzrZQ==", "integrity": "sha512-/Y3BJLcwd40pExmdar8MH2UGGvCBrqNN7hauOMckrEX2Ivcbv3IMhrbGX4od1dnF880Ed8y/E9aStZCIQi0EGw==",
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
@ -97,16 +97,16 @@
"url": "https://opencollective.com/swc" "url": "https://opencollective.com/swc"
}, },
"optionalDependencies": { "optionalDependencies": {
"@swc/core-darwin-arm64": "1.11.20", "@swc/core-darwin-arm64": "1.11.21",
"@swc/core-darwin-x64": "1.11.20", "@swc/core-darwin-x64": "1.11.21",
"@swc/core-linux-arm-gnueabihf": "1.11.20", "@swc/core-linux-arm-gnueabihf": "1.11.21",
"@swc/core-linux-arm64-gnu": "1.11.20", "@swc/core-linux-arm64-gnu": "1.11.21",
"@swc/core-linux-arm64-musl": "1.11.20", "@swc/core-linux-arm64-musl": "1.11.21",
"@swc/core-linux-x64-gnu": "1.11.20", "@swc/core-linux-x64-gnu": "1.11.21",
"@swc/core-linux-x64-musl": "1.11.20", "@swc/core-linux-x64-musl": "1.11.21",
"@swc/core-win32-arm64-msvc": "1.11.20", "@swc/core-win32-arm64-msvc": "1.11.21",
"@swc/core-win32-ia32-msvc": "1.11.20", "@swc/core-win32-ia32-msvc": "1.11.21",
"@swc/core-win32-x64-msvc": "1.11.20" "@swc/core-win32-x64-msvc": "1.11.21"
}, },
"peerDependencies": { "peerDependencies": {
"@swc/helpers": ">=0.5.17" "@swc/helpers": ">=0.5.17"
@ -118,9 +118,9 @@
} }
}, },
"node_modules/@swc/core-darwin-arm64": { "node_modules/@swc/core-darwin-arm64": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.11.21.tgz",
"integrity": "sha512-Sc06h6pwMhQagU7vz92b7wwQTIibTiqRE4y/XjkvurSbjSarrtSZR4OKkrdNwUkSy1HlQE4NhKQf7tmLeQ7PhQ==", "integrity": "sha512-v6gjw9YFWvKulCw3ZA1dY+LGMafYzJksm1mD4UZFZ9b36CyHFowYVYug1ajYRIRqEvvfIhHUNV660zTLoVFR8g==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -134,9 +134,9 @@
} }
}, },
"node_modules/@swc/core-darwin-x64": { "node_modules/@swc/core-darwin-x64": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.11.21.tgz",
"integrity": "sha512-kHANJrgbqaGzUyTectNfLyhnHAeDGGVSRXYyPVAx6x0nuLOnRhKbuSyZY42UEN1IgHauaADCzcd+HiiMv/rgRw==", "integrity": "sha512-CUiTiqKlzskwswrx9Ve5NhNoab30L1/ScOfQwr1duvNlFvarC8fvQSgdtpw2Zh3MfnfNPpyLZnYg7ah4kbT9JQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -150,9 +150,9 @@
} }
}, },
"node_modules/@swc/core-linux-arm-gnueabihf": { "node_modules/@swc/core-linux-arm-gnueabihf": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.11.21.tgz",
"integrity": "sha512-FXllEBeAwU6FNIZzo+u1LmHGaHzwAKzz7tWRkUOqBKjKr20Ot4KGS3xlz2qgV2NESFHAisdHja2P2rcQWqtZRg==", "integrity": "sha512-YyBTAFM/QPqt1PscD8hDmCLnqPGKmUZpqeE25HXY8OLjl2MUs8+O4KjwPZZ+OGxpdTbwuWFyMoxjcLy80JODvg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -166,9 +166,9 @@
} }
}, },
"node_modules/@swc/core-linux-arm64-gnu": { "node_modules/@swc/core-linux-arm64-gnu": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.11.21.tgz",
"integrity": "sha512-OsYMFyJzUM0K8a97tu6KxZaCob3vr+UknVqHO09QwechX+rdX4euWm7Lte4d1B+7SBfokhw7ghLZsNTQfRw9pA==", "integrity": "sha512-DQD+ooJmwpNsh4acrftdkuwl5LNxxg8U4+C/RJNDd7m5FP9Wo4c0URi5U0a9Vk/6sQNh9aSGcYChDpqCDWEcBw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -182,9 +182,9 @@
} }
}, },
"node_modules/@swc/core-linux-arm64-musl": { "node_modules/@swc/core-linux-arm64-musl": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.11.21.tgz",
"integrity": "sha512-fbSWOQ5ZZ7sWodoC6GnzV9RhbImdxoH8b14K1tnHCWJXolzTH40/4JKf/koJ3r24nm1PtsqX9OUxRsOXYAy5dg==", "integrity": "sha512-y1L49+snt1a1gLTYPY641slqy55QotPdtRK9Y6jMi4JBQyZwxC8swWYlQWb+MyILwxA614fi62SCNZNznB3XSA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -198,9 +198,9 @@
} }
}, },
"node_modules/@swc/core-linux-x64-gnu": { "node_modules/@swc/core-linux-x64-gnu": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.11.21.tgz",
"integrity": "sha512-OFU53idbY8KA1RkNzZBi0FpoRPSn/anv4N7ZzGZGk664UoFwMbSL+XHGocJzhV9G/VNGH7bMBmgoVWk72nn5hw==", "integrity": "sha512-NesdBXv4CvVEaFUlqKj+GA4jJMNUzK2NtKOrUNEtTbXaVyNiXjFCSaDajMTedEB0jTAd9ybB0aBvwhgkJUWkWA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -214,9 +214,9 @@
} }
}, },
"node_modules/@swc/core-linux-x64-musl": { "node_modules/@swc/core-linux-x64-musl": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.11.21.tgz",
"integrity": "sha512-GZbqXEc09nIarkGMXc2P4Hf2ONb1vre22X7Se9CCeU/QtWYRU/H1a2TFnYgBKzNVOH65Dd/XYXcuy+tM1aw1iw==", "integrity": "sha512-qFV60pwpKVOdmX67wqQzgtSrUGWX9Cibnp1CXyqZ9Mmt8UyYGvmGu7p6PMbTyX7vdpVUvWVRf8DzrW2//wmVHg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -230,9 +230,9 @@
} }
}, },
"node_modules/@swc/core-win32-arm64-msvc": { "node_modules/@swc/core-win32-arm64-msvc": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.11.21.tgz",
"integrity": "sha512-i0H2MeK8krEd/YeiGz0GHtNL9wSGfAPXiouh8aRNV/u+w4vPaaRqnXwv/yzAW+D2vPpKJBhOwmNFFzdgTJ5mWw==", "integrity": "sha512-DJJe9k6gXR/15ZZVLv1SKhXkFst8lYCeZRNHH99SlBodvu4slhh/MKQ6YCixINRhCwliHrpXPym8/5fOq8b7Ig==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -246,9 +246,9 @@
} }
}, },
"node_modules/@swc/core-win32-ia32-msvc": { "node_modules/@swc/core-win32-ia32-msvc": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.11.21.tgz",
"integrity": "sha512-/7e3X7EGO8uOvAUP+YKJTdoR2JR5vdiewDOnDS9FFXj8yr9x6/oDFLd92Sp9NglF+aXuqAo33IfH2OTz1MR+Ww==", "integrity": "sha512-TqEXuy6wedId7bMwLIr9byds+mKsaXVHctTN88R1UIBPwJA92Pdk0uxDgip0pEFzHB/ugU27g6d8cwUH3h2eIw==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -262,9 +262,9 @@
} }
}, },
"node_modules/@swc/core-win32-x64-msvc": { "node_modules/@swc/core-win32-x64-msvc": {
"version": "1.11.20", "version": "1.11.21",
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.11.20.tgz", "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.11.21.tgz",
"integrity": "sha512-rcZpt5uiVNTs/Se+CYBoaDphafFJcsqXo3DNmfkJZoDZUb4PZqxu61p4Qa+lvFDQlRragrlLRpGQM9qnLNd4iQ==", "integrity": "sha512-BT9BNNbMxdpUM1PPAkYtviaV0A8QcXttjs2MDtOeSqqvSJaPtyM+Fof2/+xSwQDmDEFzbGCcn75M5+xy3lGqpA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -417,9 +417,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001713", "version": "1.0.30001715",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001713.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz",
"integrity": "sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==", "integrity": "sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -703,9 +703,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.136", "version": "1.5.139",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.136.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.139.tgz",
"integrity": "sha512-kL4+wUTD7RSA5FHx5YwWtjDnEEkIIikFgWHR4P6fqjw1PPLlqYkxeOb++wAauAssat0YClCy8Y3C5SxgSkjibQ==", "integrity": "sha512-GGnRYOTdN5LYpwbIr0rwP/ZHOQSvAF6TG0LSzp28uCBb9JiXHJGmaaKw29qjNJc5bGnnp6kXJqRnGMQoELwi5w==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/entities": { "node_modules/entities": {

View file

@ -17,7 +17,7 @@
var AmiContext = function(title, auth, loading) { var AmiContext = function(title, auth, loading) {
var pub = {}; var pub = {};
const flashii = new Flashii; const flashii = new Flashii(`${window.FII_URL}/api`);
pub.flashii = flashii; pub.flashii = flashii;
var settings = new AmiSettings; var settings = new AmiSettings;
@ -304,7 +304,7 @@ var AmiContext = function(title, auth, loading) {
else else
overlay += '<br/>' + info.baka.until.toLocaleString(); overlay += '<br/>' + info.baka.until.toLocaleString();
} }
overlay += '<br/><br/><a href="' + futami.get('login') + '?legacy=1">' + AmiStrings.getMenuString('back') + '</a>'; overlay += `<br/><br/><a href="${window.FII_URL}/_sockchat/login?legacy=1">${AmiStrings.getMenuString('back')}</a>`;
loading.hideIndicator(); loading.hideIndicator();
loading.setTextRaw(overlay); loading.setTextRaw(overlay);
@ -315,7 +315,7 @@ var AmiContext = function(title, auth, loading) {
var overlay = AmiStrings.getMenuString(info.baka.type); var overlay = AmiStrings.getMenuString(info.baka.type);
if(info.baka.until) if(info.baka.until)
overlay += '<br/>' + info.baka.until.toLocaleString(); overlay += '<br/>' + info.baka.until.toLocaleString();
overlay += '<br/><br/><a href="' + futami.get('login') + '?legacy=1">' + AmiStrings.getMenuString('back') + '</a>'; overlay += `<br/><br/><a href="${window.FII_URL}/_sockchat/login?legacy=1">${AmiStrings.getMenuString('back')}</a>`;
if(loading === undefined) if(loading === undefined)
loading = new AmiLoadingOverlay(document.body); loading = new AmiLoadingOverlay(document.body);

View file

@ -1,8 +1,9 @@
#include commitment.js #include commitment.js
#include xhr.js #include xhr.js
const Flashii = function(baseUrl=null) { const Flashii = function(baseUrl) {
baseUrl ??= window.FII_API; if(typeof baseUrl !== 'string')
throw new Error('baseUrl must be a string');
if(baseUrl.indexOf('//') === 0) if(baseUrl.indexOf('//') === 0)
baseUrl = window.location.protocol + baseUrl; baseUrl = window.location.protocol + baseUrl;

View file

@ -17,11 +17,11 @@
.success(futami => { .success(futami => {
window.futami = futami; window.futami = futami;
var auth = new AmiMisuzuAuth(futami.get('token')); var auth = new AmiMisuzuAuth(`${window.FII_URL}/_sockchat/token`);
var refreshInfo = function(next) { var refreshInfo = function(next) {
auth.refresh().success(token => { auth.refresh().success(token => {
if(token.ok === false) { if(token.ok === false) {
location.assign(futami.get('login') + '?legacy=1'); location.assign(`${window.FII_URL}/_sockchat/login?legacy=1`);
return; return;
} }
@ -30,7 +30,7 @@
}).run(); }).run();
}; };
var ami = new AmiContext(futami.get('title'), auth, loading); var ami = new AmiContext(window.TITLE, auth, loading);
window.ami = ami; window.ami = ami;
setInterval(refreshInfo, 600000); setInterval(refreshInfo, 600000);

View file

@ -101,7 +101,7 @@ var AmiSockChat = function(auth) {
var startKeepAlive = function() { var startKeepAlive = function() {
if(pingTimer !== undefined) if(pingTimer !== undefined)
return; return;
pingTimer = setInterval(sendPing, futami.get('ping') * 1000); pingTimer = setInterval(sendPing, 30_000);
}; };
var stopKeepAlive = function() { var stopKeepAlive = function() {
if(pingTimer === undefined) if(pingTimer === undefined)

View file

@ -23,12 +23,9 @@ var User = (function () {
return this.id === '-1'; return this.id === '-1';
}; };
User.prototype.getAvatarUrl = function() { User.prototype.getAvatarUrl = function() {
if(this.isBot()) return this.isBot()
return '/images/alert.png'; ? '/images/alert.png'
return futami.get('avatar') : `${window.FII_URL}/assets/avatar/${encodeURIComponent(this.id)}?res=160&ver=9001`;
.replace('{resolution}', '160')
.replace('{user:id}', this.id)
.replace('{user:avatar_change}', '9001');
}; };
return User; return User;
})(); })();

View file

@ -3,7 +3,7 @@
var eepromInitialise = function() { var eepromInitialise = function() {
window.eepromHistory = {}; window.eepromHistory = {};
window.eepromClient = new AmiEEPROM(futami.get('eeprom2')); window.eepromClient = new AmiEEPROM(window.FII_URL);
window.eepromUploadsTable = $id('uploadHistory'); window.eepromUploadsTable = $id('uploadHistory');
$id('uploadSelector').onchange = function() { $id('uploadSelector').onchange = function() {