Compare commits

..

22 commits

Author SHA1 Message Date
forgejo-bot
cb5e477151 chore: update minor dependencies 2025-04-25 23:00:52 +00:00
forgejo-bot
fb562a46fa chore: update minor dependencies 2025-04-24 23:00:59 +00:00
forgejo-bot
813b51388c chore: update minor dependencies 2025-04-22 23:00:38 +00:00
0d0
19aa46445c Update release script
All checks were successful
Just some continuos integration / ci (push) Successful in 23s
2025-04-23 00:05:08 +02:00
0d0
b55ecd821a 1.0.2
All checks were successful
Just some continuos integration / ci (push) Successful in 23s
Create Release / create-release (push) Successful in 30s
2025-04-23 00:04:45 +02:00
0d0
bf1c63e2e6 Liste to warnings
All checks were successful
Just some continuos integration / ci (push) Successful in 22s
2025-04-23 00:03:17 +02:00
0d0
749192667b Update ci
Some checks failed
Just some continuos integration / ci (push) Failing after 21s
2025-04-22 23:56:16 +02:00
0d0
08a3ec3883 pre commit autoformat won't block committing for this project
Some checks failed
Just some continuos integration / ci (push) Failing after 22s
2025-04-22 23:55:20 +02:00
0d0
9f36097598 Dumb update 2025-04-22 23:54:19 +02:00
0d0
e6096f2cd2 update ci
Some checks failed
Just some continuos integration / ci (push) Failing after 31s
2025-04-22 23:48:48 +02:00
0d0
48ab1a42ed remove node env from .env
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 18s
2025-04-22 23:43:56 +02:00
0d0
51ee4299bd Remove metadata query param
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 31s
2025-04-22 21:48:53 +02:00
0d0
fad6569326 1.0.1-c
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 29s
Create Release / create-release (push) Successful in 32s
2025-04-22 21:40:01 +02:00
0d0
3c5f7dc6c2 the same as before
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 19s
2025-04-22 20:57:13 +02:00
0d0
5e0071f15d Better naming and faster progress bar 2025-04-22 20:57:01 +02:00
0d0
e6dc9292a6 1.0.1-b
All checks were successful
Create Release / create-release (push) Successful in 32s
Bump deps (only minor versions) / ci (push) Successful in 20s
2025-04-22 20:50:44 +02:00
0d0
a48cb16ab7 remove filename
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 19s
2025-04-22 20:50:25 +02:00
0d0
46c5bc6d7b 150MB default file 2025-04-22 20:49:43 +02:00
0d0
f72ea7589c 1.0.1
All checks were successful
Create Release / create-release (push) Successful in 31s
Bump deps (only minor versions) / ci (push) Successful in 19s
2025-04-22 20:37:34 +02:00
0d0
8e760a905f Update download logic
Some checks failed
Bump deps (only minor versions) / ci (push) Has been cancelled
2025-04-22 20:37:21 +02:00
forgejo-bot
0706e42e85 chore: update minor dependencies 2025-04-21 23:00:39 +00:00
forgejo-bot
64c95b5dd4 chore: update minor dependencies 2025-04-19 23:00:39 +00:00
12 changed files with 248 additions and 278 deletions

View file

@ -1,6 +1,5 @@
NODE_ENV=development
HOST=0.0.0.0 HOST=0.0.0.0
ORIGIN=https://dl.emersa.it ORIGIN=https://dl.emersa.it
YTDLP_PATH=./yt-dlp YTDLP_PATH=./yt-dlp
PUBLIC_VERSION=0.6.3 PUBLIC_VERSION=0.6.3
HTTPS_PROXY= HTTPS_PROXY=

View file

@ -1,4 +1,4 @@
name: Bump deps (only minor versions) name: Just some continuos integration
on: [push] on: [push]
@ -15,7 +15,16 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: '20' node-version: '20'
- name: Prepare, Check, Lint and Format - name: Format things if needed
run: | run: |
npm i npm install
npm run prepare 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 }}

234
package-lock.json generated
View file

@ -1,42 +1,42 @@
{ {
"name": "dl.emersa.it", "name": "dl.emersa.it",
"version": "1.0.0-c", "version": "1.0.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dl.emersa.it", "name": "dl.emersa.it",
"version": "1.0.0-c", "version": "1.0.2",
"dependencies": { "dependencies": {
"@tailwindcss/forms": "^0.5.10", "@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.1.4", "@tailwindcss/postcss": "^4.1.4",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
"@types/node": "^22.14.1", "@types/node": "^22.15.2",
"winston": "^3.17.0", "winston": "^3.17.0",
"youtube-dl-exec": "^3.0.20" "youtube-dl-exec": "^3.0.20"
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.2.8", "@eslint/compat": "^1.2.8",
"@eslint/js": "^9.25.0", "@eslint/js": "^9.25.1",
"@sveltejs/adapter-node": "^5.2.12", "@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.20.7", "@sveltejs/kit": "^2.20.7",
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/vite": "^4.1.4", "@tailwindcss/vite": "^4.1.4",
"eslint": "^9.25.0", "eslint": "^9.25.1",
"eslint-config-prettier": "^10.1.2", "eslint-config-prettier": "^10.1.2",
"eslint-plugin-svelte": "^3.5.1", "eslint-plugin-svelte": "^3.5.1",
"globals": "^16.0.0", "globals": "^16.0.0",
"mdsvex": "^0.12.3", "mdsvex": "^0.12.5",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"prettier-plugin-svelte": "^3.3.3", "prettier-plugin-svelte": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.11", "prettier-plugin-tailwindcss": "^0.6.11",
"svelte": "^5.28.1", "svelte": "^5.28.2",
"svelte-check": "^4.1.6", "svelte-check": "^4.1.6",
"sveltekit-sse": "^0.13.18", "sveltekit-sse": "^0.13.19",
"tailwindcss": "^4.1.4", "tailwindcss": "^4.1.4",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.30.1", "typescript-eslint": "^8.31.0",
"vite": "^6.3.2" "vite": "^6.3.3"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -639,9 +639,9 @@
} }
}, },
"node_modules/@eslint/js": { "node_modules/@eslint/js": {
"version": "9.25.0", "version": "9.25.1",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.25.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.25.1.tgz",
"integrity": "sha512-iWhsUS8Wgxz9AXNfvfOPFSW4VfMXdVhp1hjkZVhXCrpgh/aLcc45rX6MPu+tIVUWDw0HfNwth7O28M1xDxNf9w==", "integrity": "sha512-dEIwmjntEx8u3Uvv+kr3PDeeArL8Hw07H9kyYxCjnM9pBjfEhk6uLXSchxxzgiwtRhhzVzqmUSDFBOi1TuZ7qg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@ -1628,10 +1628,20 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/mdast": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
"integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/unist": "*"
}
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.14.1", "version": "22.15.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.2.tgz",
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", "integrity": "sha512-uKXqKN9beGoMdBfcaTY1ecwz6ctxuJAcUlwE55938g0ZJ8lRxwAZqRz2AJ4pzpt5dHdTPMB863UZ0ESiFUcP7A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~6.21.0" "undici-types": "~6.21.0"
@ -1655,17 +1665,17 @@
"dev": true "dev": true
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.0.tgz",
"integrity": "sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==", "integrity": "sha512-evaQJZ/J/S4wisevDvC1KFZkPzRetH8kYZbkgcTRyql3mcKsf+ZFDV1BVWUGTCAW5pQHoqn5gK5b8kn7ou9aFQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.10.0", "@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.30.1", "@typescript-eslint/scope-manager": "8.31.0",
"@typescript-eslint/type-utils": "8.30.1", "@typescript-eslint/type-utils": "8.31.0",
"@typescript-eslint/utils": "8.30.1", "@typescript-eslint/utils": "8.31.0",
"@typescript-eslint/visitor-keys": "8.30.1", "@typescript-eslint/visitor-keys": "8.31.0",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^5.3.1", "ignore": "^5.3.1",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
@ -1685,16 +1695,16 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.31.0.tgz",
"integrity": "sha512-H+vqmWwT5xoNrXqWs/fesmssOW70gxFlgcMlYcBaWNPIEWDgLa4W9nkSPmhuOgLnXq9QYgkZ31fhDyLhleCsAg==", "integrity": "sha512-67kYYShjBR0jNI5vsf/c3WG4u+zDnCTHTPqVMQguffaWWFs7artgwKmfwdifl+r6XyM5LYLas/dInj2T0SgJyw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.30.1", "@typescript-eslint/scope-manager": "8.31.0",
"@typescript-eslint/types": "8.30.1", "@typescript-eslint/types": "8.31.0",
"@typescript-eslint/typescript-estree": "8.30.1", "@typescript-eslint/typescript-estree": "8.31.0",
"@typescript-eslint/visitor-keys": "8.30.1", "@typescript-eslint/visitor-keys": "8.31.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@ -1710,14 +1720,14 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.31.0.tgz",
"integrity": "sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==", "integrity": "sha512-knO8UyF78Nt8O/B64i7TlGXod69ko7z6vJD9uhSlm0qkAbGeRUSudcm0+K/4CrRjrpiHfBCjMWlc08Vav1xwcw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.30.1", "@typescript-eslint/types": "8.31.0",
"@typescript-eslint/visitor-keys": "8.30.1" "@typescript-eslint/visitor-keys": "8.31.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1728,14 +1738,14 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.31.0.tgz",
"integrity": "sha512-64uBF76bfQiJyHgZISC7vcNz3adqQKIccVoKubyQcOnNcdJBvYOILV1v22Qhsw3tw3VQu5ll8ND6hycgAR5fEA==", "integrity": "sha512-DJ1N1GdjI7IS7uRlzJuEDCgDQix3ZVYVtgeWEyhyn4iaoitpMBX6Ndd488mXSx0xah/cONAkEaYyylDyAeHMHg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/typescript-estree": "8.30.1", "@typescript-eslint/typescript-estree": "8.31.0",
"@typescript-eslint/utils": "8.30.1", "@typescript-eslint/utils": "8.31.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^2.0.1" "ts-api-utils": "^2.0.1"
}, },
@ -1752,9 +1762,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.31.0.tgz",
"integrity": "sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==", "integrity": "sha512-Ch8oSjVyYyJxPQk8pMiP2FFGYatqXQfQIaMp+TpuuLlDachRWpUAeEu1u9B/v/8LToehUIWyiKcA/w5hUFRKuQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@ -1766,14 +1776,14 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.31.0.tgz",
"integrity": "sha512-kQQnxymiUy9tTb1F2uep9W6aBiYODgq5EMSk6Nxh4Z+BDUoYUSa029ISs5zTzKBFnexQEh71KqwjKnRz58lusQ==", "integrity": "sha512-xLmgn4Yl46xi6aDSZ9KkyfhhtnYI15/CvHbpOy/eR5NWhK/BK8wc709KKwhAR0m4ZKRP7h07bm4BWUYOCuRpQQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.30.1", "@typescript-eslint/types": "8.31.0",
"@typescript-eslint/visitor-keys": "8.30.1", "@typescript-eslint/visitor-keys": "8.31.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
@ -1819,16 +1829,16 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.31.0.tgz",
"integrity": "sha512-T/8q4R9En2tcEsWPQgB5BQ0XJVOtfARcUvOa8yJP3fh9M/mXraLxZrkCfGb6ChrO/V3W+Xbd04RacUEqk1CFEQ==", "integrity": "sha512-qi6uPLt9cjTFxAb1zGNgTob4x9ur7xC6mHQJ8GwEzGMGE9tYniublmJaowOJ9V2jUzxrltTPfdG2nKlWsq0+Ww==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.30.1", "@typescript-eslint/scope-manager": "8.31.0",
"@typescript-eslint/types": "8.30.1", "@typescript-eslint/types": "8.31.0",
"@typescript-eslint/typescript-estree": "8.30.1" "@typescript-eslint/typescript-estree": "8.31.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1843,13 +1853,13 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.30.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.31.0.tgz",
"integrity": "sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==", "integrity": "sha512-QcGHmlRHWOl93o64ZUMNewCdwKGU6WItOU52H0djgNmn1EOrhVudrDzXz4OycCRSCPwFCDrE2iIt5vmuUdHxuQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.30.1", "@typescript-eslint/types": "8.31.0",
"eslint-visitor-keys": "^4.2.0" "eslint-visitor-keys": "^4.2.0"
}, },
"engines": { "engines": {
@ -2378,9 +2388,9 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "9.25.0", "version": "9.25.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.25.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz",
"integrity": "sha512-MsBdObhM4cEwkzCiraDv7A6txFXEqtNXOb877TsSp2FCkBNl8JfVQrmiuDqC1IkejT6JLPzYBXx/xAiYhyzgGA==", "integrity": "sha512-E6Mtz9oGQWDCpV12319d59n4tx9zOTXSTmc8BLVxBx+G/0RdM5MvEEJLU9c0+aleoePYYgVTOsRblx433qmhWQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -2390,7 +2400,7 @@
"@eslint/config-helpers": "^0.2.1", "@eslint/config-helpers": "^0.2.1",
"@eslint/core": "^0.13.0", "@eslint/core": "^0.13.0",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "9.25.0", "@eslint/js": "9.25.1",
"@eslint/plugin-kit": "^0.2.8", "@eslint/plugin-kit": "^0.2.8",
"@humanfs/node": "^0.16.6", "@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
@ -2708,10 +2718,11 @@
} }
}, },
"node_modules/fdir": { "node_modules/fdir": {
"version": "6.4.3", "version": "6.4.4",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz",
"integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==",
"dev": true, "dev": true,
"license": "MIT",
"peerDependencies": { "peerDependencies": {
"picomatch": "^3 || ^4" "picomatch": "^3 || ^4"
}, },
@ -3451,14 +3462,17 @@
} }
}, },
"node_modules/mdsvex": { "node_modules/mdsvex": {
"version": "0.12.3", "version": "0.12.5",
"resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.3.tgz", "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.5.tgz",
"integrity": "sha512-C/uIJamjNo5PHHnR3JHqsBPoLcfUBpzRmAEB6FLMXI/s7XHOceswjDMKqSPEW2WHmYpKm0taZ3U20GSyhMridA==", "integrity": "sha512-JQy8CBbGF1IvpxZTmGJigRiD1s2BKfLKS9xCLPKngjHToY8WMYLZ8WFGRpuR6x4C4bxipSuLm2LctwL2fVXaEQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@types/mdast": "^4.0.4",
"@types/unist": "^2.0.3", "@types/unist": "^2.0.3",
"prism-svelte": "^0.4.7", "prism-svelte": "^0.4.7",
"prismjs": "^1.17.1", "prismjs": "^1.17.1",
"unist-util-visit": "^2.0.1",
"vfile-message": "^2.0.4" "vfile-message": "^2.0.4"
}, },
"peerDependencies": { "peerDependencies": {
@ -4418,9 +4432,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.28.1", "version": "5.28.2",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.1.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.2.tgz",
"integrity": "sha512-iOa9WmfNG95lSOSJdMhdjJ4Afok7IRAQYXpbnxhd5EINnXseG0GVa9j6WPght4eX78XfFez45Fi+uRglGKPV/Q==", "integrity": "sha512-FbWBxgWOpQfhKvoGJv/TFwzqb4EhJbwCD17dB0tEpQiw1XyUEKZJtgm4nA4xq3LLsMo7hu5UY/BOFmroAxKTMg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -4520,9 +4534,9 @@
} }
}, },
"node_modules/sveltekit-sse": { "node_modules/sveltekit-sse": {
"version": "0.13.18", "version": "0.13.19",
"resolved": "https://registry.npmjs.org/sveltekit-sse/-/sveltekit-sse-0.13.18.tgz", "resolved": "https://registry.npmjs.org/sveltekit-sse/-/sveltekit-sse-0.13.19.tgz",
"integrity": "sha512-DEK2pcnHZsQTezM6Eq4qBUewkp3v1SBpBXX4eNiFZs4cwfGw++lEVAoPoR4I1CmLjfz+RznblvvX/Q0qomj1VA==", "integrity": "sha512-0uOiMqRdpjoM2dM/2fyLPUfGdhhOeW9KX4LR03b4K/cYFoZt4RYyOQJrX5RPijPf9sGX2mXkc0GEA2d0l3zifg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
@ -4578,13 +4592,13 @@
} }
}, },
"node_modules/tinyglobby": { "node_modules/tinyglobby": {
"version": "0.2.12", "version": "0.2.13",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz",
"integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fdir": "^6.4.3", "fdir": "^6.4.4",
"picomatch": "^4.0.2" "picomatch": "^4.0.2"
}, },
"engines": { "engines": {
@ -4678,15 +4692,15 @@
} }
}, },
"node_modules/typescript-eslint": { "node_modules/typescript-eslint": {
"version": "8.30.1", "version": "8.31.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.30.1.tgz", "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.31.0.tgz",
"integrity": "sha512-D7lC0kcehVH7Mb26MRQi64LMyRJsj3dToJxM1+JVTl53DQSV5/7oUGWQLcKl1C1KnoVHxMMU2FNQMffr7F3Row==", "integrity": "sha512-u+93F0sB0An8WEAPtwxVhFby573E8ckdjwUUQUj9QA4v8JAvgtoDdIyYR3XFwFHq2W1KJ1AurwJCO+w+Y1ixyQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/eslint-plugin": "8.30.1", "@typescript-eslint/eslint-plugin": "8.31.0",
"@typescript-eslint/parser": "8.30.1", "@typescript-eslint/parser": "8.31.0",
"@typescript-eslint/utils": "8.30.1" "@typescript-eslint/utils": "8.31.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -4706,6 +4720,17 @@
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/unist-util-is": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz",
"integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==",
"dev": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-stringify-position": { "node_modules/unist-util-stringify-position": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz",
@ -4719,6 +4744,37 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/unist-util-visit": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0",
"unist-util-visit-parents": "^3.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-visit-parents": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz",
"integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/uri-js": { "node_modules/uri-js": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -4749,18 +4805,18 @@
} }
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "6.3.2", "version": "6.3.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.2.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.3.tgz",
"integrity": "sha512-ZSvGOXKGceizRQIZSz7TGJ0pS3QLlVY/9hwxVh17W3re67je1RKYzFHivZ/t0tubU78Vkyb9WnHPENSBCzbckg==", "integrity": "sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"esbuild": "^0.25.0", "esbuild": "^0.25.0",
"fdir": "^6.4.3", "fdir": "^6.4.4",
"picomatch": "^4.0.2", "picomatch": "^4.0.2",
"postcss": "^8.5.3", "postcss": "^8.5.3",
"rollup": "^4.34.9", "rollup": "^4.34.9",
"tinyglobby": "^0.2.12" "tinyglobby": "^0.2.13"
}, },
"bin": { "bin": {
"vite": "bin/vite.js" "vite": "bin/vite.js"

View file

@ -1,7 +1,7 @@
{ {
"name": "dl.emersa.it", "name": "dl.emersa.it",
"private": true, "private": true,
"version": "1.0.0-c", "version": "1.0.2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
@ -16,32 +16,32 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.2.8", "@eslint/compat": "^1.2.8",
"@eslint/js": "^9.25.0", "@eslint/js": "^9.25.1",
"@sveltejs/adapter-node": "^5.2.12", "@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.20.7", "@sveltejs/kit": "^2.20.7",
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/vite": "^4.1.4", "@tailwindcss/vite": "^4.1.4",
"eslint": "^9.25.0", "eslint": "^9.25.1",
"eslint-config-prettier": "^10.1.2", "eslint-config-prettier": "^10.1.2",
"eslint-plugin-svelte": "^3.5.1", "eslint-plugin-svelte": "^3.5.1",
"globals": "^16.0.0", "globals": "^16.0.0",
"mdsvex": "^0.12.3", "mdsvex": "^0.12.5",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"prettier-plugin-svelte": "^3.3.3", "prettier-plugin-svelte": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.11", "prettier-plugin-tailwindcss": "^0.6.11",
"svelte": "^5.28.1", "svelte": "^5.28.2",
"svelte-check": "^4.1.6", "svelte-check": "^4.1.6",
"sveltekit-sse": "^0.13.18", "sveltekit-sse": "^0.13.19",
"tailwindcss": "^4.1.4", "tailwindcss": "^4.1.4",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.30.1", "typescript-eslint": "^8.31.0",
"vite": "^6.3.2" "vite": "^6.3.3"
}, },
"dependencies": { "dependencies": {
"@tailwindcss/forms": "^0.5.10", "@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.1.4", "@tailwindcss/postcss": "^4.1.4",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
"@types/node": "^22.14.1", "@types/node": "^22.15.2",
"winston": "^3.17.0", "winston": "^3.17.0",
"youtube-dl-exec": "^3.0.20" "youtube-dl-exec": "^3.0.20"
} }

View file

@ -14,4 +14,5 @@ __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
version="${1:?Error: No argument provided. Usage: $0 <version>}" version="${1:?Error: No argument provided. Usage: $0 <version>}"
npm version "v${version}" npm version "v${version}"
git push --tags git push --tags
git push

View file

@ -1,21 +0,0 @@
const createAnchorElement = (url: string, filename: string): HTMLAnchorElement => {
const anchor = document.createElement('a');
anchor.href = url;
anchor.download = filename;
return anchor;
};
export const download = async (url: string, filename: string) => {
const response = await fetch(url);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const blob = await response.blob();
const objectURL = window.URL.createObjectURL(blob);
const anchor = createAnchorElement(url, filename);
document.body.appendChild(anchor);
anchor.click();
anchor.remove();
window.URL.revokeObjectURL(objectURL);
};

View file

@ -1,73 +0,0 @@
<script lang="ts">
import { onMount } from 'svelte';
let { url, dismiss } = $props();
let visible = $state(false);
let progress = $state(0);
let filename = $state('');
onMount(async () => {
if (!url) return;
try {
visible = true;
const response = await fetch(url);
if (!response.ok) throw new Error('Download failed');
const contentDisposition: string = response?.headers?.get('content-disposition');
filename = contentDisposition.split('filename=')[1];
const contentLength: number = Number(response?.headers?.get('content-length'));
const reader = response?.body?.getReader();
const chunks: Uint8Array[] = [];
let receivedLength = 0;
while (true) {
const { done, value }: ReadableStreamReadResult<Uint8Array> = await reader.read();
if (done) break;
if (value) {
chunks.push(value);
receivedLength += value.length;
progress = Math.round((receivedLength / contentLength) * 100);
}
}
const blob = new Blob(chunks);
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = filename;
a.click();
URL.revokeObjectURL(downloadUrl);
setTimeout(() => {
visible = false;
}, 1500); // auto-dismiss
} catch (err) {
console.error(err);
visible = false;
}
});
</script>
{#if visible}
<div
class="fixed inset-0 z-50 flex items-center justify-center bg-black/80 font-mono backdrop-blur-sm"
>
<div
class="w-[90%] max-w-sm rounded-2xl border border-green-400 bg-[#000f00] p-6 text-sm text-green-300 shadow-2xl"
>
<p class="mb-2 text-center text-cyan-300">
Downloading <span class="font-semibold text-green-400">{filename}</span>
</p>
<div class="h-4 w-full overflow-hidden rounded-md border border-green-500 bg-black">
<div
class="h-full bg-gradient-to-r from-green-400 to-green-600 transition-all duration-300"
style="width: {progress}%"
/>
</div>
<p class="mt-2 text-center text-pink-400">{progress}%</p>
</div>
</div>
{/if}

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

@ -0,0 +1,22 @@
<script lang="ts">
let { progress, filename } = $props();
</script>
<div
class="fixed inset-0 z-50 flex items-center justify-center bg-black/80 font-mono backdrop-blur-sm"
>
<div
class="w-[90%] max-w-sm rounded-2xl border border-green-400 bg-[#000f00] p-6 text-sm text-green-300 shadow-2xl"
>
<p class="mb-2 text-center text-cyan-300">
Downloading <span class="font-semibold text-green-400">{filename}</span>
</p>
<div class="h-4 w-full overflow-hidden rounded-md border border-green-500 bg-black">
<div
class="h-full bg-gradient-to-r from-green-400 to-green-600 transition-all duration-300"
style="width: {progress}%"
></div>
</div>
<p class="mt-2 text-center text-pink-400">{progress}%</p>
</div>
</div>

View file

@ -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 { env } from '$env/dynamic/private';
import { spawn } from 'node:child_process'; import { spawn } from 'node:child_process';
import supportedFormats from '$lib/common/supportedFormats.json';
import { logger, mimeTypeMap } from '$lib/server/helpers'; import { logger, mimeTypeMap } from '$lib/server/helpers';
const YTDLP_PATH: string = env.YTDLP_PATH as string; 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) * Fetch YouTube metadata (title, uploader/artist)
*/ */
export async function getYouTubeMetadata(link: string) { export async function getYouTubeMetadata(link: string) {
const options = { const options: Flags = {
dumpSingleJson: true, dumpSingleJson: true,
noCheckCertificates: true, noCheckCertificates: true,
noWarnings: true, noWarnings: true,
@ -66,10 +65,11 @@ export function streamYouTube(link: string, format: string): ReadableStream<Uint
process.stdout.on('data', (chunk) => { process.stdout.on('data', (chunk) => {
try { try {
controller.enqueue(chunk); controller.enqueue(chunk);
} catch (ex) { } catch {
process.kill(); process.kill();
} }
}); });
process.stderr.on('data', (chunk) => logger.debug(chunk.toString())); process.stderr.on('data', (chunk) => logger.debug(chunk.toString()));
process.stdout.on('end', () => { process.stdout.on('end', () => {
try { try {

View file

@ -1,20 +1,17 @@
<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 { download } from '$lib/client/downloader';
import DownloadManager from '$lib/components/DownloadManager.svelte';
import { mount, unmount } from 'svelte';
let source = $state('youtube'); let source = $state('youtube');
let link = $state(''); let link = $state('');
let downloading = $state(false);
let format = $state('mp3'); let format = $state('mp3');
let showModal = $state(false); let showModal = $state(false);
let href = $state(''); let href = $state('');
let disabled = $state(true); let disabled = $state(true);
let metadata = $state(false); let progress = $state(0);
let logs = $state(''); let filename = $state('');
let downloadManager: DownloadManager | null = null;
const formats = Object.keys(supportedFormats).map((f) => { const formats = Object.keys(supportedFormats).map((f) => {
return { value: f, label: f.toUpperCase() }; return { value: f, label: f.toUpperCase() };
@ -28,17 +25,50 @@
showModal = !showModal; showModal = !showModal;
}; };
const dismiss = () => { const download = async (url: string) => {
unmount(downloadManager); const response = await fetch(url);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const contentDisposition: string | null = response?.headers?.get('content-disposition');
filename = contentDisposition?.split('filename=')[1] || 'noname';
// const contentLength: number = Number(response?.headers?.get('content-length'));
const reader = response?.body?.getReader();
const chunks: Uint8Array[] = [];
let receivedLength = 0;
while (true) {
const { done, value } = await reader!.read();
if (done) break;
if (value) {
chunks.push(value);
receivedLength += value.length;
progress = Math.round((receivedLength / 50000) * 100);
}
}
const blob = new Blob(chunks);
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = filename;
a.click();
window.URL.revokeObjectURL(downloadUrl);
}; };
const onClick = async (evt) => { const onClick = async (evt) => {
evt.preventDefault(); evt.preventDefault();
const props = $state({ url: href }); downloading = true;
downloadManager = mount(DownloadManager, { target: document.body, props, events: { dismiss } }); await download(href);
downloading = false;
link = ''; link = '';
progress = 0;
filename = '';
}; };
const createAnchor = () => { const createAnchor = () => {
@ -50,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') {
} }
@ -65,8 +96,6 @@
searchParams.append('link', link); searchParams.append('link', link);
searchParams.append('format', format); searchParams.append('format', format);
if (metadata) searchParams.append('metadata', '1');
href = `/download?${searchParams.toString()}`; href = `/download?${searchParams.toString()}`;
}; };
@ -85,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}
@ -124,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>
@ -138,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>
@ -159,20 +179,6 @@
/> />
</div> </div>
<!-- Metadata Checkbox -->
<div class="flex items-center gap-2">
<input
type="checkbox"
id="metadata"
name="metadata"
bind:checked={metadata}
class="h-4 w-4 border border-green-400 bg-[#000f00] text-green-500 focus:ring-pink-400"
/>
<label for="metadata" class="text-cyan-300"
>Set filename (<span class="text-red-500">slow</span>)</label
>
</div>
<!-- Download Button --> <!-- Download Button -->
<a <a
id="btn-download" id="btn-download"
@ -187,6 +193,10 @@
</form> </form>
</div> </div>
{#if downloading}
<DownloadManager {filename} {progress}></DownloadManager>
{/if}
<!-- Modal --> <!-- Modal -->
{#if showModal} {#if showModal}
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/90 text-green-300"> <div class="fixed inset-0 z-50 flex items-center justify-center bg-black/90 text-green-300">

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) {
@ -32,14 +31,12 @@ const validateRequest = (url: URL) => {
return { return {
link, link,
format, format,
source, source
metadata
}; };
}; };
export const GET: RequestHandler = async ({ url }) => { export const GET: RequestHandler = async ({ url }) => {
const { format, source, metadata, link } = validateRequest(url); const { format, link } = validateRequest(url);
let filename = ''; let filename = '';
let contentLength = 0;
logger.debug(`Requested: ${link}`); logger.debug(`Requested: ${link}`);
@ -47,8 +44,7 @@ export const GET: RequestHandler = async ({ url }) => {
logger.debug(`Fetching video data to set filename`); logger.debug(`Fetching video data to set filename`);
// Fetch metadata for filename // Fetch metadata for filename
const ytMetadata = await getYouTubeMetadata(link); const ytMetadata = await getYouTubeMetadata(link);
const { title, uploader, filesize_approx } = ytMetadata; const { title, uploader } = ytMetadata;
contentLength = filesize_approx;
const safeTitle = `${uploader} - ${title}`; const safeTitle = `${uploader} - ${title}`;
filename = `${safeTitle}.${format}`; filename = `${safeTitle}.${format}`;
} catch (err) { } catch (err) {
@ -62,7 +58,6 @@ export const GET: RequestHandler = async ({ url }) => {
return new Response(streamYouTube(link, format), { return new Response(streamYouTube(link, format), {
headers: { headers: {
'Content-Type': `${mimeTypeMap.get(format)}`, 'Content-Type': `${mimeTypeMap.get(format)}`,
'Content-Length': contentLength,
'Content-Disposition': `attachment; filename="${filename}"` 'Content-Disposition': `attachment; filename="${filename}"`
} }
}); });