fix: admin: alt+digit instead of ctrl (used by system)
Massimo Melina committed
Feb 4, 2024 at 12:28 UTC
b1ce0ff018e4d3e55a0fc34513f9eea2147b5361
2 files changed
+4
-4
README.md
+1
-1
@@ -188,7 +188,7 @@ Some actions you can take for improved security:
188
- Appending `?login=USER:PASSWORD` will automatically log in the browser
189
- Appending `?overwrite` on uploads, will try override the dont_overwrite_uploading configuration, provided you also have delete permission
190
- Right-click on "check for updates" will let you input a URL of a version to install
191
-- Admin: ctrl+digit will switch page
191
+- Admin: alt+digit will switch page (ctrl on Mac)
192
- Appending ?overwrite to the URL of an upload request will overwrite existing file if you have delete permission
193
- shift+click on a file will show & play
194
admin/src/App.ts
+3
-3
@@ -14,7 +14,7 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
14
import ConfigFilePage from './ConfigFilePage'
15
import { useSnapState } from './state'
16
import { useEventListener } from 'usehooks-ts'
17
-import { AriaOnly, xlate } from './misc'
17
+import { AriaOnly, isMac, xlate } from './misc'
18
import { getLocale } from './locale'
19
20
function App() {
@@ -48,8 +48,8 @@ function Routed() {
48
const large = useBreakpoint('lg')
49
const xs = current?.noPaddingOnMobile ? 0 : 1
50
const navigate = useNavigate()
51
- useEventListener('keydown', ({ key, ctrlKey }) => {
52
- if (!ctrlKey) return
51
+ useEventListener('keydown', ({ key, ctrlKey, altKey }) => {
52
+ if (!(isMac ? ctrlKey : altKey)) return // alt doesn't work on Mac, but it is the only suitable key on Windows
53
const idx = Number(xlate(key, { 0: 10 })) // key 0 is after 9 and works as 10
54
if (!idx) return
55
const path = mainMenu[idx - 1]?.path