feat: enable deployment in subdirectory
This commit is contained in:
parent
902cf3038a
commit
e2af9afc32
@ -125,7 +125,9 @@
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
$cookieExpire = time() + (30 * 24 * 60 * 60);
|
$cookieExpire = time() + (30 * 24 * 60 * 60);
|
||||||
$oldLanguage = isset($_COOKIE['language']) ? $_COOKIE['language'] : "en";
|
$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) {
|
if ($username != $oldUsername) {
|
||||||
$_SESSION['username'] = $username;
|
$_SESSION['username'] = $username;
|
||||||
if (isset($_COOKIE['wallos_login'])) {
|
if (isset($_COOKIE['wallos_login'])) {
|
||||||
|
|||||||
@ -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"}
|
{"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"}
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<div class="contain">
|
<div class="contain">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<a href="/">
|
<a href=".">
|
||||||
<div class="logo-image"></div>
|
<div class="logo-image"></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
<span id="user"><?= $username ?></span>
|
<span id="user"><?= $username ?></span>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
<a href="/"><i class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
|
<a href="."><i class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
|
||||||
<a href="stats.php"><i class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
|
<a href="stats.php"><i class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
|
||||||
<a href="settings.php"><i class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
|
<a href="settings.php"><i class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
|
||||||
<a href="about.php"><i class="fa-solid fa-info-circle"></i><?= translate('about', $i18n) ?></a>
|
<a href="about.php"><i class="fa-solid fa-info-circle"></i><?= translate('about', $i18n) ?></a>
|
||||||
|
|||||||
@ -16,7 +16,7 @@ if ($userCount == 0) {
|
|||||||
session_start();
|
session_start();
|
||||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||||
$db->close();
|
$db->close();
|
||||||
header("Location: /");
|
header("Location: .");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
|
|||||||
$_SESSION['loggedin'] = true;
|
$_SESSION['loggedin'] = true;
|
||||||
$_SESSION['main_currency'] = $main_currency;
|
$_SESSION['main_currency'] = $main_currency;
|
||||||
$cookieExpire = time() + (30 * 24 * 60 * 60);
|
$cookieExpire = time() + (30 * 24 * 60 * 60);
|
||||||
setcookie('language', $language, $cookieExpire, '/');
|
setcookie('language', $language, $cookieExpire);
|
||||||
if ($rememberMe) {
|
if ($rememberMe) {
|
||||||
$token = bin2hex(random_bytes(32));
|
$token = bin2hex(random_bytes(32));
|
||||||
$addLoginTokens = "INSERT INTO login_tokens (user_id, token) VALUES (?, ?)";
|
$addLoginTokens = "INSERT INTO login_tokens (user_id, token) VALUES (?, ?)";
|
||||||
@ -57,10 +57,10 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
|
|||||||
$addLoginTokensStmt->execute();
|
$addLoginTokensStmt->execute();
|
||||||
$_SESSION['token'] = $token;
|
$_SESSION['token'] = $token;
|
||||||
$cookieValue = $username . "|" . $token . "|" . $main_currency;
|
$cookieValue = $username . "|" . $token . "|" . $main_currency;
|
||||||
setcookie('wallos_login', $cookieValue, $cookieExpire, '/');
|
setcookie('wallos_login', $cookieValue, $cookieExpire);
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
header("Location: /");
|
header("Location: .");
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$loginFailed = true;
|
$loginFailed = true;
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
$_SESSION = array();
|
$_SESSION = array();
|
||||||
session_destroy();
|
session_destroy();
|
||||||
$cookieExpire = time() - 3600;
|
$cookieExpire = time() - 3600;
|
||||||
setcookie('wallos_login', '', $cookieExpire, '/');
|
setcookie('wallos_login', '', $cookieExpire);
|
||||||
$db->close();
|
$db->close();
|
||||||
header("Location: /");
|
header("Location: .");
|
||||||
exit();
|
exit();
|
||||||
?>
|
?>
|
||||||
@ -266,7 +266,7 @@ function setSortOption(sortOption) {
|
|||||||
const daysToExpire = 30;
|
const daysToExpire = 30;
|
||||||
const expirationDate = new Date();
|
const expirationDate = new Date();
|
||||||
expirationDate.setDate(expirationDate.getDate() + daysToExpire);
|
expirationDate.setDate(expirationDate.getDate() + daysToExpire);
|
||||||
const cookieValue = encodeURIComponent(sortOption) + '; expires=' + expirationDate.toUTCString() + '; path=/';
|
const cookieValue = encodeURIComponent(sortOption) + '; expires=' + expirationDate.toUTCString();
|
||||||
document.cookie = 'sortOrder=' + cookieValue;
|
document.cookie = 'sortOrder=' + cookieValue;
|
||||||
fetchSubscriptions();
|
fetchSubscriptions();
|
||||||
toggleSortOptions();
|
toggleSortOptions();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ function setCookie(name, value, days) {
|
|||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||||
expires = "; expires=" + date.toUTCString();
|
expires = "; expires=" + date.toUTCString();
|
||||||
}
|
}
|
||||||
document.cookie = name + "=" + value + expires + "; path=/";
|
document.cookie = name + "=" + value + expires;
|
||||||
}
|
}
|
||||||
|
|
||||||
function storeFormFieldValue(fieldId) {
|
function storeFormFieldValue(fieldId) {
|
||||||
|
|||||||
@ -522,7 +522,7 @@ function saveNotificationsButton() {
|
|||||||
fromemail: fromEmail
|
fromemail: fromEmail
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch('/endpoints/notifications/save.php', {
|
fetch('endpoints/notifications/save.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@ -562,7 +562,7 @@ function testNotificationButton() {
|
|||||||
fromemail: fromEmail
|
fromemail: fromEmail
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch('/endpoints/notifications/sendtestmail.php', {
|
fetch('endpoints/notifications/sendtestmail.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@ -589,25 +589,25 @@ function switchTheme() {
|
|||||||
darkThemeCss.disabled = !darkThemeCss.disabled;
|
darkThemeCss.disabled = !darkThemeCss.disabled;
|
||||||
|
|
||||||
const themeChoice = darkThemeCss.disabled ? 'light' : 'dark';
|
const themeChoice = darkThemeCss.disabled ? 'light' : 'dark';
|
||||||
document.cookie = `theme=${themeChoice}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/`;
|
document.cookie = `theme=${themeChoice}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setShowMonthlyPriceCookie() {
|
function setShowMonthlyPriceCookie() {
|
||||||
const showMonthlyPriceCheckbox = document.querySelector("#monthlyprice");
|
const showMonthlyPriceCheckbox = document.querySelector("#monthlyprice");
|
||||||
const value = showMonthlyPriceCheckbox.checked;
|
const value = showMonthlyPriceCheckbox.checked;
|
||||||
document.cookie = `showMonthlyPrice=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/`;
|
document.cookie = `showMonthlyPrice=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConvertCurrencyCookie() {
|
function setConvertCurrencyCookie() {
|
||||||
const convertCurrencyCheckbox = document.querySelector("#convertcurrency");
|
const convertCurrencyCheckbox = document.querySelector("#convertcurrency");
|
||||||
const value = convertCurrencyCheckbox.checked;
|
const value = convertCurrencyCheckbox.checked;
|
||||||
document.cookie = `convertCurrency=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/`;
|
document.cookie = `convertCurrency=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setRemoveBackgroundCookie() {
|
function setRemoveBackgroundCookie() {
|
||||||
const removeBackgroundCheckbox = document.querySelector("#removebackground");
|
const removeBackgroundCheckbox = document.querySelector("#removebackground");
|
||||||
const value = removeBackgroundCheckbox.checked;
|
const value = removeBackgroundCheckbox.checked;
|
||||||
document.cookie = `removeBackground=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/`;
|
document.cookie = `removeBackground=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportToJson() {
|
function exportToJson() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user