diff --git a/packages/client/src/config.ts b/packages/client/src/config.ts index 4f161b8df3..18362c8810 100644 --- a/packages/client/src/config.ts +++ b/packages/client/src/config.ts @@ -1,6 +1,6 @@ import { $i } from "@/account"; // #v-ifdef VITE_CAPACITOR -const address = $i ? new URL($i.instanceUrl) : new URL("http://localhost"); +const address = $i ? new URL($i.instanceUrl) : null; // #v-else const address = new URL(location.href); // #v-endif @@ -15,11 +15,9 @@ export const url = $i?.instanceUrl; // #v-else export const url = address.origin; // #v-endif -export const apiUrl = `${url ? url : "http://localhost"}/api`; +export const apiUrl = url + "/api"; export const wsUrl = `${ - url - ? url.replace("http://", "ws://").replace("https://", "wss://") - : "ws://localhost" + url.replace("http://", "ws://").replace("https://", "wss://") }/streaming`; export const lang = localStorage.getItem("lang"); export const langs = _LANGS_; diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 2805385f8d..895fe41a41 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -16,7 +16,7 @@ export const pendingApiRequestsCount = ref(0); const apiClient = new Misskey.api.APIClient({ // #v-ifdef VITE_CAPACITOR - origin: $i?.instanceUrl || url || window.location.origin, + origin: $i?.instanceUrl || window.location.origin, // #v-else origin: url, // #v-endif