Fixed mastodon checkbox on new entry page

This commit is contained in:
2026-08-27 22:08:30 +02:00
parent 1c2d1b71ff
commit d433a305f5
10 changed files with 65 additions and 6 deletions
+17 -1
View File
@@ -9,6 +9,7 @@
const commentInput = document.getElementById('comment-input');
const newTagsInput = document.getElementById('new-tags-input');
const existingTagsEl = document.getElementById('existing-tags');
const mastodonPublishing = document.getElementById('mastodon-publishing');
const mastodonEnabledCheckbox = document.getElementById('mastodon-enabled');
const scrapeButton = document.getElementById('scrape-button');
const scrapeStatus = document.getElementById('scrape-status');
@@ -46,7 +47,7 @@
.then((user) => {
currentUser = user;
entryForm.classList.remove('hidden');
loadTags();
Promise.all([loadTags(), loadMastodonPublishing()]);
})
.catch(() => {
localStorage.removeItem('linklogAccessToken');
@@ -66,6 +67,20 @@
}
}
async function loadMastodonPublishing() {
try {
const response = await fetch('/api/user/plugins/mastodon', {
headers: { Authorization: `Bearer ${token}` },
});
if (!response.ok) return;
const config = await response.json();
mastodonEnabledCheckbox.checked = Boolean(config.configured);
mastodonPublishing.classList.toggle('hidden', !config.configured);
} catch (error) {
console.error('Could not load Mastodon configuration:', error);
}
}
// Render tag checkboxes
function renderTags() {
existingTagsEl.innerHTML = '';
@@ -171,6 +186,7 @@
url,
comment,
tags,
post_to_mastodon: mastodonEnabledCheckbox.checked,
}),
});
+4
View File
@@ -1006,6 +1006,10 @@ button:disabled {
gap: 8px;
}
.form-section.hidden {
display: none;
}
.form-section label {
display: grid;
gap: 6px;