Destination instances and file type routes: duplicate any uploader (incl. custom uploaders) and route uploads by extension
Problem
Most built-in uploaders support only one configuration. For example, you cannot have one Amazon S3 configuration for images and another for other files. Routing is also limited to fixed image / text / file categories, so users cannot send videos to one service and other files to another, even though both are "file" uploads.
Current behaviour (from the code)
UploadersConfigstores a single settings object per built-in uploader, e.g.public AmazonS3Settings AmazonS3Settings { get; set; }(ShareX.UploadersLib/UploadersConfig.cs).- The uploader service always uses that object:
AmazonS3NewFileUploaderService.CreateUploaderreturnsnew AmazonS3(config.AmazonS3Settings)(ShareX.UploadersLib/FileUploaders/AmazonS3.cs). - Routing is hard-coded:
TaskSettings.ImageDestination,ImageFileDestination,TextDestination,TextFileDestination,FileDestination(enums only). A specific configuration cannot be referenced, and images, videos and other files that go through the file uploader cannot be split. - Only FTP (
FTPAccountList+FTPSelectedImage/Text/File) and custom uploaders (CustomUploadersList+Custom*Selected) allow multiple entries, and both are still tied to the fixed categories. - Custom uploaders can be duplicated (
CustomUploaderSettingsViewModel.DuplicateSelected), but the per-task override (TaskSettings.CustomUploaderIndex) is one index shared by every category.
Target scenarios
| Scenario | Routes |
|---|---|
| A | PNG → Imgur, JPG → TinyPic, Videos → Dropbox, Everything else → Amazon S3 |
| B | Images → Amazon S3 "Media", Videos → Cloudflare R2, Everything else → Dropbox |
| C (default, today's behaviour) | Images → Imgur, Text → Pastebin, Everything else → Dropbox |
Proposal
1. Destination instances
- Any uploader (built-in or custom) can be added multiple times as a named instance with a stable
Id(GUID),Name, uploader type and its own settings, e.g. "S3 Media", "S3 Backups", "R2 Videos". - Actions: Add, Duplicate, Rename, Remove. Duplicating deep-clones settings, including credentials.
- Each instance declares the file types it can accept (e.g. Imgur: Images; Pastebin: Text; S3/R2/Dropbox/FTP/custom uploaders: All files). This only filters which instances can be picked for a route.
2. File types
- Premade file types (like today's categories): Images, Videos, Audio, Text, Documents, Archives, and Other files (catch-all, always last).
- Users can create custom file types from extensions, e.g. "PNG" =
png, "JPG" =jpg, jpeg. - Users can split a premade type by adding a custom type for part of it. More specific types win (see matching rules).
3. Routes (replaces image / text / file destinations)
A route maps one file type to one active instance. The route list is the user's upload routing table.
Default routes after migration:
Images → Imgur
Text → Pastebin
Other files → DropboxScenario A:
PNG → Imgur
JPG → TinyPic
Videos → Dropbox
Other files → Amazon S3Scenario B:
Images → S3 Media
Videos → R2 Videos
Other files → DropboxMatching rules when a file is uploaded:
- A route for a custom file type that lists the exact extension wins.
- Otherwise the premade file type that contains the extension.
- Otherwise Other files. This route always exists and cannot be removed.
- Clipboard text and text uploads use the
.txtextension (or the configured text format) and follow the same rules. - Clipboard images and screenshots use the configured image format extension (e.g.
png), so the PNG route in scenario A catches screenshots.
URL shortener and URL sharing service stay as separate single selections because they take a URL, not a file.
4. Main window and tray menu
The Destinations menu is built from the route list instead of fixed image/text/file items. Each route is a submenu with a radio list of compatible instances.
Destinations ▸
├ PNG ▸ ◉ Imgur
│ ○ S3 Media
│ ○ Dropbox
├ JPG ▸ ◉ TinyPic
│ ○ Imgur
├ Videos ▸ ◉ Dropbox
│ ○ R2 Videos
├ Other files ▸ ◉ Amazon S3
│ ○ Dropbox
├──────────────
├ URL shortener ▸ ...
├ Sharing service▸ ...
├──────────────
├ Add route...
└ Destination settings...- Only instances whose accepted file types match the route are listed. Imgur is not offered for Videos or Other files.
- The submenu label shows the current instance (e.g.
Videos: Dropbox) so the active routing is visible at a glance. - Add route... opens a small dialog: pick a premade or custom file type, then pick an instance.
- The main window toolbar "Destinations" button opens the same menu.
5. Destination settings window
Two tabs:
- Instances: list of instances with Add / Duplicate / Rename / Remove and the settings editor for the selected instance.
- Routes: table with columns File type, Extensions, Instance. Rows can be added, edited and removed (except Other files). Includes the file type editor for custom types.
6. Per task / hotkey overrides
- Task settings show the same Routes table with a Use default option per row, and let a hotkey add routes of its own.
- Example: a "Screen recording" hotkey overrides only Videos → R2 Videos and inherits everything else.
- Replaces
TaskSettings.ImageDestination/TextDestination/FileDestination/...andCustomUploaderIndex.
7. After capture / before upload windows
- Show the route that will be used for the file (e.g.
PNG → Imgur) and allow picking another compatible instance for that one upload.
8. Custom uploaders
- Custom uploaders are instances in the same model. Their accepted file types come from their
DestinationType(image / text / file) and can be narrowed by the user.
9. Migration
- Convert each existing settings object into a default instance. FTP accounts and custom uploaders become instances.
- Create routes from current settings:
ImageDestination→ Images route (orImageFileDestinationinstance when image destination is "File uploader").TextDestination→ Text route (orTextFileDestination).FileDestination→ Other files route.FTPSelectedImage/Text/FileandCustom*Selectedmap to the matching FTP or custom uploader instance on those routes.
- Existing configurations must behave exactly as before.
Acceptance criteria
- Any uploader, including custom uploaders, can be duplicated into named instances
- Instances declare accepted file types, used to filter route choices
- Premade file types plus user-defined custom file types by extension
- Route list replaces image/text/file destinations, with the matching rules above and a permanent Other files route
- Scenarios A, B and C can be configured
- Tray and main window Destinations menu built from routes, one submenu per route
- Destination settings window with Instances and Routes tabs
- Per task / hotkey route overrides with Use default
- Automatic migration with no behaviour change
- Upload history records the route and instance used
Source: ShareX/ShareX