2024-09-28 19:12:11 +10:00
|
|
|
<template>
|
2025-04-20 21:33:19 +10:00
|
|
|
<NuxtLoadingIndicator color="#2563eb" />
|
2024-09-28 19:12:11 +10:00
|
|
|
<NuxtLayout>
|
|
|
|
|
<NuxtPage />
|
|
|
|
|
</NuxtLayout>
|
2024-12-27 14:43:40 +11:00
|
|
|
<ModalStack />
|
2025-08-09 15:45:39 +10:00
|
|
|
<div
|
|
|
|
|
v-if="showExternalUrlWarning"
|
|
|
|
|
class="fixed flex flex-row gap-x-2 right-0 bottom-0 m-2 px-2 py-2 z-50 text-right bg-red-700/90 rounded-lg"
|
|
|
|
|
>
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
|
<span class="text-sm text-zinc-200 font-bold font-display">{{
|
|
|
|
|
$t("errors.externalUrl.title")
|
|
|
|
|
}}</span>
|
|
|
|
|
<span class="text-xs text-red-400">{{
|
|
|
|
|
$t("errors.externalUrl.subtitle")
|
|
|
|
|
}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<button class="text-red-200" @click="() => hideExternalURL()">
|
|
|
|
|
<XMarkIcon class="size-5" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2024-09-28 19:12:11 +10:00
|
|
|
</template>
|
2024-10-07 22:35:54 +11:00
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-08-09 15:45:39 +10:00
|
|
|
import { XMarkIcon } from "@heroicons/vue/24/outline";
|
|
|
|
|
|
2024-10-07 22:35:54 +11:00
|
|
|
await updateUser();
|
2025-08-09 15:45:39 +10:00
|
|
|
|
|
|
|
|
const user = useUser();
|
|
|
|
|
const apiDetails = await $dropFetch("/api/v1");
|
2026-01-13 15:32:39 +11:00
|
|
|
const clientMode = isClientRequest();
|
2025-08-09 15:45:39 +10:00
|
|
|
|
|
|
|
|
const showExternalUrlWarning = ref(false);
|
|
|
|
|
function checkExternalUrl() {
|
2026-01-13 15:32:39 +11:00
|
|
|
if (!import.meta.client || clientMode) return;
|
2025-08-09 15:45:39 +10:00
|
|
|
const realOrigin = window.location.origin.trim();
|
|
|
|
|
const chosenOrigin = apiDetails.external.trim();
|
|
|
|
|
const ignore = window.localStorage.getItem("ignoreExternalUrl");
|
|
|
|
|
if (ignore && ignore == "true") return;
|
|
|
|
|
showExternalUrlWarning.value = !(realOrigin == chosenOrigin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hideExternalURL() {
|
|
|
|
|
window.localStorage.setItem("ignoreExternalUrl", "true");
|
|
|
|
|
showExternalUrlWarning.value = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (user.value?.admin) {
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
checkExternalUrl();
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-10-07 22:35:54 +11:00
|
|
|
</script>
|