pull/420/merge
Raphaël Pinto 2024-05-06 18:07:40 -04:00 committed by GitHub
commit 9df36cfaea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 11 deletions

7
.env
View File

@ -1,2 +1,5 @@
VITE_BYPASS_LOGIN=0
VITE_BYPASS_TUTORIAL=0
# Production environment
VITE_ENVIRONMENT="production"
VITE_API_BASE_URL="api"
VITE_BYPASS_LOGIN=false
VITE_BYPASS_TUTORIAL=false

View File

@ -1,2 +1,5 @@
VITE_BYPASS_LOGIN=1
VITE_BYPASS_TUTORIAL=0
# Development environment
VITE_ENVIRONMENT="local"
VITE_API_BASE_URL="http://localhost:8001"
VITE_BYPASS_LOGIN=true
VITE_BYPASS_TUTORIAL=false

View File

@ -63,7 +63,7 @@ import { STARTING_WAVE_OVERRIDE, OPP_SPECIES_OVERRIDE, SEED_OVERRIDE, STARTING_B
import {InputsController} from "./inputs-controller";
import {UiInputs} from "./ui-inputs";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
export const bypassLogin = Boolean(import.meta.env.VITE_BYPASS_LOGIN);
const DEBUG_RNG = false;
@ -94,7 +94,7 @@ export default class BattleScene extends SceneBase {
public gameSpeed: integer = 1;
public damageNumbersMode: integer = 0;
public showLevelUpStats: boolean = true;
public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1";
public enableTutorials: boolean = Boolean(import.meta.env.VITE_BYPASS_TUTORIAL);
public enableRetries: boolean = false;
public uiTheme: UiTheme = UiTheme.DEFAULT;
public windowType: integer = 0;

View File

@ -220,9 +220,8 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
}
export const sessionIdKey = 'pokerogue_sessionId';
export const isLocal = window.location.hostname === 'localhost';
export const serverUrl = isLocal ? 'http://localhost:8001' : '';
export const apiUrl = isLocal ? serverUrl : 'api';
export const isLocal = import.meta.env.VITE_ENVIRONMENT === 'local';
export const apiUrl = import.meta.env.VITE_API_BASE_URL || (!isLocal ? 'api' : '');
export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();

View File

@ -1,9 +1,10 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_BYPASS_LOGIN: string;
readonly VITE_BYPASS_TUTORIAL: string;
readonly VITE_ENVIRONMENT: string;
readonly VITE_API_BASE_URL: string;
readonly VITE_BYPASS_LOGIN: boolean;
readonly VITE_BYPASS_TUTORIAL: boolean;
}
interface ImportMeta {