mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated environment configuration to enhance secure handling. - Integrated a shared dependency for consistent callback management. - **Refactor** - Streamlined callback actions management for improved performance. - Upgraded the operating system version from a beta release to stable (7.0.0), delivering enhanced reliability. - Centralized callback actions store usage across components for better state management. - Removed deprecated callback management code to improve clarity and maintainability. - **New Features** - Introduced a new redirect component to enhance user navigation experience. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Eli Bosley <ekbosley@gmail.com> Co-authored-by: Zack Spear <hi@zackspear.com>
43 lines
1.2 KiB
Vue
43 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
const parseRedirectTarget = (target: string | null) => {
|
|
if (target && target !== '/') {
|
|
// parse target and ensure it is a bare path with no query parameters
|
|
console.log(target);
|
|
return '/';
|
|
}
|
|
return '/';
|
|
};
|
|
|
|
const getRedirectUrl = () => {
|
|
const search = new URLSearchParams(window.location.search);
|
|
const targetRoute = parseRedirectTarget(search.get('target'));
|
|
if (search.has('data') && (search.size === 1 || search.size === 2)) {
|
|
return `${window.location.origin}${targetRoute}?data=${encodeURIComponent(search.get('data')!)}`;
|
|
}
|
|
return `${window.location.origin}${targetRoute}`;
|
|
};
|
|
|
|
onMounted(() => {
|
|
setTimeout(() => {
|
|
const textElement = document.getElementById('text');
|
|
if (textElement) {
|
|
textElement.style.display = 'block';
|
|
}
|
|
}, 750);
|
|
|
|
window.location.href = getRedirectUrl();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<div
|
|
id="text"
|
|
style="text-align: center; margin-top: calc(100vh - 75%); display: none; font-family: sans-serif"
|
|
>
|
|
<h1>Redirecting...</h1>
|
|
<h2><a :href="getRedirectUrl()">Click here if you are not redirected automatically</a></h2>
|
|
</div>
|
|
</div>
|
|
</template>
|