temp Commit Mina

This commit is contained in:
2025-05-26 14:11:01 +02:00
parent 59fc791b85
commit 0557d42207
16 changed files with 328 additions and 280 deletions

View File

@@ -8,7 +8,7 @@
}, },
"jwt": { "jwt": {
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB", "secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
"expiresIn": 3600 "expiresIn": 36000
}, },
"auth": { "auth": {
"admin": { "password": "A-InnoHUB_2025!", "admin": true }, "admin": { "password": "A-InnoHUB_2025!", "admin": true },

4
src/error.html Normal file
View File

@@ -0,0 +1,4 @@
<h1>Du wurdest automatisch ausgeloggt</h1>
<p>Lösche deine Cookies aus dem Browser und logge dich neu ein</p>
<p>Code %sveltekit.status%</p>
<p>%sveltekit.error.message%</p>

View File

@@ -12,5 +12,5 @@ export async function handle({ event, resolve }) {
await event.cookies.delete('session'); await event.cookies.delete('session');
event.locals.user = null; event.locals.user = null;
} }
return resolve(event); return await resolve(event);
} }

View File

@@ -0,0 +1,19 @@
<script>
let classNames = '';
export { classNames as class };
</script>
<svg
class="h-6 w-6 text-gray-600 {classNames}"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
/>
</svg>

14
src/lib/icons/Cube.svelte Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class=" w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M21 7.5l-2.25-1.313M21 7.5v2.25m0-2.25l-2.25 1.313M3 7.5l2.25-1.313M3 7.5l2.25 1.313M3 7.5v2.25m9 3l2.25-1.313M12 12.75l-2.25-1.313M12 12.75V15m0 6.75l2.25-1.313M12 21.75V19.5m0 2.25l-2.25-1.313m0-16.875L12 2.25l2.25 1.313M21 14.25v2.25l-2.25 1.313m-13.5 0L3 16.5v-2.25"
/>
</svg>

After

Width:  |  Height:  |  Size: 483 B

View File

@@ -0,0 +1,7 @@
<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg"
><path
d="m14.996094 3-11.9921878 11.992188h-.0039062v4.007812h1 2 1.0078125v-.0039l11.9921875-11.9921938-.001953-.0019531.001953-.0019531-4-4-.002.00195zm-1.998047 3.4121094 2.589844 2.5898437-7.587891 7.5878909v-1.589844h-1-1v-1-.589844zm-7.998047 7.9980466v1.589844h1 1v1 .589844l-.4101562.410156h-1.5898438l-1-1v-1.589844z"
fill="#373737"
transform="translate(1 1)"
/></svg
>

After

Width:  |  Height:  |  Size: 451 B

View File

@@ -0,0 +1,35 @@
<script>
export let outline = false;
let classNames = '';
export { classNames as class };
</script>
{#if outline}
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6 {classNames}"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
/>
</svg>
{:else}
<svg
class="mx-auto h-12 w-12 text-gray-300 {classNames}"
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M1.5 6a2.25 2.25 0 012.25-2.25h16.5A2.25 2.25 0 0122.5 6v12a2.25 2.25 0 01-2.25 2.25H3.75A2.25 2.25 0 011.5 18V6zM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0021 18v-1.94l-2.69-2.689a1.5 1.5 0 00-2.12 0l-.88.879.97.97a.75.75 0 11-1.06 1.06l-5.16-5.159a1.5 1.5 0 00-2.12 0L3 16.061zm10.125-7.81a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0z"
clip-rule="evenodd"
/>
</svg>
{/if}

View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
/>
</svg>

After

Width:  |  Height:  |  Size: 460 B

View File

@@ -0,0 +1,19 @@
<script>
let classNames = '';
export { classNames as class };
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6 {classNames}"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
/>
</svg>

View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"
/>
</svg>

After

Width:  |  Height:  |  Size: 402 B

View File

@@ -1,6 +1,7 @@
<script> <script>
import Chevron from '$lib/icons/Chevron-right.svelte'; import Chevron from '$lib/icons/Chevron-right.svelte';
import Login from '$lib/icons/Login.svelte'; import Login from '$lib/icons/Login.svelte';
import Profile from '$lib/icons/Profile.svelte';
export let data; export let data;
</script> </script>
@@ -59,20 +60,9 @@
href="/" href="/"
class="px-4 py-1 -mr-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700" class="px-4 py-1 -mr-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
> >
<svg <!--icon-->
xmlns="http://www.w3.org/2000/svg" <Profile />
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"
/>
</svg>
{data.user.id} {data.user.id}
</a> </a>
</div> </div>

View File

@@ -1,10 +1,11 @@
<style>
</style>
<script> <script>
import Panel from '$lib/components/ui/Panel.svelte'; import Panel from '$lib/components/ui/Panel.svelte';
import AddProcess from '$lib/icons/Add-Process.svelte';
import FileRect from '$lib/icons/File-rect.svelte';
import ListIcon from '$lib/icons/List-icon.svelte';
export let data; export let data;
export let outline = true;
</script> </script>
<div <div
@@ -16,20 +17,7 @@
<div <div
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white" class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
> >
<svg <ListIcon class=" group-hover:text-indigo-600" />
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
/>
</svg>
</div> </div>
<a href="/list" class="mt-6 block font-semibold text-gray-900"> <a href="/list" class="mt-6 block font-semibold text-gray-900">
Liste Liste
@@ -72,20 +60,7 @@
<div <div
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white" class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
> >
<svg <AddProcess class=" group-hover:text-indigo-600" />
class="h-6 w-6 text-gray-600 group-hover:text-indigo-600"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
/>
</svg>
</div> </div>
<a href="/upload" class="mt-6 block font-semibold text-gray-900"> <a href="/upload" class="mt-6 block font-semibold text-gray-900">
Hinzufügen Hinzufügen
@@ -98,20 +73,7 @@
<div <div
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white" class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
> >
<svg <FileRect class=" group-hover:text-indigo-600" {outline} />
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
/>
</svg>
</div> </div>
<a href="/view" class="mt-6 block font-semibold text-gray-900"> <a href="/view" class="mt-6 block font-semibold text-gray-900">
Ansicht Ansicht
@@ -121,3 +83,6 @@
</div> </div>
</div> </div>
</div> </div>
<style>
</style>

View File

@@ -1,12 +1,8 @@
<style>
ul {
min-width: 24rem;
}
</style>
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { page } from '$app/stores'; import { page } from '$app/stores';
import Trash from '$lib/icons/Trash.svelte';
import Folder from '$lib/icons/Folder.svelte';
/** /**
* @type any[] * @type any[]
@@ -37,25 +33,25 @@
}); });
async function delete_item(ev: Event) { async function delete_item(ev: Event) {
let delete_item = window.confirm("Bist du sicher?"); let delete_item = window.confirm('Bist du sicher?');
if (delete_item) { if (delete_item) {
const target = ev.currentTarget as HTMLElement | null; const target = ev.currentTarget as HTMLElement | null;
if (!target) return; if (!target) return;
let filename = target.id.split('del__')[1] let filename = target.id.split('del__')[1];
// delete request // delete request
// -------------- // --------------
let url = `/api/list/${filename}` let url = `/api/list/${filename}`;
console.log(`--- ${filename} + ${url}`) console.log(`--- ${filename} + ${url}`);
try { try {
const response = await fetch(url, const response = await fetch(url, { method: 'DELETE' });
{method: 'DELETE'}
)
if (response.status == 204) { if (response.status == 204) {
setTimeout(() => {window.location.reload()}, 500) setTimeout(() => {
window.location.reload();
}, 500);
} }
} catch (error) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {
@@ -64,9 +60,7 @@
console.log(error); console.log(error);
} }
} }
} }
} }
</script> </script>
@@ -80,20 +74,8 @@
<li> <li>
<a href="/list/{item.name}" class="flex justify-between gap-x-6 py-5"> <a href="/list/{item.name}" class="flex justify-between gap-x-6 py-5">
<div class="flex gap-x-4"> <div class="flex gap-x-4">
<svg <!-- Ordner -->
xmlns="http://www.w3.org/2000/svg" <Folder />
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
/>
</svg>
<div class="min-w-0 flex-auto"> <div class="min-w-0 flex-auto">
<span class="text-sm font-semibold leading-6 text-gray-900">{item.name}</span> <span class="text-sm font-semibold leading-6 text-gray-900">{item.name}</span>
<!-- Delete button --> <!-- Delete button -->
@@ -103,8 +85,7 @@
on:click|preventDefault={delete_item} on:click|preventDefault={delete_item}
aria-label="Vorgang {item.name} löschen" aria-label="Vorgang {item.name} löschen"
> >
<svg <Trash />
height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m8 3v1 1h1v-1h4v1h1v-1-1zm-4 3v1h14v-1zm2 2v11h1 9v-1-10h-1v10h-8v-10z" fill="#373737" transform="translate(1 1)"/></svg>
</button> </button>
</div> </div>
</div> </div>
@@ -117,3 +98,9 @@
</ul> </ul>
</div> </div>
</div> </div>
<style>
ul {
min-width: 24rem;
}
</style>

View File

@@ -11,6 +11,9 @@
import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte'; import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte';
import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte'; import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte';
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte'; import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
import Cube from '$lib/icons/Cube.svelte';
import Edit from '$lib/icons/Edit.svelte';
import Trash from '$lib/icons/Trash.svelte';
/** @type {import('./$types').PageData} */ /** @type {import('./$types').PageData} */
export let data; export let data;
@@ -167,28 +170,17 @@
<ul class="divide-y divide-gray-100"> <ul class="divide-y divide-gray-100">
{#each list as item, i} {#each list as item, i}
<li> <li>
<div class=" flex gap-x-4">
<a <a
href="/view/{$page.params.vorgang}/{item.name}" href="/view/{$page.params.vorgang}/{item.name}"
class=" flex justify-between gap-x-6 py-5" class=" flex justify-between gap-x-6 py-5"
aria-label="zum 3D-modell"
> >
<div class="flex gap-x-4"> <Cube />
<svg </a>
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M21 7.5l-2.25-1.313M21 7.5v2.25m0-2.25l-2.25 1.313M3 7.5l2.25-1.313M3 7.5l2.25 1.313M3 7.5v2.25m9 3l2.25-1.313M12 12.75l-2.25-1.313M12 12.75V15m0 6.75l2.25-1.313M12 21.75V19.5m0 2.25l-2.25-1.313m0-16.875L12 2.25l2.25 1.313M21 14.25v2.25l-2.25 1.313m-13.5 0L3 16.5v-2.25"
/>
</svg>
<div class="min-w-0 flex-auto"> <div class="min-w-0 flex-auto">
{#if data.user.admin} {#if data.user.admin}
<!-- <span <span
id="label__{item.name}" id="label__{item.name}"
class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1" class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
contenteditable={!item.show_button} contenteditable={!item.show_button}
@@ -198,13 +190,12 @@
on:focusout={() => { on:focusout={() => {
defocus_element(i); defocus_element(i);
}} }}
on:keydown|stopPropagation={ on:keydown|stopPropagation={// event needed to identify ID
// event needed to identify ID
// TO-DO: check if event is needed or if index is sufficient // TO-DO: check if event is needed or if index is sufficient
async (ev) => { async (ev) => {
handle_input(ev, i); handle_input(ev, i);
}}>{item.name}</span }}>{item.name}</span
> --> >
<input <input
class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1" class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
@@ -215,10 +206,10 @@
async (ev) => { async (ev) => {
handle_input(ev, i); handle_input(ev, i);
}} }}
disabled={item.show_button}
bind:value={item.name} bind:value={item.name}
id="label__{item.name}" id="label__{item.name}"
/> />
<!-- disabled={item.show_button} -->
<!-- https://iconduck.com/icons/192863/edit-rename --> <!-- https://iconduck.com/icons/192863/edit-rename -->
{#if item.show_button} {#if item.show_button}
@@ -240,13 +231,7 @@
item.show_button = false; item.show_button = false;
}} }}
> >
<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" <Edit />
><path
d="m14.996094 3-11.9921878 11.992188h-.0039062v4.007812h1 2 1.0078125v-.0039l11.9921875-11.9921938-.001953-.0019531.001953-.0019531-4-4-.002.00195zm-1.998047 3.4121094 2.589844 2.5898437-7.587891 7.5878909v-1.589844h-1-1v-1-.589844zm-7.998047 7.9980466v1.589844h1 1v1 .589844l-.4101562.410156h-1.5898438l-1-1v-1.589844z"
fill="#373737"
transform="translate(1 1)"
/></svg
>
</button> </button>
{/if} {/if}
<button <button
@@ -288,13 +273,7 @@
}} }}
aria-label="Datei löschen" aria-label="Datei löschen"
> >
<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" <Trash />
><path
d="m8 3v1 1h1v-1h4v1h1v-1-1zm-4 3v1h14v-1zm2 2v11h1 9v-1-10h-1v10h-8v-10z"
fill="#373737"
transform="translate(1 1)"
/></svg
>
</button> </button>
{:else} {:else}
<span class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1" <span class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
@@ -314,7 +293,6 @@
> >
</p> </p>
</div> </div>
</a>
</li> </li>
{/each} {/each}
</ul> </ul>

View File

@@ -8,6 +8,7 @@
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte'; import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
import shortenFileSize from '$lib/helper/shortenFileSize.js'; import shortenFileSize from '$lib/helper/shortenFileSize.js';
import Exclamation from '$lib/icons/Exclamation.svelte'; import Exclamation from '$lib/icons/Exclamation.svelte';
import FileRect from '$lib/icons/File-rect.svelte';
export let form; export let form;
@@ -15,7 +16,9 @@
let inProgress = false; let inProgress = false;
let vorgang = ''; let vorgang = '';
const code_len = 8; const code_len = 8;
let zugangscode = Math.random().toString(36).slice(2, 2+code_len); let zugangscode = Math.random()
.toString(36)
.slice(2, 2 + code_len);
let case_existing = undefined; let case_existing = undefined;
let name = ''; let name = '';
/** @type {?string}*/ /** @type {?string}*/
@@ -32,7 +35,7 @@
let data = new FormData(); let data = new FormData();
data.append('vorgang', vorgang); data.append('vorgang', vorgang);
data.append('name', name); data.append('name', name);
data.append('zugangscode', zugangscode) data.append('zugangscode', zugangscode);
const response = await fetch('?/validate', { method: 'POST', body: data }); const response = await fetch('?/validate', { method: 'POST', body: data });
/** @type {import('@sveltejs/kit').ActionResult} */ /** @type {import('@sveltejs/kit').ActionResult} */
const result = deserialize(await response.text()); const result = deserialize(await response.text());
@@ -111,54 +114,51 @@
function swap_endian(val) { function swap_endian(val) {
// from https://www.geeksforgeeks.org/bit-manipulation-swap-endianness-of-a-number/ // from https://www.geeksforgeeks.org/bit-manipulation-swap-endianness-of-a-number/
let leftmost_byte = (val & eval(0x000000FF)) >> 0; let leftmost_byte = (val & eval(0x000000ff)) >> 0;
let left_middle_byte = (val & eval(0x0000FF00)) >> 8; let left_middle_byte = (val & eval(0x0000ff00)) >> 8;
let right_middle_byte = (val & eval(0x00FF0000)) >> 16; let right_middle_byte = (val & eval(0x00ff0000)) >> 16;
let rightmost_byte = (val & eval(0xFF000000)) >> 24; let rightmost_byte = (val & eval(0xff000000)) >> 24;
leftmost_byte <<= 24; leftmost_byte <<= 24;
left_middle_byte <<= 16; left_middle_byte <<= 16;
right_middle_byte <<= 8; right_middle_byte <<= 8;
rightmost_byte <<= 0; rightmost_byte <<= 0;
let res = (leftmost_byte | left_middle_byte | right_middle_byte | rightmost_byte) let res = leftmost_byte | left_middle_byte | right_middle_byte | rightmost_byte;
return res return res;
} }
async function check_valid_glb_file() { async function check_valid_glb_file() {
// GLD Header, magic value 0x46546C67, identifies data as binary glTF, 4 bytes // GLD Header, magic value 0x46546C67, identifies data as binary glTF, 4 bytes
// little endian! // little endian!
const GLD_MAGIC = 0x46546C67; const GLD_MAGIC = 0x46546c67;
// big endian! // big endian!
let file = files[0]; let file = files[0];
let file_header = file.slice(0, 4) let file_header = file.slice(0, 4);
let header_bytes = await file_header.bytes() let header_bytes = await file_header.bytes();
let file_header_hex = '0x' + header_bytes.toHex().toString(); let file_header_hex = '0x' + header_bytes.toHex().toString();
if (GLD_MAGIC == swap_endian(file_header_hex)) { if (GLD_MAGIC == swap_endian(file_header_hex)) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
// return true or false // return true or false
async function case_exists(case_no) { async function case_exists(case_no) {
console.log('--- fired') console.log('--- fired');
// ping `/(angemeldet)/view` with caseNumber in POST body // ping `/(angemeldet)/view` with caseNumber in POST body
let url = '/view' let url = '/view';
let data = new FormData(); let data = new FormData();
data.append('caseNumber', case_no); data.append('caseNumber', case_no);
const response = await fetch(url, { method: 'POST', body: data }) const response = await fetch(url, { method: 'POST', body: data });
const code = response.status; const code = response.status;
console.log(`+++ ${response.redirected}`) console.log(`+++ ${response.redirected}`);
if (code == 303) { if (code == 303) {
return true; return true;
@@ -166,7 +166,6 @@
return false; return false;
} }
</script> </script>
<div class="mx-auto max-w-2xl"> <div class="mx-auto max-w-2xl">
@@ -275,18 +274,7 @@
class="mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 py-10" class="mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 py-10"
> >
<div class="text-center"> <div class="text-center">
<svg <FileRect />
class="mx-auto h-12 w-12 text-gray-300"
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M1.5 6a2.25 2.25 0 012.25-2.25h16.5A2.25 2.25 0 0122.5 6v12a2.25 2.25 0 01-2.25 2.25H3.75A2.25 2.25 0 011.5 18V6zM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0021 18v-1.94l-2.69-2.689a1.5 1.5 0 00-2.12 0l-.88.879.97.97a.75.75 0 11-1.06 1.06l-5.16-5.159a1.5 1.5 0 00-2.12 0L3 16.061zm10.125-7.81a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0z"
clip-rule="evenodd"
/>
</svg>
<div class="mt-4 flex text-sm leading-6 text-gray-600"> <div class="mt-4 flex text-sm leading-6 text-gray-600">
<label <label
for="file" for="file"

14
static/1.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
class="h-6 w-6 text-gray-600 group-hover:text-indigo-600"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
/>
</svg>

After

Width:  |  Height:  |  Size: 714 B