Skip to content

feat(upload): add voided.host uploaders with shared config and settings UI#480

Open
Lixqa wants to merge 1 commit into
SnapXL:developfrom
Lixqa:develop
Open

feat(upload): add voided.host uploaders with shared config and settings UI#480
Lixqa wants to merge 1 commit into
SnapXL:developfrom
Lixqa:develop

Conversation

@Lixqa
Copy link
Copy Markdown

@Lixqa Lixqa commented May 22, 2026

Preface

SnapX did not have a built-in voided.host destination. voided.host supports image, text, and file uploads through one shared upload key, so adding it means implementing shared upload logic rather than three unrelated uploaders.

This change adds voided.host as a first-class SnapX uploader with encrypted config, AOT-friendly JSON parsing, and Avalonia settings UI.

Description of Change

Adds voided.host as a built-in uploader for image, text, and file destinations.

Core (SnapX.Core):

  • Adds VoidedHost to ImageDestination, TextDestination, and FileDestination
  • Adds VoidedHostUploadKey (encrypted) and VoidedHostUseGuest to UploadersConfig
  • Implements VoidedHostUploader (images) with shared VoidedHostMultipartUploader and VoidedHostResponseParser
  • Implements VoidedHostTextUploader (pastes) and VoidedHostFileUploader (files)
  • Registers all three services in UploaderFactory
  • Adds UniversalUploaders to UploaderCategory for settings navigation
  • Adds [voided.host] debug logging for upload requests and API responses (status code, body preview, parse errors)

UI (SnapX.Avalonia):

  • Adds a Universal uploaders section under Destinations with a single voided.host settings page instead of three duplicate entries
  • Adds VoidedHostUploaderSettingsView for guest mode, upload key, and links to register or manage keys
  • Wires the settings view in BuiltInUploaderSettingsView for all three voided.host uploader types

Uploads use multipart requests to api.voided.host with Authorization header auth, optional guest mode, and structured JSON error handling.

Possible Alternatives

Separate settings pages per destination type: rejected because voided.host uses one upload key for images, pastes, and files. Three pages would duplicate the same controls.

Single uploader class for all three types: rejected to stay consistent with SnapX's existing pattern of separate image, text, and file services, while sharing logic through VoidedHostMultipartUploader.

Implementation Details

Upload logic lives in VoidedHostMultipartUploader, which all three uploaders delegate to with different API URLs:

Image: https://api.voided.host/v2/images
Text: https://api.voided.host/v2/pastes
File: https://api.voided.host/v2/files

Multipart fields use p=snapx, v=1, and a timestamp. Guest mode is enabled when VoidedHostUseGuest is true and a guest API key is present in the build.

Settings are grouped under Universal uploaders because the configuration is destination-agnostic. voided.host still appears separately in the image, text, and file destination pickers when choosing where to upload.

Notes

  • Guest upload depends on GuestUploadApiKey being set at build time. If it is empty, guest mode is disabled in the UI and CheckConfig requires a personal upload key.
  • Debug logs use the [voided.host] prefix and include HTTP status codes and truncated response bodies to help diagnose API issues.
  • UploaderFactory.cs was updated manually. Regenerating via the build tool will re-include the new services automatically.

Tested on

  • Windows — Version: 10.0.19045
  • Linux — Distro & Version: N/A
  • macOS — Version: N/A
  • FreeBSD (optional) — Details: N/A

@github-actions github-actions Bot added Avalonia Related to SnapX.Avalonia Core Related to SnapX.Core labels May 22, 2026
@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 22 critical · 3 high · 16 medium · 3 minor

Alerts:
⚠ 44 issues (≤ 0 issues of at least minor severity)

Results:
44 new issues

Category Results
Compatibility 4 medium
BestPractice 7 medium
ErrorProne 20 critical
1 high
Security 2 critical
2 high
CodeStyle 3 minor
Complexity 5 medium

View in Codacy

🟢 Metrics 100 complexity · 8 duplication

Metric Results
Complexity 100
Duplication 8

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Avalonia Related to SnapX.Avalonia Core Related to SnapX.Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant