Skip to content

Commit

Permalink
6.1.46
Browse files Browse the repository at this point in the history
🐞 修正
地震報告來源
重播
🔌 最佳化
測站資料離線包(10/22)
  • Loading branch information
yayacat committed Oct 21, 2023
1 parent f24d02a commit 477633b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 40 deletions.
52 changes: 22 additions & 30 deletions TREM.Electron/js/earthquake.js
Original file line number Diff line number Diff line change
Expand Up @@ -2917,7 +2917,7 @@ function ReportGET() {
const controller = new AbortController();
setTimeout(() => {
controller.abort();
}, 2500);
}, 5_000);

if (_report_data.length != 0)
for (let i = 0; i < 50; i++) {
Expand All @@ -2934,14 +2934,7 @@ function ReportGET() {
else
bodyInfo = JSON.stringify({ list });

fetch("http://p2p-3.yayaneko.eu.org/api/v3/earthquake/reports", {
method : "post",
headers : {
Accept : "application/json",
"Content-Type" : "application/json",
},
body : bodyInfo,
signal : controller.signal })
fetch("https://exptech.com.tw/api/v1/earthquake/reports?limit=50", { signal: controller.signal })
.then((ans0) => {
if (ans0.ok) {
console.debug(ans0);
Expand Down Expand Up @@ -3079,9 +3072,9 @@ function ReportGET() {
const controller1 = new AbortController();
setTimeout(() => {
controller1.abort();
}, 2500);
}, 5_000);

if (api_key_verify && setting["report.getInfo"])
if (api_key_verify && setting["report.getInfo"]) {
fetch(`https://exptech.com.tw/api/v1/earthquake/reports?limit=50&key=${setting["api.key"]}`, { signal: controller1.signal })
.then((ans0) => {
if (ans0.ok) {
Expand Down Expand Up @@ -3210,6 +3203,23 @@ function ReportGET() {
ReportList(_report_data);
}
});
} else {
const _report_data_POST_temp = [];
let k = 0;

for (let i = 0; i < _report_data.length; i++)
if (_report_data[i].identifier.startsWith("CWB")) {
_report_data_POST_temp[k] = _report_data[i];
k += 1;
} else if (_report_data[i].identifier.startsWith("CWA")) {
_report_data_POST_temp[k] = _report_data[i];
k += 1;
}

log("Reports fetched", 1, "EQReportFetcher", "ReportGET");
dump({ level: 0, message: "Reports fetched", origin: "EQReportFetcher" });
cacheReport(_report_data_POST_temp);
}

report_get_timestamp = Date.now();
} catch (error) {
Expand Down Expand Up @@ -3556,25 +3566,7 @@ function addReport(report, prepend = false, index = 0) {
Div.addEventListener("contextmenu", () => {
if (replay != 0) return;

let list = [];

const reportD = TREM.Report.cache.get(report.identifier);
console.debug(reportD);

if (reportD.download) {
const oldtime = new Date(report.originTime.replace(/-/g, "/")).getTime();
ipcRenderer.send("testoldtime", oldtime);
} else if (report.ID.length) {
list = list.concat(report.ID);
ipcRenderer.send("testEEW", list);
} else if (report.trem.length) {
list = list.concat(report.trem);
ipcRenderer.send("testEEW", list);
} else {
TREM.Report.replayHttp = true;
const oldtime = new Date(report.originTime.replace(/-/g, "/")).getTime();
ipcRenderer.send("testoldtimeEEW", oldtime);
}
TREM.Report.replay(report.identifier);
});

if (prepend) {
Expand Down
18 changes: 9 additions & 9 deletions TREM.Electron/js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,22 +266,22 @@ TREM.Report = {
if (replay != 0) return;
changeView("main", "#mainView_btn");

let list = [];
// let list = [];

if (report.download) {
const oldtime = new Date(report.originTime.replace(/-/g, "/")).getTime();
ipcRenderer.send("testoldtime", oldtime);
}

if (report.ID.length) {
list = list.concat(report.ID);
ipcRenderer.send("testEEW", list);
}
// if (report.ID.length) {
// list = list.concat(report.ID);
// ipcRenderer.send("testEEW", list);
// }

if (report.trem.length) {
list = list.concat(report.trem);
ipcRenderer.send("testEEW", list);
}
// if (report.trem.length) {
// list = list.concat(report.trem);
// ipcRenderer.send("testEEW", list);
// }

if (!report.download || !report.ID.length || !report.trem.length) {
this.replayHttp = true;
Expand Down
Binary file modified TREM.Electron/js/server420.jar
Binary file not shown.
Loading

0 comments on commit 477633b

Please sign in to comment.