feat: update HTTP/HTTPS headers for image upload in dev and prod

This commit is contained in:
PetrichorFun 2026-02-05 10:18:45 +08:00
parent b1f70e9a3a
commit 2c503a9ab6
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "azon-seeker",
"displayName": "Azon Seeker v0.7.1.6-beta",
"displayName": "Azon Seeker v0.7.1.7-beta",
"version": "0.7.2",
"private": true,
"description": "Starter modify by honestfox101 and PetrichorFun",

View File

@ -16,6 +16,6 @@ export const isFirefox = navigator.userAgent.includes('Firefox');
// export const remoteHost = __DEV__ ? '127.0.0.1:8000' : '47.251.4.191:8000';
// export const remoteHost = __DEV__ ? '127.0.0.1:18000' : 'vm8nc3zr-18000.usw2.devtunnels.ms';
export const remoteHost = __DEV__ ? '127.0.0.1:18000' : 'amzplugin.rekeymed.com';
export const remoteHost = __DEV__ ? 'ogsm-dev.rekeymed.com:8888' : 'amzplugin.rekeymed.com';
// export const remoteHost = __DEV__ ? '127.0.0.1:18000' : 'amzplugin.rekeymed.com';
// export const remoteHost = '47.251.4.191:8000';

View File

@ -23,7 +23,8 @@ export async function uploadImage(
const formData = new FormData();
formData.append('file', blob, filename);
const url = `http://${remoteHost}/upload/image/${encodeURIComponent(filename)}`;
const httpProtocol = __DEV__ ? 'http' : 'https';
const url = `${httpProtocol}://${remoteHost}/upload/image/${encodeURIComponent(filename)}`;
const resp = (await fetch(url, {
method: 'POST',
body: formData,
@ -32,5 +33,5 @@ export async function uploadImage(
return undefined;
}
const data = await resp.json();
return `http://${remoteHost}${data.file}`;
return `${httpProtocol}://${remoteHost}${data.file}`;
}