diff --git a/priv/static/instance/web-protocol-register.html b/priv/static/instance/web-protocol-register.html new file mode 100644 index 000000000..35faa428c --- /dev/null +++ b/priv/static/instance/web-protocol-register.html @@ -0,0 +1,61 @@ + + + + + + + + Web-based Protocol Registration (web+ap://) + + + + + + + + + + + + + + +
+

Web-based protocol registration

+

+ Web-based protocols are a type of URL protocol that your browser can learn how to open. +

+

+ Like mailto: or magnet: links, they are opened by an application of your choice. Unlike mailto: or magnet:, they are not recognized by the browser by default, and need to be registered. See MDN for more information. +

+

+ web+ap:// links describe an ActivityPub resource address, so that you can open a user profile or a particular post from a remote server, without visiting that server. They will open directly here on your home server instead. +

+

+ For example, the URL web+ap://seafoam.space/users/m would open the profile of @m@seafoam.space, as it is shown locally on this server. +

+ +

+ To register this server application to handle web+ap URLs, click below. +
You will be prompted to approve - check for a dialog up near your browser URL bar. +
+

+
+ + + + \ No newline at end of file diff --git a/priv/static/instance/web-protocol-register.js b/priv/static/instance/web-protocol-register.js new file mode 100644 index 000000000..94ffdc803 --- /dev/null +++ b/priv/static/instance/web-protocol-register.js @@ -0,0 +1,16 @@ +(function () { + function registerHandler() { + try { + navigator.registerProtocolHandler( + "web+ap", + `${window.origin}/.well-known/protocol-handler?target=%s`, + "Akkoma web+ap handler", + ) + } catch (e) { + console.error("Could not register", e) + window.alert("Sorry, your browser does not support web-based protocol handler registration.") + } + } + + document.getElementById("register").addEventListener("click", registerHandler); +}()); \ No newline at end of file