feat(service_qbittorrent): add execution logs tab and fix filter drawer gesture scoping - #159
Merged
Merged
Conversation
The tabs sit in an IndexedStack, which builds every tab when the screen opens, so the Logs tab fetched qBittorrent's whole log on each visit to the screen, whether or not anyone looked at it. Seen through a proxy in front of a live qBittorrent: opening the screen on the Home tab requested /api/v2/log/main. qBittorrent keeps up to 20,000 entries, and a full log came to about 2 MB of JSON. The Logs tab is now built the first time it is selected and kept after that, so its filter, search and scroll position are still there when you come back to it.
qBittorrent keeps up to 20,000 log entries. With a live server holding that many, Copy put 1.3 MB of text on the clipboard, Android refused it with a TransactionTooLargeException, and the app still said "Copied 20000 log entries to clipboard". Nothing had been copied, so pasting gave whatever was on the clipboard before. Copy now takes the newest entries that fit in 100,000 characters, keeps them in the order they happened, and says when it left older ones out. Both copy actions wait for the clipboard and say so when the platform refuses. The button's tooltip no longer promises all logs, since it copies what the filter and search leave.
The timestamp comment called milliseconds the format and seconds the one older versions send. It is the other way round: qBittorrent's API documentation says the log switched from milliseconds to seconds in 4.5.0, and a live 5.2.3 sends seconds. The code already reads both, but a reader trusting the comment could drop the branch that every current server needs.
…utes The Advanced settings pickers for the network interface and the address to bind to never listed anything. The client asked for app/networkInterfacesList and app/networkInterfaceAddressesList, which qBittorrent does not have: on a live 5.2.3 both answer 404, and the routes are networkInterfaceList and networkInterfaceAddressList. The client caught the failure and returned an empty list, so the pickers only offered their built-in choices and nothing looked wrong. The address route also needs its iface parameter even when it is empty. Without it qBittorrent answers 400, and an empty value is how every address is asked for, which is what the default "Any interface" needs. It is now always sent.
Owner
|
Nice one, the Logs tab is a good add. Drawer fix works on device too, and reading both seconds and milliseconds was smart, since qBittorrent switched to seconds in 4.5.0. I pushed four commits. Most of it only showed up once I pointed it at a log with 20,000 entries in it:
Two I left for you:
Analyzer is clean, tests pass, release build still reproducible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an Execution Logs tab to
service_qbittorrentand fixes an issue where the right-edge drawer gesture remained active on non-home tabs.The bottom navigation bar order is now:
Key Changes
1. Gesture Scoping Fix
QbittorrentHomeunconditionally attachedQbittorrentFilterDraweras theendDraweron the outerScaffoldwithendDrawerEnableOpenDragGesture: true. Swiping right-to-left while in the Settings tab opened the torrent filter drawer.endDrawerandendDrawerEnableOpenDragGestureare now strictly enabled only when on the Home tab (currentIndex == 0), preventing unwanted drawer opens on Settings and Logs.2. Logs API Integration & Model
QbitLogEntry: Represents log items fromGET /api/v2/log/main(id,message,timestamp,type), withQbitLogLevelenum (normal,info,warning,critical) and local time formatting (HH:mm:ss).QbittorrentClient.getLogs: Callsapi/v2/log/mainsupporting severity filters (normal,info,warning,critical) andlast_known_id.qbitLogsProvider: Auto-disposing Riverpod provider fetching logs for a given instance.3. Logs Tab UI
2(Home->Settings->Logs).Icons.menu).Icons.copy_all_outlined).Icons.refresh).All,Normal,Info,Warning, andCritical._TorrentTilefrom the home screen:Materialsurface card (cs.surfaceContainerHigh) withBorderRadius.circular(20)andInsets.mdpadding.borderRadius: BorderRadius.circular(14)using semantic level container colors._StatePill) with 15% opacity tint andBorderRadius.circular(20).EasyRefreshpull-to-refresh and responds to bottom nav tap scroll-to-top (qbitHomeScrollToTopProvider).