diff --git a/src/backend/database/database.ts b/src/backend/database/database.ts index d3aa6e41..9a7564b3 100644 --- a/src/backend/database/database.ts +++ b/src/backend/database/database.ts @@ -16,7 +16,7 @@ app.use( cors({ origin: "*", methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], - allowedHeaders: ["Content-Type", "Authorization"], + allowedHeaders: ["Content-Type", "Authorization", "User-Agent", "X-Electron-App"], }), ); diff --git a/src/backend/ssh/file-manager.ts b/src/backend/ssh/file-manager.ts index 200081bd..8f6296b1 100644 --- a/src/backend/ssh/file-manager.ts +++ b/src/backend/ssh/file-manager.ts @@ -12,7 +12,7 @@ app.use( cors({ origin: "*", methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], - allowedHeaders: ["Content-Type", "Authorization"], + allowedHeaders: ["Content-Type", "Authorization", "User-Agent", "X-Electron-App"], }), ); app.use(express.json({ limit: "100mb" })); diff --git a/src/backend/ssh/server-stats.ts b/src/backend/ssh/server-stats.ts index c36a3d25..e675f4cc 100644 --- a/src/backend/ssh/server-stats.ts +++ b/src/backend/ssh/server-stats.ts @@ -277,12 +277,12 @@ app.use( cors({ origin: "*", methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], - allowedHeaders: ["Content-Type", "Authorization"], + allowedHeaders: ["Content-Type", "Authorization", "User-Agent", "X-Electron-App"], }), ); app.use((req, res, next) => { res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "Content-Type, Authorization"); + res.header("Access-Control-Allow-Headers", "Content-Type, Authorization, User-Agent, X-Electron-App"); res.header( "Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS", diff --git a/src/backend/ssh/tunnel.ts b/src/backend/ssh/tunnel.ts index 07edaa76..6f2be764 100644 --- a/src/backend/ssh/tunnel.ts +++ b/src/backend/ssh/tunnel.ts @@ -21,7 +21,7 @@ app.use( cors({ origin: "*", methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], - allowedHeaders: "Origin,X-Requested-With,Content-Type,Accept,Authorization", + allowedHeaders: ["Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization", "User-Agent", "X-Electron-App"], }), ); app.use(express.json()); diff --git a/src/ui/Mobile/Homepage/HomepageAuth.tsx b/src/ui/Mobile/Homepage/HomepageAuth.tsx index 0706a902..2c01c9a8 100644 --- a/src/ui/Mobile/Homepage/HomepageAuth.tsx +++ b/src/ui/Mobile/Homepage/HomepageAuth.tsx @@ -656,7 +656,6 @@ export function HomepageAuth({ {resetStep === "verify" && ( <> - o
{t("auth.enterResetCode")}{" "}
diff --git a/src/ui/main-axios.ts b/src/ui/main-axios.ts
index 43f37333..ad09b8e7 100644
--- a/src/ui/main-axios.ts
+++ b/src/ui/main-axios.ts
@@ -173,7 +173,7 @@ function createApiInstance(
);
}
- if (isElectron) {
+ if (isElectron()) {
config.headers["X-Electron-App"] = "true";
config.headers["User-Agent"] = "Termix-Electron/1.6.0";
}
@@ -289,17 +289,22 @@ function createApiInstance(
// API INSTANCES
// ============================================================================
-const isDev =
- process.env.NODE_ENV === "development" &&
- (window.location.port === "3000" ||
- window.location.port === "5173" ||
- window.location.port === "");
+function isDev(): boolean {
+ return (
+ process.env.NODE_ENV === "development" &&
+ (window.location.port === "3000" ||
+ window.location.port === "5173" ||
+ window.location.port === "" ||
+ window.location.hostname === "localhost" ||
+ window.location.hostname === "127.0.0.1")
+ );
+}
let apiHost = import.meta.env.VITE_API_HOST || "localhost";
let apiPort = 8081;
let configuredServerUrl: string | null = null;
-if (isElectron) {
+if (isElectron()) {
apiPort = 8081;
}
@@ -309,7 +314,7 @@ export interface ServerConfig {
}
export async function getServerConfig(): Promise