16colo-rs / 16c

16colo.rs ANSI/ASCII Archive
5 stars 1 forks source link

Open in editor #43

Open andyherbert opened 4 years ago

andyherbert commented 4 years ago

Theoretically I can register uri handler so a button on the page pointing to, for example moebius://fetch/16colo.rs/pack/... could direct Moebius to fetch the uri and open it directly in the editor, although this would mean on the Windows side registering a protocol handler which apparently requires one of those 'this application needs to make changes' security popup when the application is installed (and therefore unavailable in the portable version).

andyherbert commented 4 years ago

Apparently there's a reliable cross platform way to detect if a protocol has a handler (which seems a minor security issue), so people unable to use the feature presumably wouldn't need to know about it.

bart-d commented 4 years ago

Apparently there's a reliable cross platform way to detect if a protocol has a handler (which seems a minor security issue), so people unable to use the feature presumably wouldn't need to know about it.

what exactly is this reliable cross platform way to detect if a protocol has a handler?

andyherbert commented 4 years ago

I'm only basing that on a very superficial google search and judging the reliability from comments to solutions.

bart-d commented 4 years ago

what if we avoid the protocol handler and use a custom mimetype like eg application/vnd.moebius, do you have a way of registering that with the browser upon installation?

andyherbert commented 4 years ago

It appears that Electron Builder has a method of registering mime-types as part of the linux app bundle specifically, I think it only has a provision for registering file associations based on the filename extension. There's no mention on how registering a mime type on Linux changes the behaviour of apps that recognise the mime-type.

bart-d commented 4 years ago

i was thinking yesterday about a totally different way of handling this while avoiding URL hanlders and MIME types: we could constrauct a .ans which contains the location of the file to download. a capable editor would parse the URL and not show this 'placeholder' ansi and directly fetch the referenced .ans from 16c. a non-capable editor would open the .ans where we have some generic info display along the URL to inform the user his editor can't handle it.

andyherbert commented 4 years ago

We could be talking past each other here because wouldn’t an ansi have to be loaded in an editor for that to work? I meant that there’s a button on a webpage saying ‘load in editor’ you click it and the editor fetches it. Sort of like the opposite of a paste service.

bart-d commented 4 years ago

Yes, but both Moebius and PD register as default for opening files of certain extensions, so that part is already covered. but i realize now, that sort of already works. when i click the filename i get offered open or save. choosing open will open it in Moebius anyway.

andyherbert commented 4 years ago

I see now that we're talking about different things. I meant circumventing the need to download a file, you click a link on the page, the app appears frontmost and fetches the ansi from the site. There's no saving to disk, or having to open manually.