Skip to content

Commit e17c4b7

Browse files
committed
Update class methods + js handler for custom path locations
1 parent 771abe1 commit e17c4b7

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

app/js/ui/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ function disableValidation(form) {
542542

543543
function updateActivityLED() {
544544
const threshold_bytes = 300;
545-
fetch('/app/net_activity')
545+
fetch('app/net_activity')
546546
.then(res => res.text())
547547
.then(data => {
548548
const activity = parseInt(data.trim());

src/RaspAP/Auth/HTTPAuth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ public function logout(): void
8282
session_regenerate_id(true); // generate a new session id
8383
session_unset(); // unset all session variables
8484
session_destroy(); // destroy the session
85+
$basePath = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
8586
$redirectUrl = $_SERVER['REQUEST_URI'];
8687
if (strpos($redirectUrl, '/login') === false) {
87-
header('Location: /login?action=' . urlencode($redirectUrl));
88+
header('Location: ' . $basePath . '/login?action=' . urlencode(basename($redirectUrl)));
8889
exit();
8990
}
9091
}

src/RaspAP/Exceptions/HtmlErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class HtmlErrorRenderer
1919
public function __construct()
2020
{
2121
$this->charset = 'UTF-8';
22-
$this->projectDir = $_SERVER['DOCUMENT_ROOT'];
22+
$this->projectDir = dirname(__DIR__, 3);
2323
$this->template = '/templates/exception.php';
2424
$this->debug = true;
2525
}

src/RaspAP/Plugins/PluginInstaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct()
3232
$this->tempSudoers = '/tmp/090_';
3333
$this->destSudoers = '/etc/sudoers.d/';
3434
$this->refModules = '/refs/heads/master/.gitmodules';
35-
$this->rootPath = $_SERVER['DOCUMENT_ROOT'];
35+
$this->rootPath = dirname(__DIR__, 3);
3636
$this->pluginsManifest = '/plugins/manifest.json';
3737
$this->repoPublic = $this->getRepository();
3838
$this->helperScriptPath = RASPI_CONFIG.'/plugins/plugin_helper.sh';

0 commit comments

Comments
 (0)