Skip to content

ostrich/plasma-share-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plasma Share Uploader

Create custom upload targets for the KDE Plasma 6 Share menu. New targets are user-definable in JSON; no code modification required. Catbox and Uguu included by default.

Screenshot

License

GPL-3.0-or-later.

Build

cmake -S . -B build
cmake --build build

Install

cmake --install build

Plugins install to the Purpose plugin directory (${KDE_INSTALL_QTPLUGINDIR}/kf6/purpose). Restart Dolphin/Gwenview/other Purpose-Share-enabled app after installing so the new Share action shows up.

Targets

Targets live in targets.json. Each entry generates its own Share plugin at configure time. After editing targets.json, re-run the configure step (cmake -S . -B build) so plugins are regenerated. Additional example targets are available in targets.sample.json for reference when adding new services.

Adding a new target

Each target entry is an object inside the targets array. Required fields:

  • id: lowercase identifier used for plugin names; [a-z0-9][a-z0-9_-]*.
  • displayName: human-friendly name shown in Share menus.
  • description: short description for plugin metadata.
  • icon: icon name (e.g. image-x-generic).
  • request: upload configuration (see below).
  • response: how to extract the URL from the server response.

Optional fields:

  • pluginTypes: Purpose plugin types (defaults to ["ShareUrl"]).
  • constraints: Purpose constraints (e.g. ["mimeType:image/*"]).

Request formats

request includes:

  • url: upload endpoint URL. Supports ${ENV:VAR} substitution.
  • method: HTTP method. POST for multipart; POST or PUT for raw uploads.
  • type (optional): multipart (default) or raw.

Multipart uploads:

  • request.type: multipart (or omitted).
  • request.multipart.fileField: form field name for the file.
  • request.multipart.fields: optional extra form fields (string values only).

Raw uploads:

  • request.type: raw.
  • request.url may include ${FILENAME} to inject the local file name (e.g. transfer.sh).
  • request.contentType: optional Content-Type to set for the file body.

Headers:

  • request.headers: object of header name -> value (string values only), values support ${ENV:VARNAME} substitution.

Response formats

response must include a type:

  • text_url: response body is the URL.
  • regex: use pattern and optional group to extract URL from response text.
  • json_pointer: use pointer (must start with /) to locate a string URL in a JSON response.

Example

{
  "id": "example",
  "displayName": "ExampleHost",
  "description": "Upload images to ExampleHost",
  "icon": "image-x-generic",
  "pluginTypes": ["ShareUrl", "Export"],
  "constraints": ["mimeType:image/*"],
  "request": {
    "url": "https://example.com/upload",
    "method": "POST",
    "multipart": {
      "fields": {
        "token": "${ENV:EXAMPLE_TOKEN}"
      },
      "fileField": "file"
    }
  },
  "response": {
    "type": "json_pointer",
    "pointer": "/data/url"
  }
}

About

Create custom upload targets for the KDE Plasma 6 Share menu

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors