✨ Added streaming up- and downloads, fixed file sizes and added a (not working) dashboard
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<!--
|
||||
- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
|
||||
export let files: {
|
||||
id: string;
|
||||
uploaded_at: string;
|
||||
mime_type?: string;
|
||||
hash?: string;
|
||||
size: number;
|
||||
deleted_at?: string;
|
||||
alt_text?: string;
|
||||
filename?: string;
|
||||
thumbhash?: string;
|
||||
server?: string;
|
||||
quizzes: { id: string }[];
|
||||
quiztivities: { id: string }[];
|
||||
}[];
|
||||
|
||||
const get_files = async () => {
|
||||
const res = await fetch('/api/v1/storage/list');
|
||||
files = await res.json();
|
||||
};
|
||||
if (!files) {
|
||||
get_files();
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if files}{:else}
|
||||
<Spinner />
|
||||
{/if}
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
// import FileDahboard from "$lib/files/dashboard.svelte"
|
||||
// import { thumbHashToDataURL } from 'thumbhash';
|
||||
|
||||
export let data: PageData;
|
||||
const files = data.files;
|
||||
|
||||
/* const base64ToBytes = (value: string) => {
|
||||
const base64 = value.replace(/-/g, '+').replace(/_/g, '/');
|
||||
|
||||
const decodedData =
|
||||
typeof Buffer !== 'undefined'
|
||||
? Buffer.from(base64, 'base64')
|
||||
: Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
|
||||
|
||||
return new Uint8Array(decodedData);
|
||||
};*/
|
||||
// let images_loaded = [];
|
||||
</script>
|
||||
|
||||
<div class="w-full h-full">
|
||||
<div class="grid grid-cols-2 w-full h-full gap-4">
|
||||
{#each files as file, i}
|
||||
<div class="w-full h-full flex" />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ fetch }) => {
|
||||
const res = await fetch('/api/v1/storage/list');
|
||||
if (res.ok) {
|
||||
return { files: await res.json() };
|
||||
}
|
||||
}) satisfies PageLoad;
|
||||
Reference in New Issue
Block a user