From 0cd0db7e53c973f06aad0e1709683687a4664116 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Thu, 19 Jun 2025 21:54:27 +0200 Subject: [PATCH] feat: add debug logging to torrent client --- package.json | 2 +- src/lib/modules/native.ts | 3 ++- src/lib/modules/settings/settings.ts | 6 ++++++ src/routes/app/settings/app/+page.svelte | 4 +--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3e0831b..dc5e237 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.3.68", + "version": "6.3.69", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.14.4", diff --git a/src/lib/modules/native.ts b/src/lib/modules/native.ts index 10db9c7..acf15f5 100644 --- a/src/lib/modules/native.ts +++ b/src/lib/modules/native.ts @@ -93,6 +93,7 @@ export default Object.assign>({ torrentStats: async (): Promise => ({ peers: rnd(), seeders: rnd(), leechers: rnd(), progress: Math.random(), down: rnd(100000000), up: rnd(100000000), name: 'Amebku.webm', downloaded: rnd(100000), hash: '1234567890abcdef', size: 1234567890, eta: rnd() }), torrents: async (): Promise => [{ peers: rnd(), seeders: rnd(), leechers: rnd(), progress: Math.random(), down: rnd(100000000), up: rnd(100000000), name: 'Amebku.webm', downloaded: rnd(100000), hash: '1234567890abcdef', size: 1234567890, eta: rnd() }], defaultTransparency: () => false, - errors: async () => undefined + errors: async () => undefined, + debug: async () => undefined // @ts-expect-error idk }, globalThis.native as Partial) diff --git a/src/lib/modules/settings/settings.ts b/src/lib/modules/settings/settings.ts index 0624c1e..acdeeb9 100644 --- a/src/lib/modules/settings/settings.ts +++ b/src/lib/modules/settings/settings.ts @@ -6,6 +6,12 @@ import { defaults } from '.' export const settings = persisted('settings', defaults, { beforeRead: value => ({ ...defaults, ...value }) }) +export const debug = persisted('debug', '') + +debug.subscribe((value) => { + native.debug(value) +}) + settings.subscribe(settings => { const { torrentPersist, torrentDHT, torrentStreamedDownload, torrentSpeed, maxConns, torrentPort, dhtPort, torrentPeX } = settings native.updateSettings({ torrentPersist, torrentDHT, torrentStreamedDownload, torrentSpeed, maxConns, torrentPort, dhtPort, torrentPeX }) diff --git a/src/routes/app/settings/app/+page.svelte b/src/routes/app/settings/app/+page.svelte index e6e368d..d9c34df 100644 --- a/src/routes/app/settings/app/+page.svelte +++ b/src/routes/app/settings/app/+page.svelte @@ -1,5 +1,4 @@