mirror of
https://github.com/BillyOutlast/stash-box.git
synced 2026-02-04 02:51:17 +01:00
Update to frontend, allow selecting the server you use in Dev (#422)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
VITE_APIKEY=<stash-box API key>
|
||||
#VITE_SERVER_PORT=9998
|
||||
#VITE_SERVER_URL=https://stash server.example
|
||||
#VITE_SERVER_PORT=443
|
||||
#PORT=3001
|
||||
|
||||
@@ -20,13 +20,19 @@ const typePolicies: TypePolicies = {
|
||||
const isDevEnvironment = () => import.meta.env.DEV;
|
||||
|
||||
export const getCredentialsSetting = () =>
|
||||
isDevEnvironment() ? "include" : "same-origin";
|
||||
isDevEnvironment() && !import.meta.env.VITE_SERVER_URL
|
||||
? "include"
|
||||
: "same-origin";
|
||||
|
||||
export const getPlatformURL = () => {
|
||||
const platformUrl = new URL(window.location.origin);
|
||||
let platformUrl = new URL(window.location.origin);
|
||||
|
||||
if (isDevEnvironment())
|
||||
if (isDevEnvironment()) {
|
||||
platformUrl = new URL(
|
||||
import.meta.env.VITE_SERVER_URL ?? window.location.origin
|
||||
);
|
||||
platformUrl.port = import.meta.env.VITE_SERVER_PORT ?? "9998";
|
||||
}
|
||||
|
||||
return platformUrl;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user