Liste to warnings
All checks were successful
Just some continuos integration / ci (push) Successful in 22s

This commit is contained in:
0d0 2025-04-23 00:03:17 +02:00
parent 749192667b
commit bf1c63e2e6
3 changed files with 8 additions and 49 deletions

View file

@ -1,28 +0,0 @@
<div class="w-[150px]">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"
><linearGradient id="a3"
><stop offset="0" stop-color="#FF156D" stop-opacity="0"></stop><stop
offset="1"
stop-color="#FF156D"
></stop></linearGradient
><circle
fill="none"
stroke="url(#a3)"
stroke-width="15"
stroke-linecap="round"
stroke-dasharray="0 44 0 44 0 44 0 44 0 360"
cx="100"
cy="100"
r="70"
transform-origin="center"
><animateTransform
type="rotate"
attributeName="transform"
calcMode="discrete"
dur="2"
values="360;324;288;252;216;180;144;108;72;36"
repeatCount="indefinite"
></animateTransform></circle
></svg
>
</div>

View file

@ -1,9 +1,7 @@
<script lang="ts"> <script lang="ts">
import { PUBLIC_VERSION } from '$env/static/public'; import { PUBLIC_VERSION } from '$env/static/public';
import supportedFormats from '$lib/common/supportedFormats.json'; import supportedFormats from '$lib/common/supportedFormats.json';
import Loader from '$lib/components/Loader.svelte';
import DownloadManager from '$lib/components/ProgressBar.svelte'; import DownloadManager from '$lib/components/ProgressBar.svelte';
import { mount, unmount } from 'svelte';
let source = $state('youtube'); let source = $state('youtube');
let link = $state(''); let link = $state('');
@ -12,8 +10,6 @@
let showModal = $state(false); let showModal = $state(false);
let href = $state(''); let href = $state('');
let disabled = $state(true); let disabled = $state(true);
let logs = $state('');
let downloadManager: DownloadManager | null = null;
let progress = $state(0); let progress = $state(0);
let filename = $state(''); let filename = $state('');
@ -38,13 +34,13 @@
const contentDisposition: string | null = response?.headers?.get('content-disposition'); const contentDisposition: string | null = response?.headers?.get('content-disposition');
filename = contentDisposition?.split('filename=')[1] || 'noname'; filename = contentDisposition?.split('filename=')[1] || 'noname';
const contentLength: number = Number(response?.headers?.get('content-length')); // const contentLength: number = Number(response?.headers?.get('content-length'));
const reader = response?.body?.getReader(); const reader = response?.body?.getReader();
const chunks: Uint8Array[] = []; const chunks: Uint8Array[] = [];
let receivedLength = 0; let receivedLength = 0;
while (true) { while (true) {
const { done, value }: ReadableStreamReadResult<Uint8Array> = await reader!.read(); const { done, value } = await reader!.read();
if (done) break; if (done) break;
if (value) { if (value) {
chunks.push(value); chunks.push(value);
@ -84,8 +80,9 @@
try { try {
new URL(link); new URL(link);
disabled = false; disabled = false;
} catch (err) { } catch {
/* /*
if (err.code === 'ERR_INVALID_URL') { if (err.code === 'ERR_INVALID_URL') {
} }
@ -117,15 +114,6 @@
id="wrapper" id="wrapper"
class="relative mx-auto max-w-full rounded-2xl bg-black p-4 text-green-400 shadow-xl sm:max-w-sm md:max-w-md lg:max-w-lg" class="relative mx-auto max-w-full rounded-2xl bg-black p-4 text-green-400 shadow-xl sm:max-w-sm md:max-w-md lg:max-w-lg"
> >
<!-- Loader Overlay -->
<div
id="loader"
class="absolute inset-0 z-10 hidden items-center justify-center bg-black/80 backdrop-blur-sm"
>
<Loader />
{@html logs}
</div>
<!-- Info Button --> <!-- Info Button -->
<button <button
onclick={toggleModal} onclick={toggleModal}
@ -156,7 +144,7 @@
bind:value={source} bind:value={source}
class="w-full rounded-md border border-green-400 bg-[#000f00] px-3 py-2 text-green-300 focus:border-pink-400 focus:outline-none" class="w-full rounded-md border border-green-400 bg-[#000f00] px-3 py-2 text-green-300 focus:border-pink-400 focus:outline-none"
> >
{#each sources as source} {#each sources as source (source.label)}
<option value={source.value}>{source.label}</option> <option value={source.value}>{source.label}</option>
{/each} {/each}
</select> </select>
@ -170,7 +158,7 @@
bind:value={format} bind:value={format}
class="w-full rounded-md border border-green-400 bg-[#000f00] px-3 py-2 text-green-300 focus:border-pink-400 focus:outline-none" class="w-full rounded-md border border-green-400 bg-[#000f00] px-3 py-2 text-green-300 focus:border-pink-400 focus:outline-none"
> >
{#each formats as format} {#each formats as format (format.label)}
<option value={format.value}>{format.label}</option> <option value={format.value}>{format.label}</option>
{/each} {/each}
</select> </select>

View file

@ -1,6 +1,6 @@
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import type { RequestHandler } from './$types'; import type { RequestHandler } from './$types';
import { getYouTubeMetadata, streamYouTube, ytdl } from '$lib/server/ytdlp'; import { getYouTubeMetadata, streamYouTube } from '$lib/server/ytdlp';
import { isURLValid, logger, mimeTypeMap } from '$lib/server/helpers'; import { isURLValid, logger, mimeTypeMap } from '$lib/server/helpers';
const validateRequest = (url: URL) => { const validateRequest = (url: URL) => {
@ -8,7 +8,6 @@ const validateRequest = (url: URL) => {
const link = url.searchParams.get('link'); const link = url.searchParams.get('link');
const format = url.searchParams.get('format'); // mp3, mp4 const format = url.searchParams.get('format'); // mp3, mp4
const source = url.searchParams.get('source'); // youtube or spotify const source = url.searchParams.get('source'); // youtube or spotify
const metadata = url.searchParams.has('metadata');
// Validate input // Validate input
if (!link || !format || !source) { if (!link || !format || !source) {
@ -36,7 +35,7 @@ const validateRequest = (url: URL) => {
}; };
}; };
export const GET: RequestHandler = async ({ url }) => { export const GET: RequestHandler = async ({ url }) => {
const { format, source, link } = validateRequest(url); const { format, link } = validateRequest(url);
let filename = ''; let filename = '';
logger.debug(`Requested: ${link}`); logger.debug(`Requested: ${link}`);