fix AppPanelProvider install error

This commit is contained in:
xiaomlove
2025-05-09 10:28:55 +07:00
parent 42d0ad6c0b
commit 6ff9d70ebc
5 changed files with 6683 additions and 22 deletions
+2 -2
View File
@@ -80,13 +80,13 @@ class AppPanelProvider extends PanelProvider
]) ])
->navigationItems([ ->navigationItems([
NavigationItem::make('Horizon') NavigationItem::make('Horizon')
->label(nexus_trans('admin.sidebar.queue_monitor')) ->label(nexus_trans('admin.sidebar.queue_monitor', [], Auth::user() ? get_langfolder_cookie(true) : 'en'))
->icon('heroicon-o-presentation-chart-line') ->icon('heroicon-o-presentation-chart-line')
->group('System') ->group('System')
->sort(99) ->sort(99)
->url('/horizon') ->url('/horizon')
->openUrlInNewTab() ->openUrlInNewTab()
->hidden(fn() => Auth::user()->class < User::CLASS_SYSOP) ->hidden(fn() => !(Auth::user() && Auth::user()->class >= User::CLASS_SYSOP))
]) ])
; ;
} }
+1 -1
View File
@@ -3039,7 +3039,7 @@ function make_folder($pre, $folder_name)
function logoutcookie() { function logoutcookie() {
// setcookie("c_secure_uid", "", 0x7fffffff, "/", "", false, true); // setcookie("c_secure_uid", "", 0x7fffffff, "/", "", false, true);
setcookie("c_secure_pass", "", 0x7fffffff, "/", "", true, true); setcookie("c_secure_pass", "", 0x7fffffff, "/", "", isHttps(), true);
// setcookie("c_secure_ssl", "", 0x7fffffff, "/", "", false, true); // setcookie("c_secure_ssl", "", 0x7fffffff, "/", "", false, true);
// setcookie("c_secure_tracker_ssl", "", 0x7fffffff, "/", "", false, true); // setcookie("c_secure_tracker_ssl", "", 0x7fffffff, "/", "", false, true);
// setcookie("c_secure_login", "", 0x7fffffff, "/", "", false, true); // setcookie("c_secure_login", "", 0x7fffffff, "/", "", false, true);
+5 -4
View File
@@ -1509,15 +1509,15 @@ $formVar.on("click", "input[type=button]", function() {
return return
} }
if (password !== "") { if (password !== "") {
sha256(password).then((passwordHashed) => { const passwordHashed = sha256(password)
$formVar.find("input[name={$passwordHashedName}]").val(passwordHashed) $formVar.find("input[name={$passwordHashedName}]").val(passwordHashed)
$formVar.submit() $formVar.submit()
})
} else { } else {
$formVar.submit() $formVar.submit()
} }
}) })
JS; JS;
\Nexus\Nexus::js("js/crypto-js.js", 'footer', true);
\Nexus\Nexus::js($js, 'footer', false); \Nexus\Nexus::js($js, 'footer', false);
} }
@@ -1568,5 +1568,6 @@ async function login(username, password, jqForm) {
} }
JS; JS;
\Nexus\Nexus::js("vendor/jquery-loading/jquery.loading.min.js", 'footer', true); \Nexus\Nexus::js("vendor/jquery-loading/jquery.loading.min.js", 'footer', true);
\Nexus\Nexus::js("js/crypto-js.js", 'footer', true);
\Nexus\Nexus::js($js, 'footer', false); \Nexus\Nexus::js($js, 'footer', false);
} }
+18 -15
View File
@@ -406,24 +406,27 @@ function DelRow(anchor){
} }
// 工具函数:SHA-256哈希 // 工具函数:SHA-256哈希
// 因 crypto.subtle 在 http 下不可用,故引入三方库
async function sha256(message) { async function sha256(message) {
const msgBuffer = new TextEncoder().encode(message); // const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); // const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer)); // const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return CryptoJS.SHA256(message).toString(CryptoJS.enc.Hex);
} }
// 工具函数:HMAC-SHA256 // 工具函数:HMAC-SHA256
async function hmacSha256(key, message) { async function hmacSha256(key, message) {
const encoder = new TextEncoder(); // const encoder = new TextEncoder();
const keyData = encoder.encode(key); // const keyData = encoder.encode(key);
const messageData = encoder.encode(message); // const messageData = encoder.encode(message);
//
const cryptoKey = await crypto.subtle.importKey( // const cryptoKey = await crypto.subtle.importKey(
'raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'] // 'raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']
); // );
//
const signature = await crypto.subtle.sign('HMAC', cryptoKey, messageData); // const signature = await crypto.subtle.sign('HMAC', cryptoKey, messageData);
const hashArray = Array.from(new Uint8Array(signature)); // const hashArray = Array.from(new Uint8Array(signature));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return CryptoJS.HmacSHA256(message, key).toString(CryptoJS.enc.Hex);
} }
+6657
View File
File diff suppressed because it is too large Load Diff