create discord login button & flow

This commit is contained in:
Evan
2025-02-16 12:18:50 -08:00
parent adb1b9299b
commit 969886331c
9 changed files with 175 additions and 24 deletions
+3
View File
@@ -24,6 +24,7 @@ import { UserSettings } from "../game/UserSettings";
export enum GameEnv {
Dev,
Preprod,
Prod,
}
export function getConfig(
@@ -64,6 +65,8 @@ export interface ServerConfig {
turnIntervalMs(): number;
gameCreationRate(): number;
lobbyLifetime(): number;
discordRedirectURI(): string;
env(): GameEnv;
}
export interface Config {
+3 -1
View File
@@ -19,10 +19,12 @@ import { PlayerView } from "../game/GameView";
import { UserSettings } from "../game/UserSettings";
import { GameConfig } from "../Schemas";
import { assertNever, within } from "../Util";
import { Config, ServerConfig, Theme } from "./Config";
import { Config, GameEnv, ServerConfig, Theme } from "./Config";
import { pastelTheme } from "./PastelTheme";
export abstract class DefaultServerConfig implements ServerConfig {
abstract env(): GameEnv;
abstract discordRedirectURI(): string;
turnIntervalMs(): number {
return 100;
}
+9 -1
View File
@@ -1,16 +1,24 @@
import { GameType, Player, PlayerInfo, UnitInfo, UnitType } from "../game/Game";
import { UserSettings } from "../game/UserSettings";
import { GameConfig } from "../Schemas";
import { ServerConfig } from "./Config";
import { GameEnv, ServerConfig } from "./Config";
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
export class DevServerConfig extends DefaultServerConfig {
env(): GameEnv {
return GameEnv.Dev;
}
gameCreationRate(): number {
return 10 * 1000;
}
lobbyLifetime(): number {
return 10 * 1000;
}
discordRedirectURI(): string {
return "http://localhost:3000/auth/callback";
}
}
export class DevConfig extends DefaultConfig {
+9 -1
View File
@@ -1,3 +1,11 @@
import { GameEnv } from "./Config";
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
export const preprodConfig = new (class extends DefaultServerConfig {})();
export const preprodConfig = new (class extends DefaultServerConfig {
env(): GameEnv {
return GameEnv.Preprod;
}
discordRedirectURI(): string {
return "https://openfront.dev/auth/callback";
}
})();
+9 -1
View File
@@ -1,3 +1,11 @@
import { GameEnv } from "./Config";
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
export const prodConfig = new (class extends DefaultServerConfig {})();
export const prodConfig = new (class extends DefaultServerConfig {
env(): GameEnv {
return GameEnv.Prod;
}
discordRedirectURI(): string {
return "https://openfront.io/auth/callback";
}
})();