Take Flashii URL instead of Flashii API url.

This commit is contained in:
flash 2025-04-21 00:03:14 +00:00
parent 6910514f72
commit 604c137671
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
4 changed files with 8 additions and 7 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
#MAMI_TITLE="Flashii Chat"
# Flashii API base URL
# Sets the base URL for Flashii API, without the version part!
#MAMI_API_URL="//flashii.net/api"
# Flashii base URL
# Sets the base URL for Flashii
#MAMI_FII_URL="//flashii.net"
# Common configuration location
# Contains further information shared by the other chat client

View file

@ -18,7 +18,7 @@ const exec = require('util').promisify(require('child_process').exec);
html: { title },
build: {
FUTAMI_DEBUG: isDebug,
FII_API: process.env.MAMI_API_URL ?? '//flashii.net/api',
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',
GIT_HASH: (await exec('git log --pretty="%H" -n1 HEAD')).stdout,

View file

@ -13,7 +13,7 @@ const MamiContext = function(globalEventTarget, eventTarget) {
if(typeof eventTarget === 'string')
eventTarget = globalEventTarget.scopeTo(eventTarget);
const flashii = new Flashii;
const flashii = new Flashii(`${window.FII_URL}/api`);
let isUnloading = false;

View file

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