Brazen Framework - Download Manager

Cross-tab download queue, resolution pipeline, and immediate downloads for Brazen user scripts

Seznam verzí skriptu, při kterých došlo ke změnám v kódu. Zobrazit všechny verze.

  • v1.1.0 16. 07. 2026

    [1.1.0] — current

    Added

    • Start in Selection Mode — flag OPTION_DOWNLOAD_SELECTION_MODE_DEFAULT (download-selection-mode-default, default off). When on, selection mode activates on load for pages with the selection role (still toggleable from the dock for the visit). Apps place createElement(OPTION_DOWNLOAD_SELECTION_MODE_DEFAULT) at the top of the Downloads settings tab.

    [1.0.1]

    Fixed

    • Human-interaction panel before verification window — show #bv-human-interaction-panel on the processor-leader tab before window.open, with force so a focus-steal does not skip the panel. Returning to the leader still restores via visibility as before.
  • v1.0.0 15. 07. 2026

    Added

    • BrazenDownloadManager — dual IndexedDB queues (resolution + download), cross-tab processors with initiation gaps, ledger claim at download time, downloadImmediate() and batch enqueue, optional tag discovery panel, dock controls (selection, enqueue, start/pause, clear, progress).
    • Path/token helpers moved from BrazenFramework (buildDownloadPathFromPatterns, substitution parsing, GM_download wrapper).
    • resolver.tagRuntime — when warmed, _joinTagsForDownloadPath applies ignore/substitution via registry attributes instead of string Set/Map.
    • Tag discovery — pattern-relevant types only for the review panel (no scan-all fallback); dock counter/progress omit resolution queue while discovery mode is on; confirm promotes seen types to typeEntryId.
    • Always register path tags_registerResolvedTagGroups on resolution and immediate download regardless of discovery toggle. Discovery onsource: 'media' (seen-only); discovery offsource: 'resolution' (page types confirmed as typeEntryId). Extract helpers stay read-only.
    • Download queue idle after batch — when pending downloads hit 0, paused is set back to true so the next batch waits for Start instead of auto-running.
    • Start/pause fixgetPendingPipelineCount() counts both queues so the play button works when tag discovery hides resolution items from the dock counter.
    • Resolution auto-runpaused applies to the download queue only; resolution runs on enqueue without manual start.
    • Human-interaction rate limitshumanInteractionBlocked state; processor-leader tab shows #bv-human-interaction-panel (dock slide panel) after opening the verification tab. timedReload returns retry and re-fetches in the same resolution attempt so a post-429 Cloudflare page escalates to human interaction.
    • Dock progress slot — download-queue only (current/total from progress.download); hidden while the download queue is empty (resolution-only work uses per-item progress on search tiles). Border matches --bv-dock-btn-bg, no inset background; counters always visible when the slot is shown.
    • Tag discovery panel — Skip / Open media / Confirm on one footer row; shows new tags then known tags (typed/color groups) with incidence counts beside actions; Skip drops the resolution item without confirming types. Reload / tab focus restores the panel when review is still pending. Play slide-out (clear + progress) opens only when the download queue has items. Config/action refreshes update panel content in place without replaying the slide-in animation. Maps framework tag-attribute actions internally (appendTagAttributeActions); consumer supplies tagDiscovery.actions incidence options only.
    • Processor UI cadence — resolution/download queue and DM state puts no longer broadcast dock/panel rebuilds. One UI reset runs at the end of each resolution or download task (_onResolutionTaskComplete / _onDownloadTaskComplete); full _syncFromStorage remains for tab focus / init only.
    • Processor leadership recoveryprocessingHeartbeatAt + stale lock steal (~12s); pagehide releases the lock; interrupted resolving/downloading items are requeued so refresh does not orphan the pipeline.
    • ledgerClaimed on download queue rows — reserve the duplicate ledger once per item; lock-steal requeues no longer re-claim and false-skip as “already downloaded”.
    • Ledger hits — queue status duplicate (selection progress label Duplicate, no alert); silent skip for immediate downloads aside from optional media restore.
    • Start/pause vs resolution — Start/Pause is disabled (and no-ops) when the download queue is empty so resolution-only work cannot be toggled; queued downloads show Ready, not Paused. Progress counters reset when both queues are idle so a new resolve no longer inherits stale completedDownloadCount (e.g. looking like 5 items after queuing 1).
    • Clear download queue — clears the download queue only (plus download-context human-interaction blocks). No longer wipes resolution, stops processors, hides tag discovery, or blanks selection marks / item progress for resolution work.
    • Ledger claim when Hide is on_shouldClaimDownloadDuplicateLedger(); download id falls back to item.itemId when the payload id is missing.
    • Skip Duplicate Downloads dock template — Framework applies applyDockTemplate('skipDuplicates') at ledger init. Download Manager only setDockSlideOut([hide-downloaded-media]) (and backfills hideDownloaded template if the hide field has no dock yet). Apps order the enable key on the rail; they do not redefine the button body.

    Fixed

    • _resolvePage — attaches a parsed Document on HTTP 4xx / transport fail rejects so rateLimitHandlers (site 429 HTML and Cloudflare challenge bodies) can detect and escalate instead of failing as a blind network error.
    • Duplicate resolution fetches_runProcessors took its in-tab lock only after an await, so enqueue + _syncFromStorage (and concurrent void starts) could run two loops over the same queued item. Lock is now synchronous; items are claimed queuedresolving/downloading before work; _syncFromStorage no longer auto-starts processors (callers / tab-focus do).
    • Start after refresh — processor leadership lived only in IndexedDB; pagehide release often never finished, so a fresh tab could not reclaim for ~12s (stale heartbeat). Start flipped paused but _runProcessors exited without leadership. Sync localStorage lock mirror is cleared on unload so leadership can be stolen immediately after refresh; concurrent _runProcessors kicks wake the running loop instead of being dropped.
    • Cloudflare as timedReload_handleRateLimit ran timedReload first and treated any HTTP status === 429 as auto-retry, so Cloudflare CAPTCHA bodies that arrive as 429 were re-fetched forever instead of escalating to humanInteraction. Human detect now runs first; timed reload matches only via its document detect.
    • Human-interaction prompt on every tab — confirm dialog was claimable by any visible tab (humanInteractionPromptTabId unset until dialog open, cleared on “Not yet”). Prompt is pinned to the processor tab at block time and only shown when processingTabId is this tab, so the verification tab does not get the dialog.
    • Human-interaction UI — dock slide panel (createHumanInteractionPanel); Done — resume / Reopen verification tab footer; no mouseleave auto-hide. Verification tabs opened by the queue stay silent (brazen_hi + localStorage mirror).
    • isDownloadManagerLeaderTab() — true when this tab owns processingTabId (for unload warnings and other leader-only UI).
    • Download initiation pacing — in-tab initiation clocks + serialized state patches so heartbeat/progress puts cannot wipe lastDownloadInitiationAt; gap applied immediately before GM_download.
    • Selection-item live progress — after queue puts stopped notifying Configuration Manager, search tiles no longer updated on claim (queuedresolving/downloading). Refresh progress immediately after claim; _refreshSelectionMarks re-tracks selected tiles so processor updates find them.
  • v1.0.0 15. 07. 2026