mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-28 06:46:26 +00:00
Add overview, packages with quick view, package detail tabs, a merged security page, insights, system and restyled bypasses. Old vulnerable and blocked routes redirect to the matching security tab.
23 lines
687 B
TypeScript
23 lines
687 B
TypeScript
import { computed, ref } from 'vue'
|
|
|
|
const STORAGE_KEY = 'admin_api_key'
|
|
|
|
const key = ref(typeof localStorage === 'undefined' ? '' : (localStorage.getItem(STORAGE_KEY) ?? ''))
|
|
|
|
/** The admin API key the dashboard sends with admin calls; kept in localStorage. */
|
|
export function useAdminKey() {
|
|
function load() {
|
|
key.value = localStorage.getItem(STORAGE_KEY) ?? ''
|
|
}
|
|
function save(value: string) {
|
|
key.value = value
|
|
localStorage.setItem(STORAGE_KEY, value)
|
|
}
|
|
function clear() {
|
|
key.value = ''
|
|
localStorage.removeItem(STORAGE_KEY)
|
|
}
|
|
const headers = computed(() => ({ Authorization: `Bearer ${key.value}` }))
|
|
return { key, headers, load, save, clear }
|
|
}
|