Improve Calckey, Misskey, and Elk support

This commit is contained in:
Corbin Davenport 2023-07-10 02:39:08 -04:00
parent 3c638fe3fb
commit 36378cd25b
3 changed files with 9 additions and 5 deletions

View File

@ -2,7 +2,9 @@
Share to Mastodon is a browser extension for quickly sharing links and tabs to the [Mastodon social network](https://joinmastodon.org/). You can click the Mastodon button in the top bar (or the keyboard shortcut) to share the current tab, or right-click a link on any page. You can also select text and pick Mastodon in the context (right-click) menu to share a snippet. Share to Mastodon is a browser extension for quickly sharing links and tabs to the [Mastodon social network](https://joinmastodon.org/). You can click the Mastodon button in the top bar (or the keyboard shortcut) to share the current tab, or right-click a link on any page. You can also select text and pick Mastodon in the context (right-click) menu to share a snippet.
The extension can store multiple server options, and synchronize them with your browser. It works with any Mastodon server, and it uses the share dialog hosted by the selected server, so no API access is required. The browser extension can store multiple server options, and synchronize them with your browser's settings. It uses the share dialog hosted by the selected server, so no API access or account permissions are required.
Share to Mastodon is compatible with any Mastodon server, as well as platforms that have implemented Mastodon's share URL scheme, such as [Calckey](https://calckey.org/) and [Misskey](https://join.misskey.page/en-US/). It also works with the [Elk](https://elk.zone/) Mastodon web client.
**[Download for Google Chrome](https://chrome.google.com/webstore/detail/bibnjflclpdmbbcncejifemmbggkcjde)** **[Download for Google Chrome](https://chrome.google.com/webstore/detail/bibnjflclpdmbbcncejifemmbggkcjde)**

View File

@ -1,11 +1,13 @@
// Function to generate URL // Function to generate URL
function getFinalURL(domain, text, link) { function getFinalURL(domain, text, link) {
var url = '' var url = ''
if (domain === 'elk.zone') { if ((domain === 'elk.zone') || (domain === 'main.elk.zone')) {
// Elk web app // Elk web app
url = 'https://elk.zone/intent/post?text=' + encodeURIComponent(text + '<br /><br />' + link) url = 'https://elk.zone/intent/post?text=' + encodeURIComponent(text + '<br /><br />' + link)
} else { } else {
// Standard Mastodon URL intent // Standard Mastodon URL intent, also used by Calckey, Misskey, and other projects
// Misskey documentation: https://misskey-hub.net/en/docs/features/share-form.html
// Calckey implementation: https://codeberg.org/calckey/calckey/src/branch/main/packages/backend/src/server/web/manifest.json#:~:text=share_target
url = 'https://' + domain + '/share?text=' + encodeURIComponent(text + '\n\n' + link) url = 'https://' + domain + '/share?text=' + encodeURIComponent(text + '\n\n' + link)
} }
return url return url
@ -53,7 +55,7 @@ async function init() {
linkEl.rel = 'preconnect' linkEl.rel = 'preconnect'
// Add server icon to list // Add server icon to list
var serverImg = document.createElement('img') var serverImg = document.createElement('img')
if (serverUrl === 'elk.zone') { if ((serverUrl === 'elk.zone') || (serverUrl === 'main.elk.zone')) {
serverImg.setAttribute('src', chrome.runtime.getURL('img/elk.png')) serverImg.setAttribute('src', chrome.runtime.getURL('img/elk.png'))
} else { } else {
serverImg.setAttribute('src', 'https://' + serverUrl + '/favicon.ico') serverImg.setAttribute('src', 'https://' + serverUrl + '/favicon.ico')

View File

@ -33,7 +33,7 @@
<input type="text" class="form-control" id="mastodon-server-text" placeholder="yourserver.social" aria-label="Server domain" aria-describedby="server-help"> <input type="text" class="form-control" id="mastodon-server-text" placeholder="yourserver.social" aria-label="Server domain" aria-describedby="server-help">
<button class="btn btn-outline-primary" type="button" id="server-add-btn">Add</button> <button class="btn btn-outline-primary" type="button" id="server-add-btn">Add</button>
</div> </div>
<div id="server-help" class="form-text">Mastodon forks or alternative servers, like Wildebeest or PixelFed, may not be compatible.</div> <div id="server-help" class="form-text">This must be a server running <a href="https://joinmastodon.org/" target="_blank">Mastodon</a>, <a href="https://calckey.org/" target="_blank">Calckey</a>, <a href="https://join.misskey.page/en-US/" target="_blank">Misskey</a>, or another compatible social media platform.</div>
<!-- Server select --> <!-- Server select -->
<div class="mt-3 mb-1"> <div class="mt-3 mb-1">
<label for="mastodon-server-list" class="form-label">Saved servers</label> <label for="mastodon-server-list" class="form-label">Saved servers</label>