Merge branch 'main' into android

This commit is contained in:
0d0 2025-02-26 17:06:36 +01:00
commit 2cfb43ec63
6 changed files with 123 additions and 1013 deletions

View file

@ -2,3 +2,4 @@ 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=

1102
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "dl.emersa.it", "name": "dl.emersa.it",
"private": true, "private": true,
"version": "0.8.3", "version": "0.9.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
@ -19,10 +19,9 @@
"@eslint/compat": "^1.2.7", "@eslint/compat": "^1.2.7",
"@eslint/js": "^9.21.0", "@eslint/js": "^9.21.0",
"@sveltejs/adapter-node": "^5.2.12", "@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/adapter-static": "^3.0.8", "@sveltejs/kit": "^2.17.3",
"@sveltejs/kit": "^2.17.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/vite": "^4.0.8", "@tailwindcss/vite": "^4.0.9",
"eslint": "^9.21.0", "eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.1", "eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^2.46.1", "eslint-plugin-svelte": "^2.46.1",
@ -34,16 +33,16 @@
"svelte": "^5.20.4", "svelte": "^5.20.4",
"svelte-check": "^4.1.4", "svelte-check": "^4.1.4",
"sveltekit-sse": "^0.13.14", "sveltekit-sse": "^0.13.14",
"tailwindcss": "^4.0.8", "tailwindcss": "^4.0.9",
"typescript": "^5.7.3", "typescript": "^5.7.3",
"typescript-eslint": "^8.25.0", "typescript-eslint": "^8.25.0",
"vite": "^6.1.1" "vite": "^6.2.0"
}, },
"dependencies": { "dependencies": {
"@capacitor/android": "^7.0.1", "@capacitor/android": "^7.0.1",
"@capacitor/core": "^7.0.1", "@capacitor/core": "^7.0.1",
"@tailwindcss/forms": "^0.5.10", "@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.0.8", "@tailwindcss/postcss": "^4.0.9",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
"@types/node": "^22.13.5", "@types/node": "^22.13.5",
"winston": "^3.17.0", "winston": "^3.17.0",

View file

@ -4,12 +4,17 @@
### of `scaricatore`. ### of `scaricatore`.
PROJECT_ROOT=$1 PROJECT_ROOT=$1
PROXY=$2
if [ -z ${PROJECT_ROOT+x} ]; then if [ -z ${PROJECT_ROOT+x} ]; then
echo "error no project_root set" echo "ERROR: No PROJECT_ROOT set (first argument to ${0})"
exit 1 exit 1
fi fi
if [ -z ${PROXY+x} ]; then
echo "INFO: no proxy given"
fi
mkdir -p "${PROJECT_ROOT}" mkdir -p "${PROJECT_ROOT}"
cd "${PROJECT_ROOT}" || exit 1 cd "${PROJECT_ROOT}" || exit 1
@ -25,3 +30,4 @@ rm build.tar.gz
npm ci npm ci
npm run download-yt-dlp npm run download-yt-dlp
echo "YTDLP_PATH=$(readlink -f yt-dlp)" >>.env echo "YTDLP_PATH=$(readlink -f yt-dlp)" >>.env
echo "HTTPS_PROXY=${PROXY}" >>.env

View file

@ -5,6 +5,7 @@ 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;
const HTTPS_PROXY: string = env.v as string;
export const ytdl = create(YTDLP_PATH); export const ytdl = create(YTDLP_PATH);
@ -16,7 +17,8 @@ export async function getYouTubeMetadata(link: string) {
dumpSingleJson: true, dumpSingleJson: true,
noCheckCertificates: true, noCheckCertificates: true,
noWarnings: true, noWarnings: true,
preferFreeFormats: true preferFreeFormats: true,
proxy: HTTPS_PROXY ? HTTPS_PROXY : ''
}); });
} }
@ -34,7 +36,11 @@ export function streamYouTube(link: string, format: string): ReadableStream<Uint
return new ReadableStream({ return new ReadableStream({
start(controller) { start(controller) {
const args = ['--no-write-thumbnail', '-o', '-'].filter(Boolean); const args = ['--no-write-thumbnail', '-o', '-'];
if (HTTPS_PROXY) {
args.push('--proxy', HTTPS_PROXY);
}
if (mimeType?.includes('audio')) { if (mimeType?.includes('audio')) {
args.push( args.push(

View file

@ -158,7 +158,7 @@
<!-- Link Input --> <!-- Link Input -->
<div> <div>
<label for="link" class="mb-2 block text-[#00e5ff]"> Enter Playlist or Video Link: </label> <label for="link" class="mb-2 block text-[#00e5ff]"> Enter Video Link: </label>
<input <input
name="link" name="link"
type="url" type="url"