From 5fdf66c317a4aa51b155da3ad83f7080df80ea8c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:12:07 -0500 Subject: typo --- src/web/src/components/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/App.jsx b/src/web/src/components/App.jsx index 2d2713c4..091cc2f8 100644 --- a/src/web/src/components/App.jsx +++ b/src/web/src/components/App.jsx @@ -127,7 +127,7 @@ const ModeSpecificConnectButton = ({ color = 'yellow'; } - if (server?.isConnecting || server?.IsLoggingIn) { + if (server?.isConnecting || server?.isLoggingIn) { icon = 'sync alternate loading'; color = 'green'; } -- cgit v1.2.3 From 4f42e94a775f0c811e2da67a143cfbb5530c3072 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:12:27 -0500 Subject: coalesce response --- src/web/src/lib/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/lib/api.js b/src/web/src/lib/api.js index 9506a0da..74602d63 100644 --- a/src/web/src/lib/api.js +++ b/src/web/src/lib/api.js @@ -26,7 +26,7 @@ api.interceptors.response.use( }, (error) => { if ( - error.response.status === 401 && + error.response?.status === 401 && !['/session', '/server', '/application'].includes( error.response.config.url, ) -- cgit v1.2.3 From 2db6d0f2af8b707d4e7c2977371c9e5eab7c44a9 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:15:21 -0500 Subject: coalesce response --- src/web/src/lib/session.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/lib/session.js b/src/web/src/lib/session.js index 014b131c..cf6966c6 100644 --- a/src/web/src/lib/session.js +++ b/src/web/src/lib/session.js @@ -36,7 +36,7 @@ export const check = async () => { await api.get('/session'); return true; } catch (error) { - if (error.response.status === 401) { + if (error.response?.status === 401) { console.error('session error; not logged in or session has expired'); logout(); return false; -- cgit v1.2.3 From 7e00ec468938b563460df76efa9dd239f2d2cceb Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:15:54 -0500 Subject: quiet errors while waiting for browse status to report --- src/web/src/components/Browse/Browse.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Browse/Browse.jsx b/src/web/src/components/Browse/Browse.jsx index 44e6b2dd..c6107bd5 100644 --- a/src/web/src/components/Browse/Browse.jsx +++ b/src/web/src/components/Browse/Browse.jsx @@ -251,8 +251,13 @@ class Browse extends Component { return; } - const response = await users.getBrowseStatus({ username }); - this.setState({ browseStatus: response.data }); + try { + const response = await users.getBrowseStatus({ username }); + this.setState({ browseStatus: response.data }); + } catch { + // status is not available until the first progress update, and is removed shortly after completion; + // this runs on an interval, so just try again next time + } }; getDirectoryTree = ({ directories, separator }) => { -- cgit v1.2.3 From 2d2f0f67716a61b5044ce8499bf82c8554fbe360 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:16:32 -0500 Subject: trap errors fetching conversations --- src/web/src/components/Chat/Chat.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Chat/Chat.jsx b/src/web/src/components/Chat/Chat.jsx index 9224fb30..4fcb44ed 100644 --- a/src/web/src/components/Chat/Chat.jsx +++ b/src/web/src/components/Chat/Chat.jsx @@ -60,7 +60,13 @@ class Chat extends Component { this.setState( { active: sessionStorage.getItem(activeChatKey) || '', - interval: window.setInterval(this.fetchConversations, 5_000), + interval: window.setInterval(async () => { + try { + await this.fetchConversations(); + } catch (error) { + console.error(error); + } + }, 5_000), }, async () => { await this.fetchConversations(); @@ -113,7 +119,6 @@ class Chat extends Component { // check to see if the active chat is still active // this will happen whenever a chat is closed/removed if (activeConversation) { - console.log('active?', activeConversation); // *before* fetching messages, ack any unacked messages // for the active chat if (activeConversation.hasUnAcknowledgedMessages === true) { -- cgit v1.2.3 From 5dfff8b3c396bbe0e89a169ef46f010fb74c2ddd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:16:51 -0500 Subject: coalesce availableResult --- src/web/src/components/Rooms/RoomJoinModal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Rooms/RoomJoinModal.jsx b/src/web/src/components/Rooms/RoomJoinModal.jsx index 5a6cf0c2..dd3c7178 100644 --- a/src/web/src/components/Rooms/RoomJoinModal.jsx +++ b/src/web/src/components/Rooms/RoomJoinModal.jsx @@ -25,7 +25,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { const getAvailableRooms = async () => { setLoading(true); const availableResult = await rooms.getAvailable(); - setAvailable(availableResult); + setAvailable(availableResult ?? []); setLoading(false); }; -- cgit v1.2.3 From 86173c3afeee4ffabc07b37d0f5702e9f0347ee7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:17:47 -0500 Subject: coalesce download errors --- src/web/src/components/Search/Response.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Search/Response.jsx b/src/web/src/components/Search/Response.jsx index 567b80a3..a17df823 100644 --- a/src/web/src/components/Search/Response.jsx +++ b/src/web/src/components/Search/Response.jsx @@ -254,8 +254,9 @@ class Response extends Component { size="large" /> )} -- cgit v1.2.3 From 15293022a51c7602b12ef4a261fa893e1a752fcb Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:18:21 -0500 Subject: remove log --- src/web/src/components/Shared/CodeEditor.jsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Shared/CodeEditor.jsx b/src/web/src/components/Shared/CodeEditor.jsx index 8780bc31..b82683de 100644 --- a/src/web/src/components/Shared/CodeEditor.jsx +++ b/src/web/src/components/Shared/CodeEditor.jsx @@ -8,8 +8,6 @@ import CodeMirror from '@uiw/react-codemirror'; import React from 'react'; const CodeEditor = ({ onChange = () => {}, theme, value, ...rest }) => { - console.log(defaultHighlightStyle); - return ( Date: Sun, 25 Oct 2026 17:25:31 -0500 Subject: fix upload slot icon --- src/web/src/components/Users/User.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Users/User.jsx b/src/web/src/components/Users/User.jsx index 0e392122..4972b0d1 100644 --- a/src/web/src/components/Users/User.jsx +++ b/src/web/src/components/Users/User.jsx @@ -33,6 +33,7 @@ const FreeUploadSlot = ({ hasFreeUploadSlot }) => ( const User = ({ address, description, + hasFreeUploadSlot, hasPicture, picture, port, @@ -57,7 +58,7 @@ const User = ({ {username} - Free Upload Slot: , Total Upload + Free Upload Slot: , Total Upload Slots: {uploadSlots}, Queue Length: {queueLength}, IP Address: {address} , Port: {port} -- cgit v1.2.3 From eade263f70cf957a95dc5f20b82105cc8eae94fc Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:25:56 -0500 Subject: stop logs hub when component unmounts --- src/web/src/components/System/Logs/Live.jsx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/web/src/components/System/Logs/Live.jsx b/src/web/src/components/System/Logs/Live.jsx index 2699a2e3..c572b2f9 100644 --- a/src/web/src/components/System/Logs/Live.jsx +++ b/src/web/src/components/System/Logs/Live.jsx @@ -20,6 +20,7 @@ class Live extends Component { componentDidMount() { const logsHub = createLogsHubConnection(); + this.logsHub = logsHub; logsHub.on('buffer', (buffer) => { this.setState({ @@ -44,6 +45,10 @@ class Live extends Component { logsHub.start(); } + componentWillUnmount() { + this.logsHub?.stop(); + } + nextId = 0; withId = (log) => ({ ...log, id: this.nextId++ }); -- cgit v1.2.3 From 40b82b68d7af3ff665e7f2b18869c3bbce4c6539 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:26:16 -0500 Subject: improve donation link --- src/web/src/components/System/Info/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/System/Info/index.jsx b/src/web/src/components/System/Info/index.jsx index 8672b5df..016b683f 100644 --- a/src/web/src/components/System/Info/index.jsx +++ b/src/web/src/components/System/Info/index.jsx @@ -42,8 +42,9 @@ const Info = ({ state, theme }) => { mediaQuery="(max-width: 686px)" onClick={() => window.open( - `http://www.slsknet.org/qtlogin.php?username=${state?.user?.username}`, + `http://www.slsknet.org/qtlogin.php?username=${encodeURIComponent(state?.user?.username ?? '')}`, '_blank', + 'noopener,noreferrer', ) } > -- cgit v1.2.3 From b2ba22c852fcf10fc26cbcd55dfb55416754ba1b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 17:26:44 -0500 Subject: coalesce transfer response --- src/web/src/components/Transfers/Transfers.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Transfers/Transfers.jsx b/src/web/src/components/Transfers/Transfers.jsx index f43ed1ae..025de9e2 100644 --- a/src/web/src/components/Transfers/Transfers.jsx +++ b/src/web/src/components/Transfers/Transfers.jsx @@ -17,7 +17,7 @@ const Transfers = ({ direction, server }) => { const fetch = async () => { try { const response = await transfersLibrary.getAll({ direction }); - setTransfers(response); + setTransfers(response ?? []); } catch (error) { console.error(error); toast.error(error?.response?.data ?? error?.message ?? error); -- cgit v1.2.3 From f364e465a2c3e1027f22262a0f2df510d9c419f6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:00:05 -0500 Subject: trap errors --- src/web/src/components/Rooms/Rooms.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Rooms/Rooms.jsx b/src/web/src/components/Rooms/Rooms.jsx index f6bdb685..a21525ce 100644 --- a/src/web/src/components/Rooms/Rooms.jsx +++ b/src/web/src/components/Rooms/Rooms.jsx @@ -81,8 +81,20 @@ class Rooms extends Component { { active: sessionStorage.getItem(activeRoomKey) || '', intervals: { - messages: window.setInterval(this.fetchActiveRoom, 1_000), - rooms: window.setInterval(this.fetchJoinedRooms, 500), + messages: window.setInterval(async () => { + try { + await this.fetchActiveRoom(); + } catch (error) { + console.error(error); + } + }, 1_000), + rooms: window.setInterval(async () => { + try { + await this.fetchJoinedRooms(); + } catch (error) { + console.error(error); + } + }, 500), }, }, async () => { -- cgit v1.2.3 From 778f0dd4569fe19c304fca5a6d32360be7ffffb8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:00:30 -0500 Subject: fix user profile/browse when running with non-empty urlbase --- src/web/src/components/Rooms/Rooms.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Rooms/Rooms.jsx b/src/web/src/components/Rooms/Rooms.jsx index a21525ce..bf8cba39 100644 --- a/src/web/src/components/Rooms/Rooms.jsx +++ b/src/web/src/components/Rooms/Rooms.jsx @@ -260,13 +260,13 @@ class Rooms extends Component { }; handleUserProfile = () => { - this.props.history.push('/users', { + this.props.history.push(`${urlBase}/users`, { user: this.state.contextMenu.message.username, }); }; handleBrowseShares = () => { - this.props.history.push('/browse', { + this.props.history.push(`${urlBase}/browse`, { user: this.state.contextMenu.message.username, }); }; -- cgit v1.2.3 From 988eeec79212ce23eb498aff71134b8ae89576d6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:01:04 -0500 Subject: catch errors when clearing data --- src/web/src/components/System/Data/index.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/web/src/components/System/Data/index.jsx b/src/web/src/components/System/Data/index.jsx index 8b6a99eb..2424ea87 100644 --- a/src/web/src/components/System/Data/index.jsx +++ b/src/web/src/components/System/Data/index.jsx @@ -5,9 +5,15 @@ import { Button, Divider, Header, Icon } from 'semantic-ui-react'; const clear = async ({ direction, setState }) => { setState(true); - await clearCompleted({ direction }); - setState(false); - toast.success(`Completed ${direction}s cleared!`); + + try { + await clearCompleted({ direction }); + toast.success(`Completed ${direction}s cleared!`); + } catch (error) { + toast.error(error?.response?.data ?? error?.message ?? error); + } finally { + setState(false); + } }; const Data = () => { -- cgit v1.2.3 From e8dfb2f304afb423cf02d2edcfd98b6c817bac0c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:01:31 -0500 Subject: handle errors gracefully --- src/web/src/components/System/Shares/ContentsModal.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/System/Shares/ContentsModal.jsx b/src/web/src/components/System/Shares/ContentsModal.jsx index 5399bcf2..36d1d79d 100644 --- a/src/web/src/components/System/Shares/ContentsModal.jsx +++ b/src/web/src/components/System/Shares/ContentsModal.jsx @@ -13,7 +13,16 @@ const ContentsModal = ({ onClose, share, theme }) => { const fetch = async () => { setLoading(true); - const result = await browse({ id }); + let result; + + try { + result = await browse({ id }); + } catch (error) { + console.error(error); + setContents(error?.response?.data ?? error?.message ?? String(error)); + setLoading(false); + return; + } const directories = result.map((directory) => { const lines = [directory.name.replace(remotePath, localPath)]; -- cgit v1.2.3 From 8bf64a6319040a7e4002a4d27ce4f21f17d7da2f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:01:58 -0500 Subject: coalesce file structure --- src/web/src/components/Transfers/TransferGroup.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Transfers/TransferGroup.jsx b/src/web/src/components/Transfers/TransferGroup.jsx index 12354362..ea4fba04 100644 --- a/src/web/src/components/Transfers/TransferGroup.jsx +++ b/src/web/src/components/Transfers/TransferGroup.jsx @@ -42,7 +42,7 @@ class TransferGroup extends Component { .map((s) => user.directories .find((d) => d.directory === s.directory) - .files.find((f) => f.filename === s.filename), + ?.files?.find((f) => f.filename === s.filename), ) .filter((s) => s !== undefined); }; -- cgit v1.2.3 From 600b0b5d484c4c6959f2d527a2c77e3faa1f28ef Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:02:15 -0500 Subject: trap and log errors --- src/web/src/components/Transfers/TransferGroup.jsx | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Transfers/TransferGroup.jsx b/src/web/src/components/Transfers/TransferGroup.jsx index ea4fba04..f150459a 100644 --- a/src/web/src/components/Transfers/TransferGroup.jsx +++ b/src/web/src/components/Transfers/TransferGroup.jsx @@ -65,21 +65,29 @@ class TransferGroup extends Component { }; cancelAll = async (direction, username, selected) => { - await Promise.all( - selected.map((file) => - transfers.cancel({ direction, id: file.id, username }), - ), - ); + try { + await Promise.all( + selected.map((file) => + transfers.cancel({ direction, id: file.id, username }), + ), + ); + } catch (error) { + console.error(error); + } }; removeAll = async (direction, username, selected) => { - await Promise.all( - selected.map((file) => - transfers - .cancel({ direction, id: file.id, remove: true, username }) - .then(() => this.removeFileSelection(file)), - ), - ); + try { + await Promise.all( + selected.map((file) => + transfers + .cancel({ direction, id: file.id, remove: true, username }) + .then(() => this.removeFileSelection(file)), + ), + ); + } catch (error) { + console.error(error); + } }; handleRetry = async (file) => { -- cgit v1.2.3 From a558ed524154ccef63a56c8335b6984a16a78bd5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:03:31 -0500 Subject: don't rely on state for passing data --- src/web/src/components/System/Options/EditModal.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/web/src/components/System/Options/EditModal.jsx b/src/web/src/components/System/Options/EditModal.jsx index 6fc2af69..79fa4332 100644 --- a/src/web/src/components/System/Options/EditModal.jsx +++ b/src/web/src/components/System/Options/EditModal.jsx @@ -43,6 +43,7 @@ const EditModal = ({ onClose, open, theme }) => { const validate = async (newYaml) => { const response = await validateYaml({ yaml: newYaml }); setYamlError(response); + return response; }; const update = async (newYaml) => { @@ -51,14 +52,14 @@ const EditModal = ({ onClose, open, theme }) => { }; const save = async (newYaml) => { - await validate(newYaml); + const validationError = await validate(newYaml); - if (!yamlError) { + if (!validationError) { try { await updateYaml({ yaml: newYaml }); onClose(); } catch (nextUpdateError) { - setUpdateError(nextUpdateError.response.data); + setUpdateError(nextUpdateError?.response?.data ?? nextUpdateError?.message); } } }; -- cgit v1.2.3 From 8d26e0d68dd4fea3f8ba6fe76c7a0bef7969bcc5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 18:12:10 -0500 Subject: improve removal of key listeners on users page --- src/web/src/components/Users/Users.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Users/Users.jsx b/src/web/src/components/Users/Users.jsx index 55dc1047..16f0c453 100644 --- a/src/web/src/components/Users/Users.jsx +++ b/src/web/src/components/Users/Users.jsx @@ -37,20 +37,20 @@ const Users = () => { const keyUp = (event) => (event.key === 'Escape' ? clear() : ''); - useLayoutEffect(() => { - document.removeEventListener('keyup', keyUp, false); - }, []); // eslint-disable-line react-hooks/exhaustive-deps - useEffect(() => { document.addEventListener('keyup', keyUp, false); const storedUsername = location.state?.user || localStorage.getItem(activeUserInfoKey); - if (storedUsername !== undefined) { + if (storedUsername) { setSelectedUsername(storedUsername); setInputText(storedUsername); } + + return () => { + document.removeEventListener('keyup', keyUp, false); + }; }, []); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { -- cgit v1.2.3 From ea9f91874d8c57dd5bae03b510e881aee148bcd8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 19:26:09 -0500 Subject: stringify yaml (axios does this for us, so this is preventative) --- src/web/src/lib/options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/lib/options.js b/src/web/src/lib/options.js index 1c3c55c5..891d0ee2 100644 --- a/src/web/src/lib/options.js +++ b/src/web/src/lib/options.js @@ -17,9 +17,9 @@ export const getYamlLocation = async () => { }; export const validateYaml = async ({ yaml }) => { - return (await api.post('/options/yaml/validate', yaml)).data; + return (await api.post('/options/yaml/validate', JSON.stringify(yaml))).data; }; export const updateYaml = async ({ yaml }) => { - return (await api.put('/options/yaml', yaml)).data; + return (await api.put('/options/yaml', JSON.stringify(yaml))).data; }; -- cgit v1.2.3 From 48c41217c3c6a884c52e30341f1c39bdabceb0f7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 20:24:25 -0500 Subject: set policy for metrics --- src/slskd/Telemetry/API/MetricsHub.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Telemetry/API/MetricsHub.cs b/src/slskd/Telemetry/API/MetricsHub.cs index 5dcd4ecc..b6920ef0 100644 --- a/src/slskd/Telemetry/API/MetricsHub.cs +++ b/src/slskd/Telemetry/API/MetricsHub.cs @@ -42,7 +42,7 @@ public interface IMetricsHub Task Update(object metrics); } -[Authorize] +[Authorize(Policy = AuthPolicy.Any)] public class MetricsHub : Hub { public MetricsHub(MetricsService metricsService) -- cgit v1.2.3 From e4788aed713769aeade0e2ce8a05c75e3986fe8f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 20:25:23 -0500 Subject: dispose ephemeral share repositories --- src/slskd/Shares/ShareService.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index 054561bf..40603892 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -391,7 +391,11 @@ namespace slskd.Shares await Scanner.ScanAsync(Local.Host.Shares, OptionsMonitor.CurrentValue.Shares, Local.Repository); Log.Debug("Backing up shared file cache database..."); - Local.Repository.BackupTo(ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name)); + using (var backupRepository = ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name)) + { + Local.Repository.BackupTo(backupRepository); + } + Log.Debug("Shared file cache database backup complete"); Log.Debug("Recomputing share statistics..."); @@ -443,7 +447,7 @@ namespace slskd.Shares { Log.Information("Share cache StorageMode is 'Memory'. Attempting to load from backup..."); - var backupRepository = ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name); + using var backupRepository = ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name); if (backupRepository.TryValidate(out _)) { @@ -471,7 +475,7 @@ namespace slskd.Shares { Log.Warning("Share cache is missing, corrupt, or is out of date. Attempting to load from backup..."); - var backupRepository = ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name); + using var backupRepository = ShareRepositoryFactory.CreateFromHostBackup(Local.Host.Name); if (backupRepository.TryValidate(out _)) { -- cgit v1.2.3 From 4b3bc19e6411ea16bf2c6bfe50468ca92034b287 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 22:02:47 -0500 Subject: don't cancel search tasks; can cause 'hanging' --- src/slskd/Search/SearchService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Search/SearchService.cs b/src/slskd/Search/SearchService.cs index 208e8f9d..4051eeab 100644 --- a/src/slskd/Search/SearchService.cs +++ b/src/slskd/Search/SearchService.cs @@ -377,7 +377,7 @@ namespace slskd.Search rateLimiter.Dispose(); CancellationTokens.TryRemove(id, out _); } - }, cancellationToken: cancellationTokenSource.Token); + }); // broadcast and return the _newly created_ search; it will continue to be updated in the background await SearchHub.BroadcastUpdateAsync(search); -- cgit v1.2.3 From c7984d965f4d2d323091d5b87e558ca57a7e1011 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 22:03:15 -0500 Subject: use a thread safe collection for responses --- src/slskd/Search/SearchService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Search/SearchService.cs b/src/slskd/Search/SearchService.cs index 4051eeab..8b107084 100644 --- a/src/slskd/Search/SearchService.cs +++ b/src/slskd/Search/SearchService.cs @@ -271,7 +271,8 @@ namespace slskd.Search // initialize the list of responses that we'll use to accumulate them // populated by the responseHandler we pass to SearchAsync - List responses = new(); + // responses arrive concurrently from many connections, so this must be thread safe + ConcurrentQueue responses = new(); options ??= new SearchOptions(); options = options.WithActions( @@ -308,7 +309,7 @@ namespace slskd.Search // the client state (e.g. disconnected) or a problem with the search (e.g. no terms) var soulseekSearchTask = Client.SearchAsync( query, - responseHandler: (response) => responses.Add(response), + responseHandler: (response) => responses.Enqueue(response), scope, token, options, -- cgit v1.2.3 From 151594c755354d0425f2e55069b7386ebf81a563 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 22:12:51 -0500 Subject: extra check if value is a number --- src/slskd/Common/Validation/EnumAttribute.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Common/Validation/EnumAttribute.cs b/src/slskd/Common/Validation/EnumAttribute.cs index fc077bb6..cdbaccda 100644 --- a/src/slskd/Common/Validation/EnumAttribute.cs +++ b/src/slskd/Common/Validation/EnumAttribute.cs @@ -60,14 +60,14 @@ namespace slskd.Validation return new ValidationResult($"The {validationContext.DisplayName} field contains one or more null or empty values"); } - if (array.Any(x => !Enum.TryParse(TargetType, x, IgnoreCase, out _))) + if (array.Any(x => !Enum.TryParse(TargetType, x, IgnoreCase, out var parsed) || !Enum.IsDefined(TargetType, parsed))) { return new ValidationResult($"The elements in the {validationContext.DisplayName} field must all be one of: {string.Join(", ", Enum.GetNames(TargetType))}. Case {(IgnoreCase ? "insensitive" : "sensitive")}."); } } else { - if (value != null && !Enum.TryParse(TargetType, value.ToString(), IgnoreCase, out _)) + if (value != null && (!Enum.TryParse(TargetType, value.ToString(), IgnoreCase, out var parsed) || !Enum.IsDefined(TargetType, parsed))) { return new ValidationResult($"The {validationContext.DisplayName} field must be one of: {string.Join(", ", Enum.GetNames(TargetType))}. Case {(IgnoreCase ? "insensitive" : "sensitive")}."); } -- cgit v1.2.3 From 06a7849bd93108a4f96427e26007494da276382b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 22:14:44 -0500 Subject: fix missing arg in log --- src/slskd/Integrations/Scripts/ScriptService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index 33ef0b9b..8fb0f74d 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -123,7 +123,7 @@ public class ScriptService if (string.IsNullOrEmpty(executable)) { - Log.Warning("Script '{Script}' will not be run: unable to determine script executable. Update the script configuration, or set your operating system's SHELL envar."); + Log.Warning("Script '{Script}' will not be run: unable to determine script executable. Update the script configuration, or set your operating system's SHELL envar.", script.Key); return; } -- cgit v1.2.3 From 3e61fd10d693a45c520b7436097919bc68eface0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 09:53:21 -0500 Subject: cache default serializer options --- src/slskd/Common/CommonExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Common/CommonExtensions.cs b/src/slskd/Common/CommonExtensions.cs index 95721163..47e4aee1 100644 --- a/src/slskd/Common/CommonExtensions.cs +++ b/src/slskd/Common/CommonExtensions.cs @@ -53,6 +53,8 @@ namespace slskd /// public static class CommonExtensions { + private static readonly JsonSerializerOptions DefaultJsonSerializerOptions = GetJsonSerializerOptions(); + /// /// Times this Task out after the specified TimeSpan. /// @@ -358,7 +360,7 @@ namespace slskd /// /// The object to serialize. /// A string containing the serialized object. - public static string ToJson(this object obj) => JsonSerializer.Serialize(obj, GetJsonSerializerOptions()); + public static string ToJson(this object obj) => JsonSerializer.Serialize(obj, DefaultJsonSerializerOptions); /// /// Serializes this object to yaml. @@ -481,7 +483,7 @@ namespace slskd /// The type to which to deserialize the string. /// The string to deserialize. /// The new object deserialized from the string. - public static T FromJson(this string str) => JsonSerializer.Deserialize(str, GetJsonSerializerOptions()); + public static T FromJson(this string str) => JsonSerializer.Deserialize(str, DefaultJsonSerializerOptions); /// /// Applies the standard json serializer options to the specified instance. -- cgit v1.2.3 From ed922f1963148db85f256066c0c55cb5f308c2d3 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 10:27:57 -0500 Subject: fix bug resolving links --- src/slskd/Files/FileService.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Files/FileService.cs b/src/slskd/Files/FileService.cs index 70bfc293..7cce5198 100644 --- a/src/slskd/Files/FileService.cs +++ b/src/slskd/Files/FileService.cs @@ -103,9 +103,11 @@ namespace slskd.Files // we should only get this far if: // 1) the given file exists and // 2) it is a symlink, meaning this line _SHOULD_ be guaranteed to return an instance of FileInfo. + FileInfo resolved; + try { - info = (FileInfo)info.ResolveLinkTarget(returnFinalTarget: true); + resolved = (FileInfo)info.ResolveLinkTarget(returnFinalTarget: true); } catch (Exception ex) when (ex is UnauthorizedAccessException || ex is SecurityException) { @@ -117,13 +119,13 @@ namespace slskd.Files throw new IOException($"Failed to resolve FileInfo for linked file '{info.Name}->{info.LinkTarget}': {ex.Message}", ex); } - if (info is null) + if (resolved is null) { Log.Error("Resolved FileInfo for linked file '{File}->{Link}' was unexpectedly null", info.Name, info.LinkTarget); throw new IOException($"An unexpected error was encountered while resolving FileInfo for linked file '{info.Name}->{info.LinkTarget}'"); } - return info; + return resolved; } /// -- cgit v1.2.3 From e14c0a6b31d801118949408e12feae6bd43ea6da Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 10:57:58 -0500 Subject: improve behavior when kicking off scan --- src/slskd/Shares/API/Controllers/SharesController.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/slskd/Shares/API/Controllers/SharesController.cs b/src/slskd/Shares/API/Controllers/SharesController.cs index 76ec4643..1ce1f88e 100644 --- a/src/slskd/Shares/API/Controllers/SharesController.cs +++ b/src/slskd/Shares/API/Controllers/SharesController.cs @@ -153,15 +153,13 @@ namespace slskd.Shares.API [ProducesResponseType(409)] public IActionResult RescanSharesAsync() { - try + if (Shares.StateMonitor.CurrentValue.Scanning) { - _ = Shares.ScanAsync(); - } - catch (ShareScanInProgressException) - { - return Conflict("A share scan is already in progress."); + return Conflict("A share scan is already in progress"); } + _ = Shares.ScanAsync(); + return Ok(); } -- cgit v1.2.3 From e8f3b105f91cdc64a6b27f807b61a84badf17f3d Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 19:24:46 -0500 Subject: check parsed enums --- src/slskd/Telemetry/API/ReportsController.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/slskd/Telemetry/API/ReportsController.cs b/src/slskd/Telemetry/API/ReportsController.cs index ccb45daf..02b962e1 100644 --- a/src/slskd/Telemetry/API/ReportsController.cs +++ b/src/slskd/Telemetry/API/ReportsController.cs @@ -104,7 +104,7 @@ public class ReportsController : ControllerBase if (!string.IsNullOrWhiteSpace(direction)) { - if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection)) + if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection) || !Enum.IsDefined(parsedDirection)) { return BadRequest($"Invalid direction; expected one of: {string.Join(", ", Enum.GetNames(typeof(TransferDirection)))}"); } @@ -205,7 +205,7 @@ public class ReportsController : ControllerBase if (!string.IsNullOrWhiteSpace(direction)) { - if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection)) + if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection) || !Enum.IsDefined(parsedDirection)) { return BadRequest($"Invalid direction; expected one of: {string.Join(", ", Enum.GetNames(typeof(TransferDirection)))}"); } @@ -263,7 +263,7 @@ public class ReportsController : ControllerBase return BadRequest("Direction is required"); } - if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection)) + if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection) || !Enum.IsDefined(parsedDirection)) { return BadRequest($"Invalid direction; expected one of: {string.Join(", ", Enum.GetNames(typeof(TransferDirection)))}"); } @@ -276,12 +276,12 @@ public class ReportsController : ControllerBase return BadRequest("End time must be later than start time"); } - if (!Enum.TryParse(sortBy, out var parsedSortBy)) + if (!Enum.TryParse(sortBy, out var parsedSortBy) || !Enum.IsDefined(parsedSortBy)) { return BadRequest($"Invalid sortBy; expected one of: {string.Join(", ", Enum.GetNames(typeof(LeaderboardSortBy)))}"); } - if (!Enum.TryParse(sortOrder, out var parsedSortOrder)) + if (!Enum.TryParse(sortOrder, out var parsedSortOrder) || !Enum.IsDefined(parsedSortOrder)) { return BadRequest($"Invalid sortOrder; expected one of: {string.Join(", ", Enum.GetNames(typeof(SortOrder)))}"); } @@ -425,7 +425,7 @@ public class ReportsController : ControllerBase return BadRequest("Direction is required"); } - if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection)) + if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection) || !Enum.IsDefined(parsedDirection)) { return BadRequest($"Invalid direction; expected one of: {string.Join(", ", Enum.GetNames(typeof(TransferDirection)))}"); } @@ -438,7 +438,7 @@ public class ReportsController : ControllerBase return BadRequest("End time must be later than start time"); } - if (!Enum.TryParse(sortOrder, out var parsedSortOrder)) + if (!Enum.TryParse(sortOrder, out var parsedSortOrder) || !Enum.IsDefined(parsedSortOrder)) { return BadRequest($"Invalid sortOrder; expected one of: {string.Join(", ", Enum.GetNames(typeof(SortOrder)))}"); } @@ -502,7 +502,7 @@ public class ReportsController : ControllerBase return BadRequest("Direction is required"); } - if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection)) + if (!Enum.TryParse(direction, ignoreCase: true, out var parsedDirection) || !Enum.IsDefined(parsedDirection)) { return BadRequest($"Invalid direction; expected one of: {string.Join(", ", Enum.GetNames(typeof(TransferDirection)))}"); } -- cgit v1.2.3 From 51fe3de76ccc7d9d43b1c10e75295ee2a82b06b4 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 19:26:04 -0500 Subject: missed import --- src/web/src/components/Rooms/Rooms.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Rooms/Rooms.jsx b/src/web/src/components/Rooms/Rooms.jsx index bf8cba39..87fe51be 100644 --- a/src/web/src/components/Rooms/Rooms.jsx +++ b/src/web/src/components/Rooms/Rooms.jsx @@ -1,4 +1,4 @@ -import { activeRoomKey } from '../../config'; +import { activeRoomKey, urlBase } from '../../config'; import * as rooms from '../../lib/rooms'; import PlaceholderSegment from '../Shared/PlaceholderSegment'; import RoomMenu from './RoomMenu'; -- cgit v1.2.3 From c86b636543279c8a0daf1a00ac516d9c0490b365 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 19:26:34 -0500 Subject: another missed import --- src/web/src/components/Users/Users.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/src/components/Users/Users.jsx b/src/web/src/components/Users/Users.jsx index 16f0c453..fd9c3c6c 100644 --- a/src/web/src/components/Users/Users.jsx +++ b/src/web/src/components/Users/Users.jsx @@ -3,7 +3,7 @@ import { activeUserInfoKey } from '../../config'; import * as users from '../../lib/users'; import PlaceholderSegment from '../Shared/PlaceholderSegment'; import User from './User'; -import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { Icon, Input, Item, Loader, Segment } from 'semantic-ui-react'; -- cgit v1.2.3 From 2ebbad1ee1d4415438ff1e8b27a9ecfe9adbb8bc Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 19:27:47 -0500 Subject: wrong var name --- src/web/src/components/Search/Searches.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Search/Searches.jsx b/src/web/src/components/Search/Searches.jsx index d50462ba..95d5bd82 100644 --- a/src/web/src/components/Search/Searches.jsx +++ b/src/web/src/components/Search/Searches.jsx @@ -145,8 +145,8 @@ const Searches = ({ server } = {}) => { }); setRemoving(false); - } catch (error_) { - console.error(error_); + } catch (error) { + console.error(error); toast.error(error?.response?.data ?? error?.message ?? error); setRemoving(false); } -- cgit v1.2.3 From 8fbaea0807a4eabc11d350832ccb4ac8e7ed6656 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Oct 2026 19:28:09 -0500 Subject: coalesce server --- src/web/src/components/Search/Searches.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Search/Searches.jsx b/src/web/src/components/Search/Searches.jsx index 95d5bd82..3271bbe0 100644 --- a/src/web/src/components/Search/Searches.jsx +++ b/src/web/src/components/Search/Searches.jsx @@ -218,24 +218,24 @@ const Searches = ({ server } = {}) => { action={ <>