mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 12:05:53 +00:00
* 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
27 lines
789 B
TypeScript
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,
|
|
})
|
|
})
|
|
})
|