Add FireflyGo sync mode, extra_data controls and Enka import

- 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
This commit is contained in:
CAtlas0784 committed 2026-11-03 16:42:02 +07:00
1 parent 03fc1b82bb
commit 8eb519023a
17 files changed
+2174 -162

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
// 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;
}