This commit is contained in:
Rizky 2024-03-07 11:13:30 +07:00
parent 8a74cbf127
commit f025013315
3 changed files with 35 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,13 +40,8 @@ const serverMain = () => ({
delete require.cache[server_src_path]; delete require.cache[server_src_path];
const svr = require(server_src_path); const svr = require(server_src_path);
if (svr && svr.server) { if (svr && typeof svr.server === 'object') {
if (typeof svr.server === "function") { this.handler[site_id] = svr.server;
this.handler[site_id] = await svr.server(site_id);
} else {
this.handler[site_id] = svr.server;
}
this.handler[site_id].site_id = site_id; this.handler[site_id].site_id = site_id;
} }

View File

@ -52,12 +52,13 @@ export const fetchViaProxy = async (
const cur_url = new URL(location.href); const cur_url = new URL(location.href);
let final_url = ""; let final_url = "";
if (to_url.host === cur_url.host || typeof g.server_hook === 'function') { if (to_url.host === cur_url.host ||
(!!g && typeof g.server_hook === 'function')) {
final_url = to_url.toString(); final_url = to_url.toString();
} else { } else {
final_url = `${cur_url.protocol}//${cur_url.host final_url = `${cur_url.protocol}//${cur_url.host
}/_proxy/${encodeURIComponent(to_url.toString())}`; }/_proxy/${encodeURIComponent(to_url.toString())}`;
} }
if (final_url) { if (final_url) {
if (uploadProgress) { if (uploadProgress) {