diff options
| -rw-r--r-- | layouts/_partials/posts/fediverse-form.html | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html index 6d545088..f9998d1d 100644 --- a/layouts/_partials/posts/fediverse-form.html +++ b/layouts/_partials/posts/fediverse-form.html @@ -7,13 +7,19 @@ </div> <script> +const instanceInput = document.getElementById('fediverse-instance') +const savedInstance = localStorage.getItem("geedeapro.fediInstance") +if (savedInstance) instanceInput.value = savedInstance + function openInFediverse() { - const instance = document.getElementById('fediverse-instance').value.trim(); + const instance = instanceInput.value.trim(); const tootUrl = '{{ .Params.toot }}'; let url = tootUrl if (instance) { url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl); + // save instance url to localStorage + localStorage.setItem("geedeapro.fediInstance", instance) } window.open(url, '_blank'); } |
