diff --git a/package-lock.json b/package-lock.json index 95ed4f4ac..72950dc09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12147,13 +12147,6 @@ "node": ">= 8" } }, - "node_modules/crypto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", - "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", - "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.", - "license": "ISC" - }, "node_modules/css-loader": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", diff --git a/src/client/discord-redirect.html b/src/client/discord-redirect.html deleted file mode 100644 index 8fc4c6634..000000000 --- a/src/client/discord-redirect.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - Redirecting... - - -

Please wait while we redirect you back to the application.

- - - diff --git a/src/client/jwt.ts b/src/client/jwt.ts index 0db2ab131..a84464f48 100644 --- a/src/client/jwt.ts +++ b/src/client/jwt.ts @@ -11,21 +11,13 @@ import { UserMeResponseSchema, } from "../core/ApiSchemas"; -type Platform = - | { - kind: "browser"; - getRedirectUri(): string; - setLocation(url: string): void; - getApiBaseForLocalhost(): string; - initializeAuthListener(): void; - } - | { - kind: "capacitor"; - getRedirectUri(): string; - setLocation(url: string): Promise; - getApiBaseForLocalhost(): string; - initializeAuthListener(): void; - }; +type Platform = { + kind: "capacitor" | "browser"; + getRedirectUri(): string; + setLocation(url: string): void; + getApiBaseForLocalhost(): string; + initializeAuthListener(): void; +}; const browserPlatform: Platform = { kind: "browser", @@ -48,15 +40,13 @@ const browserPlatform: Platform = { const capacitorPlatform: Platform = { kind: "capacitor", getRedirectUri(): string { - return `${process.env.APP_BASE_URL || ""}/discord-redirect.html`; + return "com.openfront.app://auth"; }, - async setLocation(url: string): Promise { - await Browser.open({ url }); + setLocation(url: string) { + return Browser.open({ url }); }, getApiBaseForLocalhost(): string { - return process.env.APP_BASE_URL - ? process.env.APP_BASE_URL!.replace("9000", "8787") - : "http://localhost:8787"; + return process.env.LOCAL_API_BASE_URL || "http://localhost:8787"; }, initializeAuthListener(): void { App.addListener("appUrlOpen", async (data) => { diff --git a/webpack.config.js b/webpack.config.js index 972a78fe8..360b9c68a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -142,21 +142,6 @@ export default async (env, argv) => { } : false, }), - new HtmlWebpackPlugin({ - template: "./src/client/discord-redirect.html", - filename: "discord-redirect.html", - chunks: [], - minify: isProduction - ? { - collapseWhitespace: true, - removeComments: true, - removeRedundantAttributes: true, - removeScriptTypeAttributes: true, - removeStyleLinkTypeAttributes: true, - useShortDoctype: true, - } - : false, - }), new webpack.DefinePlugin({ "process.env.WEBSOCKET_URL": JSON.stringify( appBaseUrl ? appBaseUrl.split("://")[1] : "", // remove protocol