Files
modrinth/apps/frontend/src/plugins/open-on-modrinth.client.ts
T
Prospector b68a199814 menu refactor + web account switcher (#7307)
* add account switcher, migrate context menus to overflow menu system, update version filter controls, only pad instance icons

* app account switcher, improve some context menus, theme stuff

* prepr

* handle reauthentication

* fix a couple sign in issues, admin page cleanup, fix org status badges, fix official account badge, open in local keybind, publish plus icons

* rename generic menus to ButtonMenu (& types)

* fix hydration issue w/ dropdowns + middleware error
2026-08-27 00:35:34 +00:00

27 lines
789 B
TypeScript

import { notifyCopied, useModerationKeybinds } from '~/composables/moderation.ts'
function getOfficialOrigin(apiBaseUrl: string): string {
if (apiBaseUrl.startsWith('https://staging-api.modrinth.com')) {
return 'https://staging.modrinth.com'
}
return 'https://modrinth.com'
}
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
const keybinds = useModerationKeybinds()
window.addEventListener('keydown', (event) => {
if (event.repeat) {
return
}
keybinds.value.handle(event, {
scope: 'global',
officialUrl: `${getOfficialOrigin(String(config.public.apiBaseUrl))}${window.location.pathname}${window.location.search}`,
localhostUrl: `http://localhost:3000${window.location.pathname}${window.location.search}`,
notifyCopied,
})
})
})