diff options
| author | BigCoke233 <hi@guhub.cn> | 2026-01-31 11:54:13 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2026-01-31 11:54:13 +0800 |
| commit | 4af5aa75478d89530f87bd5f10de8ca761e6e54b (patch) | |
| tree | 57c63dcaab0cb96285057c29fc67ff084de1e84d /layouts/_partials | |
| parent | 419061bf4a92a15d2ae3c96cd5d0439e4dd29739 (diff) | |
feat: save instance domain in local storage
Former-commit-id: 8c50d887c92822ac202a49a92613f883296ebcf9
Diffstat (limited to 'layouts/_partials')
| -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'); } |
