mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-06 12:18:48 +00:00
[BREAKING] Enhancement: require host validation (#4744)
This commit is contained in:
parent
91d5fc8e42
commit
05af70d11b
4 changed files with 47 additions and 2 deletions
|
@ -86,6 +86,7 @@ function Index({ initialSettings, fallback }) {
|
|||
const windowFocused = useWindowFocus();
|
||||
const [stale, setStale] = useState(false);
|
||||
const { data: errorsData } = useSWR("/api/validate");
|
||||
const { error: validateError } = errorsData || {};
|
||||
const { data: hashData, mutate: mutateHash } = useSWR("/api/hash");
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -117,6 +118,24 @@ function Index({ initialSettings, fallback }) {
|
|||
}
|
||||
}, [hashData]);
|
||||
|
||||
if (validateError) {
|
||||
return (
|
||||
<div className="w-full h-screen container m-auto justify-center p-10 pointer-events-none">
|
||||
<div className="flex flex-col">
|
||||
<div className="basis-1/2 bg-theme-500 dark:bg-theme-600 text-theme-600 dark:text-theme-300 m-2 rounded-md font-mono shadow-md border-4 border-transparent">
|
||||
<div className="bg-rose-200 text-rose-800 dark:text-rose-200 dark:bg-rose-800 p-2 rounded-md font-bold">
|
||||
<BiError className="float-right w-6 h-6" />
|
||||
Error
|
||||
</div>
|
||||
<div className="p-2 text-theme-100 dark:text-theme-200">
|
||||
<pre className="opacity-50 font-bold pb-2">{validateError}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (stale) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue