暫定保存

This commit is contained in:
harukin-expo-dev-env
2025-12-05 07:34:44 +00:00
parent 0a29bfceff
commit 84403ea89d
36 changed files with 3216 additions and 2611 deletions

View File

@@ -1,3 +1,5 @@
import { INTERVALS, API_ENDPOINTS } from '@/constants';
type InjectJavascriptData = (
a: string,
b: string,
@@ -43,14 +45,14 @@ export const injectJavascriptData: InjectJavascriptData = (
document.head.appendChild(script2);
let stationList = {};
fetch("https://n8n.haruk.in/webhook/jr-shikoku-station-list").then((response) => response.json()).then((data) => {
fetch("${API_ENDPOINTS.STATION_LIST}").then((response) => response.json()).then((data) => {
stationList = data;
}).then(()=>setReload());
let trainDataList = [];
const DatalistUpdate = () =>{
try{
fetch("https://jr-shikoku-backend-api-v1.haruk.in/train-data").then((response) => response.json())
fetch("${API_ENDPOINTS.TRAIN_DATA_API}").then((response) => response.json())
.then((data) => data.data)
.then((data) => {
if(!_.isEqual(data, trainDataList)) {
@@ -59,14 +61,14 @@ export const injectJavascriptData: InjectJavascriptData = (
}
});
}catch(error){}
setTimeout(DatalistUpdate, 60000);
setTimeout(DatalistUpdate, ${INTERVALS.DELAY_UPDATE});
}
DatalistUpdate();
let operationList = [];
const operationListUpdate = () =>{
try{
fetch("https://jr-shikoku-backend-api-v1.haruk.in/operation-logs").then((response) => response.json())
fetch("${API_ENDPOINTS.OPERATION_LOGS}").then((response) => response.json())
.then((data) => data.data)
.then((data) => {
if (data === null) {
@@ -78,7 +80,7 @@ export const injectJavascriptData: InjectJavascriptData = (
}
});
}catch(error){}
setTimeout(operationListUpdate, 60000);
setTimeout(operationListUpdate, ${INTERVALS.DELAY_UPDATE});
}
operationListUpdate();
@@ -86,7 +88,7 @@ export const injectJavascriptData: InjectJavascriptData = (
let trainDiagramData2 = {};
const TrainDiagramData2Update = () =>{
try{
fetch("https://jr-shikoku-api-data-storage.haruk.in/tmp/diagram-today.json")
fetch("${API_ENDPOINTS.DIAGRAM_TODAY}")
.then((response) => response.json())
.then((res) => {
const data = {};
@@ -103,7 +105,7 @@ export const injectJavascriptData: InjectJavascriptData = (
}
});
}catch(error){}
setTimeout(TrainDiagramData2Update, 60000);
setTimeout(TrainDiagramData2Update, ${INTERVALS.DELAY_UPDATE});
}
TrainDiagramData2Update();
@@ -111,14 +113,14 @@ export const injectJavascriptData: InjectJavascriptData = (
const getProblemsData = () =>{
try{
fetch("https://n8n.haruk.in/webhook/jrshikoku-position-problems").then((response) => response.json()).then((data) => {
fetch("${API_ENDPOINTS.POSITION_PROBLEMS}").then((response) => response.json()).then((data) => {
if(!_.isEqual(data, probremsData)) {
probremsData = data.data;
setReload();
}
});
}catch(error){}
setTimeout(getProblemsData, 30000);
setTimeout(getProblemsData, ${INTERVALS.FETCH_DIAGRAM});
}
getProblemsData();