Skip to content

Commit 6ff9d70

Browse files
committed
fix AppPanelProvider install error
1 parent 42d0ad6 commit 6ff9d70

File tree

5 files changed

+6683
-22
lines changed

5 files changed

+6683
-22
lines changed

app/Providers/Filament/AppPanelProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ public function panel(Panel $panel): Panel
8080
])
8181
->navigationItems([
8282
NavigationItem::make('Horizon')
83-
->label(nexus_trans('admin.sidebar.queue_monitor'))
83+
->label(nexus_trans('admin.sidebar.queue_monitor', [], Auth::user() ? get_langfolder_cookie(true) : 'en'))
8484
->icon('heroicon-o-presentation-chart-line')
8585
->group('System')
8686
->sort(99)
8787
->url('/horizon')
8888
->openUrlInNewTab()
89-
->hidden(fn() => Auth::user()->class < User::CLASS_SYSOP)
89+
->hidden(fn() => !(Auth::user() && Auth::user()->class >= User::CLASS_SYSOP))
9090
])
9191
;
9292
}

include/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3039,7 +3039,7 @@ function make_folder($pre, $folder_name)
30393039

30403040
function logoutcookie() {
30413041
// setcookie("c_secure_uid", "", 0x7fffffff, "/", "", false, true);
3042-
setcookie("c_secure_pass", "", 0x7fffffff, "/", "", true, true);
3042+
setcookie("c_secure_pass", "", 0x7fffffff, "/", "", isHttps(), true);
30433043
// setcookie("c_secure_ssl", "", 0x7fffffff, "/", "", false, true);
30443044
// setcookie("c_secure_tracker_ssl", "", 0x7fffffff, "/", "", false, true);
30453045
// setcookie("c_secure_login", "", 0x7fffffff, "/", "", false, true);

include/globalfunctions.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,15 +1509,15 @@ function render_password_hash_js(string $formId, string $passwordOriginalClass,
15091509
return
15101510
}
15111511
if (password !== "") {
1512-
sha256(password).then((passwordHashed) => {
1513-
$formVar.find("input[name={$passwordHashedName}]").val(passwordHashed)
1514-
$formVar.submit()
1515-
})
1512+
const passwordHashed = sha256(password)
1513+
$formVar.find("input[name={$passwordHashedName}]").val(passwordHashed)
1514+
$formVar.submit()
15161515
} else {
15171516
$formVar.submit()
15181517
}
15191518
})
15201519
JS;
1520+
\Nexus\Nexus::js("js/crypto-js.js", 'footer', true);
15211521
\Nexus\Nexus::js($js, 'footer', false);
15221522
}
15231523

@@ -1568,5 +1568,6 @@ function render_password_challenge_js(string $formId, string $usernameName, stri
15681568
}
15691569
JS;
15701570
\Nexus\Nexus::js("vendor/jquery-loading/jquery.loading.min.js", 'footer', true);
1571+
\Nexus\Nexus::js("js/crypto-js.js", 'footer', true);
15711572
\Nexus\Nexus::js($js, 'footer', false);
15721573
}

public/js/common.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,24 +406,27 @@ function DelRow(anchor){
406406
}
407407

408408
// 工具函数:SHA-256哈希
409+
// 因 crypto.subtle 在 http 下不可用,故引入三方库
409410
async function sha256(message) {
410-
const msgBuffer = new TextEncoder().encode(message);
411-
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
412-
const hashArray = Array.from(new Uint8Array(hashBuffer));
413-
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
411+
// const msgBuffer = new TextEncoder().encode(message);
412+
// const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
413+
// const hashArray = Array.from(new Uint8Array(hashBuffer));
414+
// return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
415+
return CryptoJS.SHA256(message).toString(CryptoJS.enc.Hex);
414416
}
415417

416418
// 工具函数:HMAC-SHA256
417419
async function hmacSha256(key, message) {
418-
const encoder = new TextEncoder();
419-
const keyData = encoder.encode(key);
420-
const messageData = encoder.encode(message);
421-
422-
const cryptoKey = await crypto.subtle.importKey(
423-
'raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']
424-
);
425-
426-
const signature = await crypto.subtle.sign('HMAC', cryptoKey, messageData);
427-
const hashArray = Array.from(new Uint8Array(signature));
428-
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
420+
// const encoder = new TextEncoder();
421+
// const keyData = encoder.encode(key);
422+
// const messageData = encoder.encode(message);
423+
//
424+
// const cryptoKey = await crypto.subtle.importKey(
425+
// 'raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']
426+
// );
427+
//
428+
// const signature = await crypto.subtle.sign('HMAC', cryptoKey, messageData);
429+
// const hashArray = Array.from(new Uint8Array(signature));
430+
// return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
431+
return CryptoJS.HmacSHA256(message, key).toString(CryptoJS.enc.Hex);
429432
}

0 commit comments

Comments
 (0)