mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-17 22:13:17 +08:00
⛄ Sync 2026-11-04 03:23:17
This commit is contained in:
1 parent
ea8a5cb950
commit
688429095e
87 files changed
+3
-13511
No files matched your search
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"admin/nas": {
|
||||
"title": "NAS",
|
||||
"order": 44,
|
||||
"action": {
|
||||
"type": "firstchild",
|
||||
"recurse": true
|
||||
}
|
||||
},
|
||||
"admin/nas/tinyfilemanager": {
|
||||
"title": "Tiny File Manager",
|
||||
"order": 10,
|
||||
"action": {
|
||||
"type": "firstchild"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-tinyfilemanager" ],
|
||||
"uci": { "tinyfilemanager": true }
|
||||
}
|
||||
},
|
||||
"admin/nas/tinyfilemanager/tinyfilemanager": {
|
||||
"title": "Tiny File Manager",
|
||||
"order": 1,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "tinyfilemanager/main"
|
||||
}
|
||||
},
|
||||
"admin/nas/tinyfilemanager/config": {
|
||||
"title": "Config",
|
||||
"order": 2,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "tinyfilemanager/config"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"luci-app-tinyfilemanager": {
|
||||
"description": "Grant access to tinyfilemanager procedures",
|
||||
"read": {
|
||||
"file": {
|
||||
"/usr/libexec/tinyfilemanager-update": [ "exec" ],
|
||||
"/etc/init.d/tinyfilemanager check": [ "exec" ],
|
||||
"/etc/init.d/tinyfilemanager reload": [ "exec" ],
|
||||
"/var/tinyfilemanager/releaseslist": [ "read" ],
|
||||
"/tmp/tinyfilemanager/releaseslist": [ "read" ]
|
||||
},
|
||||
"uci": [ "tinyfilemanager" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "tinyfilemanager" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
// Validates LuCI session via ubus on every request.
|
||||
// Auto-login when accessed from LuCI menu (luci_sid passed in URL).
|
||||
// Forces logout when LuCI session expires.
|
||||
|
||||
if (!defined('FM_SESSION_ID')) define('FM_SESSION_ID', 'filemanager');
|
||||
session_name('filemanager');
|
||||
session_start();
|
||||
|
||||
function luci_validate_sid($sid) {
|
||||
if (empty($sid) || !preg_match('/^[a-f0-9]{32}$/', $sid)) return false;
|
||||
$out = shell_exec('ubus call session get \'{"ubus_rpc_session":"' . $sid . '"}\' 2>/dev/null');
|
||||
return $out && strpos($out, '"username"') !== false;
|
||||
}
|
||||
|
||||
// Step 1: luci_sid in URL → validate and auto-login
|
||||
if (!empty($_GET['luci_sid'])) {
|
||||
$sid = preg_replace('/[^a-f0-9]/', '', $_GET['luci_sid']);
|
||||
if (luci_validate_sid($sid)) {
|
||||
$_SESSION['filemanager']['logged'] = $luci_autologin_user;
|
||||
$_SESSION['filemanager']['luci_sid'] = $sid;
|
||||
session_write_close();
|
||||
header('Location: /tinyfilemanager/');
|
||||
exit;
|
||||
} else {
|
||||
unset($_SESSION['filemanager']['logged']);
|
||||
unset($_SESSION['filemanager']['luci_sid']);
|
||||
session_write_close();
|
||||
http_response_code(403);
|
||||
die('LuCI session invalid or expired.');
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: On every request, re-validate stored LuCI session
|
||||
if (!empty($_SESSION['filemanager']['logged'])) {
|
||||
$sid = $_SESSION['filemanager']['luci_sid'] ?? '';
|
||||
if (!luci_validate_sid($sid)) {
|
||||
// LuCI session expired → force logout
|
||||
unset($_SESSION['filemanager']['logged']);
|
||||
unset($_SESSION['filemanager']['luci_sid']);
|
||||
session_write_close();
|
||||
header('Location: /tinyfilemanager/');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
session_write_close();
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user