summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2026-01-31 11:26:27 +0800
committerBigCoke233 <hi@guhub.cn>2026-01-31 11:26:27 +0800
commit419061bf4a92a15d2ae3c96cd5d0439e4dd29739 (patch)
tree1ec21bffb58bf50d7f1a84f239a2febdbfe483da /layouts
parentf690db7c13830d6732a2d64ee33b5342f4c93e8e (diff)
refactor: open source if no instance url provided
Former-commit-id: 276f4ef417b81a6c48d09f6c19bc51e1bcb82597
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_partials/posts/fediverse-form.html20
1 files changed, 4 insertions, 16 deletions
diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html
index 6c4fce6a..6d545088 100644
--- a/layouts/_partials/posts/fediverse-form.html
+++ b/layouts/_partials/posts/fediverse-form.html
@@ -9,24 +9,12 @@
<script>
function openInFediverse() {
const instance = document.getElementById('fediverse-instance').value.trim();
- {{ with .Params.toot }}
- const tootUrl = '{{ . }}';
- {{ else }}
- const tootUrl = '';
- {{ end }}
+ const tootUrl = '{{ .Params.toot }}';
- if (!instance) {
- alert('Please enter your Fediverse instance URL');
- return;
+ let url = tootUrl
+ if (instance) {
+ url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl);
}
-
- if (!tootUrl) {
- alert('No toot available for this post');
- return;
- }
-
- // Open the toot interaction page on the user's instance
- const url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl);
window.open(url, '_blank');
}
</script>