mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 15:30:43 +00:00
Remove discord redirect page, update the native redirect uri
This commit is contained in:
Generated
-7
@@ -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",
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Redirecting...</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Please wait while we redirect you back to the application.</p>
|
||||
<script>
|
||||
const appDeepLink = "com.openfront.app://auth";
|
||||
|
||||
if (window.location.hash.startsWith("#token=")) {
|
||||
const token = window.location.hash.substring("#token=".length);
|
||||
const redirectUrl = `${appDeepLink}?token=${encodeURIComponent(token)}`;
|
||||
window.location.replace(redirectUrl);
|
||||
} else {
|
||||
const error = window.location.hash.substring(1);
|
||||
const redirectUrl = `${appDeepLink}?${error}`;
|
||||
window.location.replace(redirectUrl);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+11
-21
@@ -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<void>;
|
||||
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<void> {
|
||||
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) => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user