DropletURLRequest
A URL Droppy received on a droplet's behalf.
struct DropletURLRequest
Droppy owns the droppy:// scheme. Any app, script or web page can open droppy://droplet/<id>/<path>?<query>, and Droppy hands it to the running droplet with that id, as one of these. The id is matched case-insensitively and the droplet has to be installed and switched on; anything else is dropped without a trace, because the scheme is reachable by everything on the Mac.
This is how a droplet that drives another app gets an answer back: it asks with the other app's own scheme and names one of these URLs as the callback (thaw://get?key=all&callback=droppy://droplet/thaw/settings), and the reply arrives here. Treat the payload as untrusted input: check a request id you generated, bound the size, and never run anything a URL tells you to.
Initializers
init(parsing:)
init?(parsing url: URL)
Parses a droppy://droplet/<id>/<path>?<query> URL, or returns nil when the URL is not addressed to a droplet at all.
Percent-encoding in the path and the query is decoded; a query item repeated keeps its first value. Nothing here validates the id against an installed droplet; that is the host's decision.
init(url:dropletID:path:query:)
init(url: URL, dropletID: String, path: String, query: [String : String])
Creates a request. Hosts and the harness build these; a droplet only reads them.
Properties
dropletID
let dropletID: String
The droplet id the URL named, as written.
path
let path: String
The path after the id, without a leading slash: settings for droppy://droplet/thaw/settings, empty when there is none.
query
let query: [String : String]
The query, decoded, first value per name. Names are case-sensitive.
url
let url: URL
The URL exactly as it was opened.