From e2af9afc32bfc248f594336c50d44ad6f36f197e Mon Sep 17 00:00:00 2001 From: Jadeiin <92222981+Jadeiin@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:24:15 +0800 Subject: [PATCH] feat: enable deployment in subdirectory --- endpoints/user/save_user.php | 6 ++++-- images/icon/site.webmanifest | 2 +- includes/header.php | 4 ++-- login.php | 8 ++++---- logout.php | 4 ++-- scripts/dashboard.js | 4 ++-- scripts/registration.js | 4 ++-- scripts/settings.js | 14 +++++++------- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/endpoints/user/save_user.php b/endpoints/user/save_user.php index 07c63f1fc..94a47bfb7 100644 --- a/endpoints/user/save_user.php +++ b/endpoints/user/save_user.php @@ -125,7 +125,9 @@ function update_exchange_rate($db) { if ($result) { $cookieExpire = time() + (30 * 24 * 60 * 60); $oldLanguage = isset($_COOKIE['language']) ? $_COOKIE['language'] : "en"; - setcookie('language', $language, $cookieExpire, '/'); + $root = str_replace('/endpoints/user', '', dirname($_SERVER['PHP_SELF'])); + $root = $root == '' ? '/' : $root; + setcookie('language', $language, $cookieExpire, $root); if ($username != $oldUsername) { $_SESSION['username'] = $username; if (isset($_COOKIE['wallos_login'])) { @@ -166,4 +168,4 @@ function update_exchange_rate($db) { echo json_encode($response); exit(); } -?> \ No newline at end of file +?> diff --git a/images/icon/site.webmanifest b/images/icon/site.webmanifest index 3087a360a..0b5a830c4 100644 --- a/images/icon/site.webmanifest +++ b/images/icon/site.webmanifest @@ -1 +1 @@ -{"name":"","short_name":"","icons":[{"src":"/images/icon/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/images/icon/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file +{"name":"","short_name":"","icons":[{"src":"android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} diff --git a/includes/header.php b/includes/header.php index 4218b42a0..0a9f7e5ea 100644 --- a/includes/header.php +++ b/includes/header.php @@ -47,7 +47,7 @@
@@ -58,7 +58,7 @@