diff --git a/.env.example b/.env.example index b7f7612..0b9efdb 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,5 @@ -NODE_ENV=development HOST=0.0.0.0 ORIGIN=https://dl.emersa.it YTDLP_PATH=./yt-dlp PUBLIC_VERSION=0.6.3 -HTTPS_PROXY= \ No newline at end of file +HTTPS_PROXY= diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 9d5a98e..9ff6b3c 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Bump deps (only minor versions) +name: Just some continuos integration on: [push] @@ -15,7 +15,16 @@ jobs: uses: actions/setup-node@v3 with: node-version: '20' - - name: Prepare, Check, Lint and Format + - name: Format things if needed run: | - npm i + npm install npm run prepare + npm run lint + npm run format + git config --global user.name "forgejo-bot" + git config --global user.email "bot@pweapon.org" + git add --all || exit 0 + git commit -m "chore: lint and format" || exit 0 + git push origin HEAD:${GITHUB_REF#refs/heads/} + env: + GITHUB_TOKEN: ${{ secrets.FORGEJO_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 2b47724..83f47b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "dl.emersa.it", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dl.emersa.it", - "version": "1.0.1", + "version": "1.0.2", "dependencies": { "@tailwindcss/forms": "^0.5.10", "@tailwindcss/postcss": "^4.1.4", "@tailwindcss/typography": "^0.5.16", - "@types/node": "^22.14.1", + "@types/node": "^22.15.2", "winston": "^3.17.0", "youtube-dl-exec": "^3.0.20" }, @@ -26,17 +26,17 @@ "eslint-config-prettier": "^10.1.2", "eslint-plugin-svelte": "^3.5.1", "globals": "^16.0.0", - "mdsvex": "^0.12.4", + "mdsvex": "^0.12.5", "prettier": "^3.5.3", "prettier-plugin-svelte": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.11", - "svelte": "^5.28.1", + "svelte": "^5.28.2", "svelte-check": "^4.1.6", "sveltekit-sse": "^0.13.19", "tailwindcss": "^4.1.4", "typescript": "^5.8.3", "typescript-eslint": "^8.31.0", - "vite": "^6.3.2" + "vite": "^6.3.3" } }, "node_modules/@alloc/quick-lru": { @@ -1639,9 +1639,9 @@ } }, "node_modules/@types/node": { - "version": "22.14.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", - "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "version": "22.15.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.2.tgz", + "integrity": "sha512-uKXqKN9beGoMdBfcaTY1ecwz6ctxuJAcUlwE55938g0ZJ8lRxwAZqRz2AJ4pzpt5dHdTPMB863UZ0ESiFUcP7A==", "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -2718,10 +2718,11 @@ } }, "node_modules/fdir": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", - "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", "dev": true, + "license": "MIT", "peerDependencies": { "picomatch": "^3 || ^4" }, @@ -3461,9 +3462,9 @@ } }, "node_modules/mdsvex": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.4.tgz", - "integrity": "sha512-m7m2VN7gKl9OAwRbUju6EDH1zzQf9tU5jFFEAEW13am2GuGstNYyYEY35J0vmCSviC5xgwsnQGYoCg+lYMxKRQ==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.5.tgz", + "integrity": "sha512-JQy8CBbGF1IvpxZTmGJigRiD1s2BKfLKS9xCLPKngjHToY8WMYLZ8WFGRpuR6x4C4bxipSuLm2LctwL2fVXaEQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4431,9 +4432,9 @@ } }, "node_modules/svelte": { - "version": "5.28.1", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.1.tgz", - "integrity": "sha512-iOa9WmfNG95lSOSJdMhdjJ4Afok7IRAQYXpbnxhd5EINnXseG0GVa9j6WPght4eX78XfFez45Fi+uRglGKPV/Q==", + "version": "5.28.2", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.2.tgz", + "integrity": "sha512-FbWBxgWOpQfhKvoGJv/TFwzqb4EhJbwCD17dB0tEpQiw1XyUEKZJtgm4nA4xq3LLsMo7hu5UY/BOFmroAxKTMg==", "dev": true, "license": "MIT", "dependencies": { @@ -4591,13 +4592,13 @@ } }, "node_modules/tinyglobby": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", - "integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", "dev": true, "license": "MIT", "dependencies": { - "fdir": "^6.4.3", + "fdir": "^6.4.4", "picomatch": "^4.0.2" }, "engines": { @@ -4804,18 +4805,18 @@ } }, "node_modules/vite": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.2.tgz", - "integrity": "sha512-ZSvGOXKGceizRQIZSz7TGJ0pS3QLlVY/9hwxVh17W3re67je1RKYzFHivZ/t0tubU78Vkyb9WnHPENSBCzbckg==", + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.3.tgz", + "integrity": "sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.25.0", - "fdir": "^6.4.3", + "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", - "tinyglobby": "^0.2.12" + "tinyglobby": "^0.2.13" }, "bin": { "vite": "bin/vite.js" diff --git a/package.json b/package.json index 7740fbf..5e3cd9e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dl.emersa.it", "private": true, - "version": "1.0.1", + "version": "1.0.2", "type": "module", "scripts": { "dev": "vite dev", @@ -25,23 +25,23 @@ "eslint-config-prettier": "^10.1.2", "eslint-plugin-svelte": "^3.5.1", "globals": "^16.0.0", - "mdsvex": "^0.12.4", + "mdsvex": "^0.12.5", "prettier": "^3.5.3", "prettier-plugin-svelte": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.11", - "svelte": "^5.28.1", + "svelte": "^5.28.2", "svelte-check": "^4.1.6", "sveltekit-sse": "^0.13.19", "tailwindcss": "^4.1.4", "typescript": "^5.8.3", "typescript-eslint": "^8.31.0", - "vite": "^6.3.2" + "vite": "^6.3.3" }, "dependencies": { "@tailwindcss/forms": "^0.5.10", "@tailwindcss/postcss": "^4.1.4", "@tailwindcss/typography": "^0.5.16", - "@types/node": "^22.14.1", + "@types/node": "^22.15.2", "winston": "^3.17.0", "youtube-dl-exec": "^3.0.20" } diff --git a/scripts/release.sh b/scripts/release.sh index 047e23e..53df3fc 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -14,4 +14,5 @@ __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" version="${1:?Error: No argument provided. Usage: $0 }" npm version "v${version}" -git push --tags \ No newline at end of file +git push --tags +git push \ No newline at end of file diff --git a/src/lib/components/Loader.svelte b/src/lib/components/Loader.svelte deleted file mode 100644 index 4ea9b50..0000000 --- a/src/lib/components/Loader.svelte +++ /dev/null @@ -1,28 +0,0 @@ -
- -
diff --git a/src/lib/components/DownloadManager.svelte b/src/lib/components/ProgressBar.svelte similarity index 98% rename from src/lib/components/DownloadManager.svelte rename to src/lib/components/ProgressBar.svelte index ffa1444..04bb07d 100644 --- a/src/lib/components/DownloadManager.svelte +++ b/src/lib/components/ProgressBar.svelte @@ -15,7 +15,7 @@
+ >

{progress}%

diff --git a/src/lib/server/ytdlp.ts b/src/lib/server/ytdlp.ts index 173c9bf..1a548ed 100644 --- a/src/lib/server/ytdlp.ts +++ b/src/lib/server/ytdlp.ts @@ -1,7 +1,6 @@ -import { create } from 'youtube-dl-exec'; +import { create, type Flags } from 'youtube-dl-exec'; import { env } from '$env/dynamic/private'; import { spawn } from 'node:child_process'; -import supportedFormats from '$lib/common/supportedFormats.json'; import { logger, mimeTypeMap } from '$lib/server/helpers'; const YTDLP_PATH: string = env.YTDLP_PATH as string; @@ -13,7 +12,7 @@ export const ytdl = create(YTDLP_PATH); * Fetch YouTube metadata (title, uploader/artist) */ export async function getYouTubeMetadata(link: string) { - const options = { + const options: Flags = { dumpSingleJson: true, noCheckCertificates: true, noWarnings: true, @@ -66,10 +65,11 @@ export function streamYouTube(link: string, format: string): ReadableStream { try { controller.enqueue(chunk); - } catch (ex) { + } catch { process.kill(); } }); + process.stderr.on('data', (chunk) => logger.debug(chunk.toString())); process.stdout.on('end', () => { try { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ac7dcae..600806b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,9 +1,7 @@