gitea
This commit is contained in:
1 parent
cc97754ae6
commit
86508ffcca
13 files changed
+945
-35
No files matched your search
@@ -95,6 +95,8 @@
|
||||
getPostProcessors() {
|
||||
return postProcessors.slice();
|
||||
},
|
||||
// Filled in by core markdown.js after load
|
||||
render: null,
|
||||
};
|
||||
|
||||
// ── Util helpers (mirror of internal util.js) ───────────────────
|
||||
|
||||
@@ -120,9 +120,31 @@ export async function loadSettings() {
|
||||
}
|
||||
|
||||
|
||||
function setCaldavTestStatus(text, kind = 'info') {
|
||||
if (!testStatus) return;
|
||||
if (!text) {
|
||||
testStatus.classList.add('hidden');
|
||||
testStatus.textContent = '';
|
||||
testStatus.style.borderColor = '';
|
||||
testStatus.style.color = '';
|
||||
return;
|
||||
}
|
||||
testStatus.classList.remove('hidden');
|
||||
testStatus.textContent = text;
|
||||
if (kind === 'error') {
|
||||
testStatus.style.borderColor = 'var(--t-danger)';
|
||||
testStatus.style.color = 'var(--t-danger)';
|
||||
} else if (kind === 'success') {
|
||||
testStatus.style.borderColor = 'var(--t-accent)';
|
||||
testStatus.style.color = 'var(--t-accent)';
|
||||
} else {
|
||||
testStatus.style.borderColor = 'var(--t-border)';
|
||||
testStatus.style.color = 'var(--t-muted)';
|
||||
}
|
||||
}
|
||||
|
||||
$('caldav-test')?.addEventListener('click', async () => {
|
||||
testStatus.textContent = 'testing...';
|
||||
testStatus.style.color = 'var(--t-dim)';
|
||||
setCaldavTestStatus('testing...');
|
||||
const body = { url: urlInput.value, username: userInput.value };
|
||||
if (passInput.value) body.password = passInput.value;
|
||||
const res = await fetch('api/caldav/test', {
|
||||
@@ -132,12 +154,10 @@ $('caldav-test')?.addEventListener('click', async () => {
|
||||
|
||||
if (res.ok) {
|
||||
const names = (res.calendars || []).map(c => c.name).join(', ');
|
||||
testStatus.textContent = `connected (${names || 'no calendars'})`;
|
||||
testStatus.style.color = 'var(--t-accent)';
|
||||
setCaldavTestStatus(`connected (${names || 'no calendars'})`, 'success');
|
||||
if (res.calendars) renderCalList(res.calendars);
|
||||
} else {
|
||||
testStatus.textContent = res.error || 'failed';
|
||||
testStatus.style.color = 'var(--t-danger)';
|
||||
setCaldavTestStatus(res.error || 'failed', 'error');
|
||||
}
|
||||
showConnectionLog(res.log);
|
||||
});
|
||||
|
||||
@@ -168,6 +168,11 @@ export function renderMd(src) {
|
||||
return html;
|
||||
}
|
||||
|
||||
// Expose to plugins via the hyprcrd API
|
||||
if (typeof window !== 'undefined' && window.hyprcrd?.markdown) {
|
||||
window.hyprcrd.markdown.render = renderMd;
|
||||
}
|
||||
|
||||
export function addCodeCopyButtons(container) {
|
||||
if (!container) return;
|
||||
container.querySelectorAll('pre > code').forEach(code => {
|
||||
|
||||
Reference in new issue
Block a user