From ea12f95ec0b4a11df61f8c7f1a39df3293c902ec Mon Sep 17 00:00:00 2001 From: OfficialDakari Date: Fri, 18 Oct 2024 20:36:00 +0500 Subject: [PATCH] feat: configurable proxy feat: dont include yt-dlp and config --- .gitignore | 4 +++- config.ts | 5 +++++ config.yml | 3 ++- config.yml.example | 6 ++++++ utils/ytmApi.ts | 7 ++----- yt-dlp.sh.example | 3 +++ 6 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 config.yml.example create mode 100755 yt-dlp.sh.example diff --git a/.gitignore b/.gitignore index 6d81c91..2ca23ec 100644 --- a/.gitignore +++ b/.gitignore @@ -133,4 +133,6 @@ dist data/ cache/ cacheStore/ -tmpStore/ \ No newline at end of file +tmpStore/ +config.yml +yt-dlp.sh \ No newline at end of file diff --git a/config.ts b/config.ts index b1077fb..b712096 100644 --- a/config.ts +++ b/config.ts @@ -4,4 +4,9 @@ export type Config = { api_base_url: string; web_base_url: string; jwt_privkey: string; + proxy: { + host: string; + port: number; + protocol: string; + }; }; \ No newline at end of file diff --git a/config.yml b/config.yml index a930afd..637b74d 100644 --- a/config.yml +++ b/config.yml @@ -2,4 +2,5 @@ api_port: 33223 api_base_url: http://localhost:33223 web_port: 8888 web_base_url: http://localhost:8888 -jwt_privkey: AfhrynxvaH7XevethWCLzzp3Xq49NpqeENdgVVPJnqKNfdAJFuRNdPosAJXYznez \ No newline at end of file +jwt_privkey: AfhrynxvaH7XevethWCLzzp3Xq49NpqeENdgVVPJnqKNfdAJFuRNdPosAJXYznez +proxy: null \ No newline at end of file diff --git a/config.yml.example b/config.yml.example new file mode 100644 index 0000000..637b74d --- /dev/null +++ b/config.yml.example @@ -0,0 +1,6 @@ +api_port: 33223 +api_base_url: http://localhost:33223 +web_port: 8888 +web_base_url: http://localhost:8888 +jwt_privkey: AfhrynxvaH7XevethWCLzzp3Xq49NpqeENdgVVPJnqKNfdAJFuRNdPosAJXYznez +proxy: null \ No newline at end of file diff --git a/utils/ytmApi.ts b/utils/ytmApi.ts index dfc9fc2..030e06c 100644 --- a/utils/ytmApi.ts +++ b/utils/ytmApi.ts @@ -1,11 +1,8 @@ import YTMusic from "ytmusic-api"; +import { config } from "../index.js"; const ytmApi = new YTMusic({ - proxy: { - protocol: 'http', - host: 'localhost', - port: 12334 - } + proxy: config.proxy }); ytmApi.initialize().then(() => { diff --git a/yt-dlp.sh.example b/yt-dlp.sh.example new file mode 100755 index 0000000..0ba9190 --- /dev/null +++ b/yt-dlp.sh.example @@ -0,0 +1,3 @@ +#!/usr/bin/sh + +yt-dlp --proxy socks5://localhost:12334 $@ \ No newline at end of file