diff --git a/.env.example b/.env.example index f069167..0b9efdb 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,4 @@ 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/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml index 51f6387..3eb5b52 100644 --- a/.forgejo/workflows/release.yaml +++ b/.forgejo/workflows/release.yaml @@ -29,13 +29,15 @@ jobs: - name: Create Release run: | npm ci - touch .env - echo "HOST=0.0.0.0" >> .env - echo "ORIGIN=https://dl.emersa.it" >> .env - echo "PUBLIC_VERSION=$(cat package.json | jq .version)" >> .env + touch .env.production + echo "HOST=0.0.0.0" >> .env.production + echo "PORT=3000" >> .env.production + echo "ORIGIN=https://dl.emersa.it" >> .env.production + echo "PUBLIC_VERSION=$(cat package.json | jq .version)" >> .env.production + echo "NODE_ENV=production" >> .env.production npm run build cp package* build/ - cp .env build/ + cp .env.production build/ mkdir releases cd build/ tar czvf ../releases/build.tar.gz . diff --git a/package-lock.json b/package-lock.json index 2577770..83f47b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,42 +1,42 @@ { "name": "dl.emersa.it", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dl.emersa.it", - "version": "1.0.0", + "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" }, "devDependencies": { "@eslint/compat": "^1.2.8", - "@eslint/js": "^9.25.0", + "@eslint/js": "^9.25.1", "@sveltejs/adapter-node": "^5.2.12", "@sveltejs/kit": "^2.20.7", "@sveltejs/vite-plugin-svelte": "^5.0.3", "@tailwindcss/vite": "^4.1.4", - "eslint": "^9.25.0", + "eslint": "^9.25.1", "eslint-config-prettier": "^10.1.2", "eslint-plugin-svelte": "^3.5.1", "globals": "^16.0.0", - "mdsvex": "^0.12.3", + "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.18", + "sveltekit-sse": "^0.13.19", "tailwindcss": "^4.1.4", "typescript": "^5.8.3", - "typescript-eslint": "^8.30.1", - "vite": "^6.3.2" + "typescript-eslint": "^8.31.0", + "vite": "^6.3.3" } }, "node_modules/@alloc/quick-lru": { @@ -639,9 +639,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.25.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.25.0.tgz", - "integrity": "sha512-iWhsUS8Wgxz9AXNfvfOPFSW4VfMXdVhp1hjkZVhXCrpgh/aLcc45rX6MPu+tIVUWDw0HfNwth7O28M1xDxNf9w==", + "version": "9.25.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.25.1.tgz", + "integrity": "sha512-dEIwmjntEx8u3Uvv+kr3PDeeArL8Hw07H9kyYxCjnM9pBjfEhk6uLXSchxxzgiwtRhhzVzqmUSDFBOi1TuZ7qg==", "dev": true, "license": "MIT", "engines": { @@ -1628,10 +1628,20 @@ "dev": true, "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": { - "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" @@ -1655,17 +1665,17 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.30.1.tgz", - "integrity": "sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.0.tgz", + "integrity": "sha512-evaQJZ/J/S4wisevDvC1KFZkPzRetH8kYZbkgcTRyql3mcKsf+ZFDV1BVWUGTCAW5pQHoqn5gK5b8kn7ou9aFQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/type-utils": "8.30.1", - "@typescript-eslint/utils": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/scope-manager": "8.31.0", + "@typescript-eslint/type-utils": "8.31.0", + "@typescript-eslint/utils": "8.31.0", + "@typescript-eslint/visitor-keys": "8.31.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1685,16 +1695,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.30.1.tgz", - "integrity": "sha512-H+vqmWwT5xoNrXqWs/fesmssOW70gxFlgcMlYcBaWNPIEWDgLa4W9nkSPmhuOgLnXq9QYgkZ31fhDyLhleCsAg==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.31.0.tgz", + "integrity": "sha512-67kYYShjBR0jNI5vsf/c3WG4u+zDnCTHTPqVMQguffaWWFs7artgwKmfwdifl+r6XyM5LYLas/dInj2T0SgJyw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/typescript-estree": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/scope-manager": "8.31.0", + "@typescript-eslint/types": "8.31.0", + "@typescript-eslint/typescript-estree": "8.31.0", + "@typescript-eslint/visitor-keys": "8.31.0", "debug": "^4.3.4" }, "engines": { @@ -1710,14 +1720,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.30.1.tgz", - "integrity": "sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.31.0.tgz", + "integrity": "sha512-knO8UyF78Nt8O/B64i7TlGXod69ko7z6vJD9uhSlm0qkAbGeRUSudcm0+K/4CrRjrpiHfBCjMWlc08Vav1xwcw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1" + "@typescript-eslint/types": "8.31.0", + "@typescript-eslint/visitor-keys": "8.31.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1728,14 +1738,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.30.1.tgz", - "integrity": "sha512-64uBF76bfQiJyHgZISC7vcNz3adqQKIccVoKubyQcOnNcdJBvYOILV1v22Qhsw3tw3VQu5ll8ND6hycgAR5fEA==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.31.0.tgz", + "integrity": "sha512-DJ1N1GdjI7IS7uRlzJuEDCgDQix3ZVYVtgeWEyhyn4iaoitpMBX6Ndd488mXSx0xah/cONAkEaYyylDyAeHMHg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.30.1", - "@typescript-eslint/utils": "8.30.1", + "@typescript-eslint/typescript-estree": "8.31.0", + "@typescript-eslint/utils": "8.31.0", "debug": "^4.3.4", "ts-api-utils": "^2.0.1" }, @@ -1752,9 +1762,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.30.1.tgz", - "integrity": "sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.31.0.tgz", + "integrity": "sha512-Ch8oSjVyYyJxPQk8pMiP2FFGYatqXQfQIaMp+TpuuLlDachRWpUAeEu1u9B/v/8LToehUIWyiKcA/w5hUFRKuQ==", "dev": true, "license": "MIT", "engines": { @@ -1766,14 +1776,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.30.1.tgz", - "integrity": "sha512-kQQnxymiUy9tTb1F2uep9W6aBiYODgq5EMSk6Nxh4Z+BDUoYUSa029ISs5zTzKBFnexQEh71KqwjKnRz58lusQ==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.31.0.tgz", + "integrity": "sha512-xLmgn4Yl46xi6aDSZ9KkyfhhtnYI15/CvHbpOy/eR5NWhK/BK8wc709KKwhAR0m4ZKRP7h07bm4BWUYOCuRpQQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/visitor-keys": "8.30.1", + "@typescript-eslint/types": "8.31.0", + "@typescript-eslint/visitor-keys": "8.31.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1819,16 +1829,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.30.1.tgz", - "integrity": "sha512-T/8q4R9En2tcEsWPQgB5BQ0XJVOtfARcUvOa8yJP3fh9M/mXraLxZrkCfGb6ChrO/V3W+Xbd04RacUEqk1CFEQ==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.31.0.tgz", + "integrity": "sha512-qi6uPLt9cjTFxAb1zGNgTob4x9ur7xC6mHQJ8GwEzGMGE9tYniublmJaowOJ9V2jUzxrltTPfdG2nKlWsq0+Ww==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.30.1", - "@typescript-eslint/types": "8.30.1", - "@typescript-eslint/typescript-estree": "8.30.1" + "@typescript-eslint/scope-manager": "8.31.0", + "@typescript-eslint/types": "8.31.0", + "@typescript-eslint/typescript-estree": "8.31.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1843,13 +1853,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.30.1.tgz", - "integrity": "sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.31.0.tgz", + "integrity": "sha512-QcGHmlRHWOl93o64ZUMNewCdwKGU6WItOU52H0djgNmn1EOrhVudrDzXz4OycCRSCPwFCDrE2iIt5vmuUdHxuQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.30.1", + "@typescript-eslint/types": "8.31.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -2378,9 +2388,9 @@ } }, "node_modules/eslint": { - "version": "9.25.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.25.0.tgz", - "integrity": "sha512-MsBdObhM4cEwkzCiraDv7A6txFXEqtNXOb877TsSp2FCkBNl8JfVQrmiuDqC1IkejT6JLPzYBXx/xAiYhyzgGA==", + "version": "9.25.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz", + "integrity": "sha512-E6Mtz9oGQWDCpV12319d59n4tx9zOTXSTmc8BLVxBx+G/0RdM5MvEEJLU9c0+aleoePYYgVTOsRblx433qmhWQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2390,7 +2400,7 @@ "@eslint/config-helpers": "^0.2.1", "@eslint/core": "^0.13.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.25.0", + "@eslint/js": "9.25.1", "@eslint/plugin-kit": "^0.2.8", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -2708,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" }, @@ -3451,14 +3462,17 @@ } }, "node_modules/mdsvex": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.3.tgz", - "integrity": "sha512-C/uIJamjNo5PHHnR3JHqsBPoLcfUBpzRmAEB6FLMXI/s7XHOceswjDMKqSPEW2WHmYpKm0taZ3U20GSyhMridA==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.12.5.tgz", + "integrity": "sha512-JQy8CBbGF1IvpxZTmGJigRiD1s2BKfLKS9xCLPKngjHToY8WMYLZ8WFGRpuR6x4C4bxipSuLm2LctwL2fVXaEQ==", "dev": true, + "license": "MIT", "dependencies": { + "@types/mdast": "^4.0.4", "@types/unist": "^2.0.3", "prism-svelte": "^0.4.7", "prismjs": "^1.17.1", + "unist-util-visit": "^2.0.1", "vfile-message": "^2.0.4" }, "peerDependencies": { @@ -4418,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": { @@ -4520,9 +4534,9 @@ } }, "node_modules/sveltekit-sse": { - "version": "0.13.18", - "resolved": "https://registry.npmjs.org/sveltekit-sse/-/sveltekit-sse-0.13.18.tgz", - "integrity": "sha512-DEK2pcnHZsQTezM6Eq4qBUewkp3v1SBpBXX4eNiFZs4cwfGw++lEVAoPoR4I1CmLjfz+RznblvvX/Q0qomj1VA==", + "version": "0.13.19", + "resolved": "https://registry.npmjs.org/sveltekit-sse/-/sveltekit-sse-0.13.19.tgz", + "integrity": "sha512-0uOiMqRdpjoM2dM/2fyLPUfGdhhOeW9KX4LR03b4K/cYFoZt4RYyOQJrX5RPijPf9sGX2mXkc0GEA2d0l3zifg==", "dev": true, "license": "MIT", "peerDependencies": { @@ -4578,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": { @@ -4678,15 +4692,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.30.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.30.1.tgz", - "integrity": "sha512-D7lC0kcehVH7Mb26MRQi64LMyRJsj3dToJxM1+JVTl53DQSV5/7oUGWQLcKl1C1KnoVHxMMU2FNQMffr7F3Row==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.31.0.tgz", + "integrity": "sha512-u+93F0sB0An8WEAPtwxVhFby573E8ckdjwUUQUj9QA4v8JAvgtoDdIyYR3XFwFHq2W1KJ1AurwJCO+w+Y1ixyQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.30.1", - "@typescript-eslint/parser": "8.30.1", - "@typescript-eslint/utils": "8.30.1" + "@typescript-eslint/eslint-plugin": "8.31.0", + "@typescript-eslint/parser": "8.31.0", + "@typescript-eslint/utils": "8.31.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4706,6 +4720,17 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "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": { "version": "2.0.3", "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" } }, + "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": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -4749,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 9c478d5..5e3cd9e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dl.emersa.it", "private": true, - "version": "1.0.0", + "version": "1.0.2", "type": "module", "scripts": { "dev": "vite dev", @@ -16,32 +16,32 @@ }, "devDependencies": { "@eslint/compat": "^1.2.8", - "@eslint/js": "^9.25.0", + "@eslint/js": "^9.25.1", "@sveltejs/adapter-node": "^5.2.12", "@sveltejs/kit": "^2.20.7", "@sveltejs/vite-plugin-svelte": "^5.0.3", "@tailwindcss/vite": "^4.1.4", - "eslint": "^9.25.0", + "eslint": "^9.25.1", "eslint-config-prettier": "^10.1.2", "eslint-plugin-svelte": "^3.5.1", "globals": "^16.0.0", - "mdsvex": "^0.12.3", + "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.18", + "sveltekit-sse": "^0.13.19", "tailwindcss": "^4.1.4", "typescript": "^5.8.3", - "typescript-eslint": "^8.30.1", - "vite": "^6.3.2" + "typescript-eslint": "^8.31.0", + "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/install.sh b/scripts/install.sh index 57b2ff4..929c279 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -29,5 +29,5 @@ tar -xvf build.tar.gz -C . rm build.tar.gz npm ci npm run download-yt-dlp -echo "YTDLP_PATH=$(readlink -f yt-dlp)" >>.env -echo "HTTPS_PROXY=${PROXY}" >>.env +echo "YTDLP_PATH=$(readlink -f yt-dlp)" >> .env.production +echo "HTTPS_PROXY=${PROXY}" >> .env.production 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/client/downloader.ts b/src/lib/client/downloader.ts deleted file mode 100644 index c75c651..0000000 --- a/src/lib/client/downloader.ts +++ /dev/null @@ -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); -}; diff --git a/src/lib/components/DownloadManager.svelte b/src/lib/components/DownloadManager.svelte deleted file mode 100644 index efe3bc0..0000000 --- a/src/lib/components/DownloadManager.svelte +++ /dev/null @@ -1,73 +0,0 @@ - - -{#if visible} -
-
-

- Downloading {filename} -

-
-
-
-

{progress}%

-
-
-{/if} 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/ProgressBar.svelte b/src/lib/components/ProgressBar.svelte new file mode 100644 index 0000000..04bb07d --- /dev/null +++ b/src/lib/components/ProgressBar.svelte @@ -0,0 +1,22 @@ + + +
+
+

+ Downloading {filename} +

+
+
+
+

{progress}%

+
+
diff --git a/src/lib/server/helpers.ts b/src/lib/server/helpers.ts index 4b42bbb..1b86056 100644 --- a/src/lib/server/helpers.ts +++ b/src/lib/server/helpers.ts @@ -1,9 +1,8 @@ import formats from '$lib/common/supportedFormats.json'; import winston from 'winston'; -import { dev } from '$app/environment'; export const logger = winston.createLogger({ - level: dev ? 'debug' : 'error', + level: 'debug', format: winston.format.json(), transports: [new winston.transports.Console()] }); 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 eb2fc45..600806b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,20 +1,17 @@