- js/modes.js: per-backend capability matrix (GaCy GO / FireflyGo / RobinSR) - js/firefly.js: POST /sync payload builder + extra_data normaliser - js/enka-import.js: enka.network -> FreeSR converter with merge/replace - app.js: mode-aware UI, firefly transport, Enka import, extra_data form - index.html: enable FireflyGo, add Enka import + FireflyGo controls cards - i18n: Thai/English strings for every new label, message and error - vercel.json: /api/enka/:uid rewrite; scripts/dev-server.cjs for local dev
75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
// Server-mode capability matrix.
|
|
//
|
|
// GaCy GO is the only backend that implements the full tool API
|
|
// (/api/status, /api/persistent, /api/inventory, /api/monster-settings,
|
|
// /api/battle_report, /api/tool-session ...). FireflyGo is push-only and only
|
|
// understands POST /sync, so every feature that needs a read endpoint has to
|
|
// disappear from the UI instead of failing at runtime.
|
|
|
|
export const SERVER_MODES = ['gac', 'firefly', 'robin'];
|
|
|
|
export const MODE_LABELS = {
|
|
gac: 'GaCy GO',
|
|
firefly: 'FireflyGo',
|
|
robin: 'RobinSR'
|
|
};
|
|
|
|
export const MODE_CAPABILITIES = {
|
|
gac: {
|
|
saveManager: true,
|
|
exranks: true,
|
|
inventory: true,
|
|
monsterSettings: true,
|
|
damageAnalyst: true,
|
|
sceneCard: true,
|
|
gmConsole: true,
|
|
battleSummary: true,
|
|
toolSession: true,
|
|
extraData: false,
|
|
ownedAvatarsOnly: false,
|
|
// data-in-game.json is a FireflyGo artifact, so GaCy keeps only its own
|
|
// freesr/persistent documents visible in the JSON tab.
|
|
jsonModes: ['freesr', 'persistent']
|
|
},
|
|
firefly: {
|
|
saveManager: false,
|
|
exranks: false,
|
|
inventory: false,
|
|
monsterSettings: false,
|
|
damageAnalyst: false,
|
|
sceneCard: false,
|
|
gmConsole: false,
|
|
battleSummary: false,
|
|
toolSession: false,
|
|
extraData: true,
|
|
ownedAvatarsOnly: true,
|
|
jsonModes: ['freesr']
|
|
},
|
|
robin: {
|
|
saveManager: false,
|
|
exranks: false,
|
|
inventory: false,
|
|
monsterSettings: false,
|
|
damageAnalyst: false,
|
|
sceneCard: false,
|
|
gmConsole: false,
|
|
battleSummary: false,
|
|
toolSession: false,
|
|
extraData: false,
|
|
ownedAvatarsOnly: false,
|
|
jsonModes: ['freesr']
|
|
}
|
|
};
|
|
|
|
export function normalizeMode(mode) {
|
|
return MODE_CAPABILITIES[mode] ? mode : 'gac';
|
|
}
|
|
|
|
export function modeCapabilities(mode) {
|
|
return MODE_CAPABILITIES[normalizeMode(mode)];
|
|
}
|
|
|
|
export function modeSupports(feature, mode) {
|
|
return modeCapabilities(mode)[feature] === true;
|
|
}
|