feat: add experimental diagram URL support and update related components

This commit is contained in:
harukin-expo-dev-env
2026-05-19 03:06:45 +00:00
parent d76daf8791
commit 6650a8c951
5 changed files with 36 additions and 2 deletions

View File

@@ -41,6 +41,11 @@ export interface InjectJavascriptOptions {
* experimental 環境では https://jr-shikoku-backend-api-v1-beta.haruk.in を渡す。
*/
backendApiBaseUrl?: string;
/**
* ダイアグラムJSONのURL。省略時は本番URL。
* experimental 環境では diagram-today-beta.json のURLを渡す。
*/
diagramTodayUrl?: string;
}
const PRODUCTION_BACKEND_BASE = 'https://jr-shikoku-backend-api-v1.haruk.in';
@@ -55,6 +60,7 @@ export const injectJavascriptData = ({
useElesite,
isDark,
backendApiBaseUrl,
diagramTodayUrl,
mockApiConfig,
}: InjectJavascriptOptions): string => {
const elesiteStationSequences = [
@@ -1506,6 +1512,11 @@ setStationMenuDialog.observe(document.querySelector('#disp'), {
result = result.split(PRODUCTION_BACKEND_BASE).join(backendApiBaseUrl);
}
const PRODUCTION_DIAGRAM_TODAY = API_ENDPOINTS.DIAGRAM_TODAY;
if (diagramTodayUrl && diagramTodayUrl !== PRODUCTION_DIAGRAM_TODAY) {
result = result.split(PRODUCTION_DIAGRAM_TODAY).join(diagramTodayUrl);
}
// Prepend XHR interceptor as a fallback for platforms where
// injectedJavaScriptBeforeContentLoaded doesn't run reliably.
// The __jrsMockActive guard in the interceptor prevents double-patching