Skip to content

Enhance Streamtape driver with upload features and comprehensive tests#9460

Merged
okatu-loli merged 9 commits intoAlistGo:mainfrom
xiaoqingwanga:streamtape
Mar 30, 2026
Merged

Enhance Streamtape driver with upload features and comprehensive tests#9460
okatu-loli merged 9 commits intoAlistGo:mainfrom
xiaoqingwanga:streamtape

Conversation

@xiaoqingwanga
Copy link
Copy Markdown
Contributor

Summary

This PR significantly enhances the Streamtape driver in alist with remote upload support, five new Other API methods, SHA256 upload verification, and comprehensive unit tests. A total of +429 lines across 5 files.

Changes

1. drivers/streamtape/types.go — New Response Types

Added structured types for the new API responses:

  • remoteDlAddResult — result of initiating a remote upload
  • remoteDlStatusResult / remoteDlStatusItem — remote download status tracking (bytes loaded/total, status, timestamps)
  • fileInfoResult / fileInfoItem — file metadata (name, size, type, conversion status)
  • conversionResult / conversionItem — video conversion progress (name, folder, status, progress, retries, link)

2. drivers/streamtape/util.go — Remote Upload ID Helpers

Added encoding/decoding for remote upload object IDs:

  • remoteUploadPrefix = "ru:" — prefixed ID scheme to distinguish remote uploads from regular files
  • encodeRemoteUploadID(id) / remoteUploadIDFromObjID(id) / isRemoteUploadID(id)

3. drivers/streamtape/driver.go — Core Implementation (+143 lines)

  • PutURL — Initiates a remote file download from an external URL via /remotedl/add, returns a tracked ru:<id> object

  • Other method dispatches to 5 new sub-methods:

    • remotedl_status — query progress of a remote upload via /remotedl/status
    • remotedl_remove — cancel/remove a remote upload via /remotedl/remove
    • file_info — retrieve file metadata via /file/info
    • thumbnail — get video thumbnail/splash URL via /file/getsplash
    • conversion_status — query running or failed video conversions via /file/runningconverts or /file/failedconverts
  • SHA256 upload supportSha256 parameter passed to /file/ul endpoint for integrity verification

  • Helper extractRemoteUploadID — shared logic for extracting upload ID from object ID or request data map

  • Improved Move — now returns a clear error when attempting to move files to root (since Streamtape API doesn't support it), instead of silently failing

4. drivers/streamtape/meta.go — Configuration Updates

  • Added Sha256 field (optional) to Addition config for upload hash verification
  • Added Alert: "warning|Moving files to root folder is not supported by Streamtape API" to warn users attempting root moves

5. drivers/streamtape/api_test.go — Comprehensive Unit Tests (+224 lines)

  • TestDriverList — lists root folder contents, verifies objects returned
  • TestDriverPutURL — full flow: initiate remote upload → extract upload ID → check status → remove upload
  • TestDriverFileInfo — drills into subfolders to find a file, calls file_info via Other
  • TestDriverThumbnail — retrieves thumbnail URL for a file via Other
  • TestDriverConversionStatus — queries both running and failed conversion queues

Test Plan

  • go test ./drivers/streamtape/... — all new tests pass
  • Remote upload flow (PutURL → remotedl_status → remotedl_remove)
  • File listing and navigation
  • Thumbnail and file_info queries
  • Conversion status queries (running + failed)
  • SHA256 upload parameter integration
  • Move-to-root warning alert trigger

xiaoqingwanga and others added 9 commits March 28, 2026 13:27
… remotedl_remove, file_info, thumbnail, conversion_status
- Initialize RestyClient with custom settings for testing
- Add TestDriverList to verify listing folders and files
- Add TestDriverPutURL to test remote upload functionality and status checks
- Add TestDriverFileInfo to validate file_info method via Other call
- Add TestDriverThumbnail to test thumbnail retrieval via Other call
- Add TestDriverConversionStatus to test conversion status queries (running and failed)
@okatu-loli okatu-loli merged commit 2f903c4 into AlistGo:main Mar 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants