feat: enable deployment in subdirectory
This commit is contained in:
parent
902cf3038a
commit
e2af9afc32
@ -125,7 +125,9 @@
|
||||
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 @@
|
||||
echo json_encode($response);
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -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>
|
||||
<div class="contain">
|
||||
<div class="logo">
|
||||
<a href="/">
|
||||
<a href=".">
|
||||
<div class="logo-image"></div>
|
||||
</a>
|
||||
</div>
|
||||
@ -58,7 +58,7 @@
|
||||
<span id="user"><?= $username ?></span>
|
||||
</button>
|
||||
<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="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>
|
||||
|
||||
@ -16,7 +16,7 @@ if ($userCount == 0) {
|
||||
session_start();
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
$db->close();
|
||||
header("Location: /");
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||
$_SESSION['loggedin'] = true;
|
||||
$_SESSION['main_currency'] = $main_currency;
|
||||
$cookieExpire = time() + (30 * 24 * 60 * 60);
|
||||
setcookie('language', $language, $cookieExpire, '/');
|
||||
setcookie('language', $language, $cookieExpire);
|
||||
if ($rememberMe) {
|
||||
$token = bin2hex(random_bytes(32));
|
||||
$addLoginTokens = "INSERT INTO login_tokens (user_id, token) VALUES (?, ?)";
|
||||
@ -57,10 +57,10 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||
$addLoginTokensStmt->execute();
|
||||
$_SESSION['token'] = $token;
|
||||
$cookieValue = $username . "|" . $token . "|" . $main_currency;
|
||||
setcookie('wallos_login', $cookieValue, $cookieExpire, '/');
|
||||
setcookie('wallos_login', $cookieValue, $cookieExpire);
|
||||
}
|
||||
$db->close();
|
||||
header("Location: /");
|
||||
header("Location: .");
|
||||
exit();
|
||||
} else {
|
||||
$loginFailed = true;
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
$cookieExpire = time() - 3600;
|
||||
setcookie('wallos_login', '', $cookieExpire, '/');
|
||||
setcookie('wallos_login', '', $cookieExpire);
|
||||
$db->close();
|
||||
header("Location: /");
|
||||
header("Location: .");
|
||||
exit();
|
||||
?>
|
||||
@ -266,7 +266,7 @@ function setSortOption(sortOption) {
|
||||
const daysToExpire = 30;
|
||||
const expirationDate = new Date();
|
||||
expirationDate.setDate(expirationDate.getDate() + daysToExpire);
|
||||
const cookieValue = encodeURIComponent(sortOption) + '; expires=' + expirationDate.toUTCString() + '; path=/';
|
||||
const cookieValue = encodeURIComponent(sortOption) + '; expires=' + expirationDate.toUTCString();
|
||||
document.cookie = 'sortOrder=' + cookieValue;
|
||||
fetchSubscriptions();
|
||||
toggleSortOptions();
|
||||
@ -314,4 +314,4 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelector('#sort-options').addEventListener('focus', function() {
|
||||
isSortOptionsOpen = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@ function setCookie(name, value, days) {
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
document.cookie = name + "=" + value + expires;
|
||||
}
|
||||
|
||||
function storeFormFieldValue(fieldId) {
|
||||
@ -66,4 +66,4 @@ window.onload = function () {
|
||||
restoreFormFields();
|
||||
removeFromStorage();
|
||||
runDatabaseMigration();
|
||||
};
|
||||
};
|
||||
|
||||
@ -522,7 +522,7 @@ function saveNotificationsButton() {
|
||||
fromemail: fromEmail
|
||||
};
|
||||
|
||||
fetch('/endpoints/notifications/save.php', {
|
||||
fetch('endpoints/notifications/save.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@ -562,7 +562,7 @@ function testNotificationButton() {
|
||||
fromemail: fromEmail
|
||||
};
|
||||
|
||||
fetch('/endpoints/notifications/sendtestmail.php', {
|
||||
fetch('endpoints/notifications/sendtestmail.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@ -589,27 +589,27 @@ function switchTheme() {
|
||||
darkThemeCss.disabled = !darkThemeCss.disabled;
|
||||
|
||||
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() {
|
||||
const showMonthlyPriceCheckbox = document.querySelector("#monthlyprice");
|
||||
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() {
|
||||
const convertCurrencyCheckbox = document.querySelector("#convertcurrency");
|
||||
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() {
|
||||
const removeBackgroundCheckbox = document.querySelector("#removebackground");
|
||||
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() {
|
||||
window.location.href = "endpoints/subscriptions/export.php";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user