This commit is contained in:
Mateusz Gruszczyński
2026-09-17 13:17:37 +02:00
parent 6d0b9a225f
commit a6efa52f78
5 changed files with 3 additions and 20 deletions
Generated
+1 -1
View File
@@ -2581,7 +2581,7 @@ dependencies = [
[[package]] [[package]]
name = "rustpad" name = "rustpad"
version = "0.2.76" version = "0.2.77"
dependencies = [ dependencies = [
"argon2", "argon2",
"aws-config", "aws-config",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rustpad" name = "rustpad"
version = "0.2.76" version = "0.2.77"
edition = "2024" edition = "2024"
rust-version = "1.94" rust-version = "1.94"
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL" description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
-2
View File
@@ -346,8 +346,6 @@
"editor.connectionError": "Editor connection error", "editor.connectionError": "Editor connection error",
"editor.connectionInterrupted": "Connection interrupted", "editor.connectionInterrupted": "Connection interrupted",
"editor.connectionPersistent": "The live connection is still unavailable. Automatic reconnect continues.", "editor.connectionPersistent": "The live connection is still unavailable. Automatic reconnect continues.",
"editor.interfaceError": "Interface error",
"editor.interfaceError.message": "An interface error occurred. Connection status is monitored separately.",
"editor.copyOpen": "Copy its link and open it in a new tab", "editor.copyOpen": "Copy its link and open it in a new tab",
"editor.copyThisLink": "Copy this link", "editor.copyThisLink": "Copy this link",
"editor.currentLocation": "Current location", "editor.currentLocation": "Current location",
-2
View File
@@ -346,8 +346,6 @@
"editor.connectionError": "Błąd połączenia edytora", "editor.connectionError": "Błąd połączenia edytora",
"editor.connectionInterrupted": "Połączenie przerwane", "editor.connectionInterrupted": "Połączenie przerwane",
"editor.connectionPersistent": "Połączenie na żywo nadal jest niedostępne. Automatyczne ponowne łączenie trwa.", "editor.connectionPersistent": "Połączenie na żywo nadal jest niedostępne. Automatyczne ponowne łączenie trwa.",
"editor.interfaceError": "Błąd interfejsu",
"editor.interfaceError.message": "Wystąpił błąd interfejsu. Stan połączenia jest monitorowany niezależnie.",
"editor.copyOpen": "Skopiuj link i otwórz go w nowej karcie", "editor.copyOpen": "Skopiuj link i otwórz go w nowej karcie",
"editor.copyThisLink": "Kopiuj ten link", "editor.copyThisLink": "Kopiuj ten link",
"editor.currentLocation": "Bieżąca lokalizacja", "editor.currentLocation": "Bieżąca lokalizacja",
+1 -14
View File
@@ -52,7 +52,7 @@ export function startNoteEditor(adapter) {
: `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`; : `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;
const collaboration = new CollaborationSession(collaborationClientId); const collaboration = new CollaborationSession(collaborationClientId);
let accessToken = shareToken || getAccessToken(adapter.access.kind, adapter.access.key), password = "", nickname = getNickname(), info, socket, saveTimer, applyingRemote = false, applyingHistory = false, resourceUnlocked = false, uiState = readEditorState(), authorship = parseAuthorship("", "[]"), previousContent = "", globalColor = "", noteColor = "", presenceUsers = [], authorshipMode = "simple", authorshipColorsEnabled = true, lastRevealedLineHash = "", flushRequested = false, accountSession = null; let accessToken = shareToken || getAccessToken(adapter.access.kind, adapter.access.key), password = "", nickname = getNickname(), info, socket, saveTimer, applyingRemote = false, applyingHistory = false, resourceUnlocked = false, uiState = readEditorState(), authorship = parseAuthorship("", "[]"), previousContent = "", globalColor = "", noteColor = "", presenceUsers = [], authorshipMode = "simple", authorshipColorsEnabled = true, lastRevealedLineHash = "", flushRequested = false, accountSession = null;
let editorSettingsSaveTimer, editorSettingsSaveInFlight = false, pendingPersonalSettingsSave = false, pendingAuthorshipSettingsSave = false, connectionNoticeTimer = 0, connectionWasInterrupted = false, frontendErrorToastAt = 0; let editorSettingsSaveTimer, editorSettingsSaveInFlight = false, pendingPersonalSettingsSave = false, pendingAuthorshipSettingsSave = false, connectionNoticeTimer = 0, connectionWasInterrupted = false;
let pendingPreviewViewport = null; let pendingPreviewViewport = null;
const editHistory = { const editHistory = {
entries: [], entries: [],
@@ -420,17 +420,6 @@ export function startNoteEditor(adapter) {
} }
setStatus("connecting", t("status.connecting", {}, "Connecting...")); setStatus("connecting", t("status.connecting", {}, "Connecting..."));
} }
function notifyFrontendError() {
const now = Date.now();
if (now - frontendErrorToastAt < 30000) return;
frontendErrorToastAt = now;
try {
toast.warning(
t("editor.interfaceError.message", {}, "An interface error occurred. Connection status is monitored separately."),
{ title: t("editor.interfaceError", {}, "Interface error"), duration: 6500 },
);
} catch { }
}
function updateAddressLabel() { document.querySelector(adapter.addressSelector).textContent = `${location.pathname}${location.search}`; } function updateAddressLabel() { document.querySelector(adapter.addressSelector).textContent = `${location.pathname}${location.search}`; }
let mermaidRenderVersion = 0; let mermaidRenderVersion = 0;
async function renderMermaid() { async function renderMermaid() {
@@ -2372,7 +2361,5 @@ export function startNoteEditor(adapter) {
const historyPanel = document.querySelector("#history-panel"); document.querySelector("#history-button").addEventListener("click", async () => { if (info?.protected && !resourceUnlocked) { if (!passwordDialog.open) passwordDialog.showModal(); document.querySelector("#open-password")?.focus(); return; } historyPanel.classList.add("open"); historyPanel.setAttribute("aria-hidden", "false"); document.body.classList.add("history-open"); const list = document.querySelector("#history-list"); list.innerHTML = '<p class="empty">Loading…</p>'; try { const revisions = await adapter.loadHistory(accessToken); list.innerHTML = revisions.length ? revisions.map((r, i) => { const snippet = escapeHtml(r.content.trim().split("\n").slice(0, 3).join(" · ").slice(0, 150) || "Empty note"); const author = r.author || "Unknown author"; return `<article class="revision"><span class="revision__marker" style="--owner:${colorFor(author)}"></span><div><div class="revision__meta"><strong>${escapeHtml(author)}</strong><time>${formatDate(r.created_at)}</time></div><p class="revision__snippet">${snippet}</p><button data-preview="${r.id}">Preview</button><button data-revision="${r.id}">Restore</button><div class="revision__preview" id="preview-${r.id}" hidden></div></div></article>`; }).join("") : '<p class="empty">No history yet.</p>'; for (const r of revisions) { list.querySelector(`[data-preview="${r.id}"]`)?.addEventListener("click", () => { const el = list.querySelector(`#preview-${r.id}`); el.hidden = !el.hidden; el.textContent = r.content; }); list.querySelector(`[data-revision="${r.id}"]`)?.addEventListener("click", async () => { await adapter.restoreRevision(r.id, accessToken); toast.success("The selected revision is now the current version.", { title: "Version restored" }); }); } } catch (e) { list.innerHTML = `<p class="error">${escapeHtml(e.message)}</p>`; toast.danger(e.message, { title: "Could not load version history" }); } }); document.querySelector("#close-history").addEventListener("click", () => { historyPanel.classList.remove("open"); historyPanel.setAttribute("aria-hidden", "true"); document.body.classList.remove("history-open"); }); const historyPanel = document.querySelector("#history-panel"); document.querySelector("#history-button").addEventListener("click", async () => { if (info?.protected && !resourceUnlocked) { if (!passwordDialog.open) passwordDialog.showModal(); document.querySelector("#open-password")?.focus(); return; } historyPanel.classList.add("open"); historyPanel.setAttribute("aria-hidden", "false"); document.body.classList.add("history-open"); const list = document.querySelector("#history-list"); list.innerHTML = '<p class="empty">Loading…</p>'; try { const revisions = await adapter.loadHistory(accessToken); list.innerHTML = revisions.length ? revisions.map((r, i) => { const snippet = escapeHtml(r.content.trim().split("\n").slice(0, 3).join(" · ").slice(0, 150) || "Empty note"); const author = r.author || "Unknown author"; return `<article class="revision"><span class="revision__marker" style="--owner:${colorFor(author)}"></span><div><div class="revision__meta"><strong>${escapeHtml(author)}</strong><time>${formatDate(r.created_at)}</time></div><p class="revision__snippet">${snippet}</p><button data-preview="${r.id}">Preview</button><button data-revision="${r.id}">Restore</button><div class="revision__preview" id="preview-${r.id}" hidden></div></div></article>`; }).join("") : '<p class="empty">No history yet.</p>'; for (const r of revisions) { list.querySelector(`[data-preview="${r.id}"]`)?.addEventListener("click", () => { const el = list.querySelector(`#preview-${r.id}`); el.hidden = !el.hidden; el.textContent = r.content; }); list.querySelector(`[data-revision="${r.id}"]`)?.addEventListener("click", async () => { await adapter.restoreRevision(r.id, accessToken); toast.success("The selected revision is now the current version.", { title: "Version restored" }); }); } } catch (e) { list.innerHTML = `<p class="error">${escapeHtml(e.message)}</p>`; toast.danger(e.message, { title: "Could not load version history" }); } }); document.querySelector("#close-history").addEventListener("click", () => { historyPanel.classList.remove("open"); historyPanel.setAttribute("aria-hidden", "true"); document.body.classList.remove("history-open"); });
const deleteNoteButton = document.querySelector("#delete-note"); if (deleteNoteButton && adapter.deleteNote) deleteNoteButton.addEventListener("click", async () => { try { await adapter.deleteNote(info, accessToken); } catch (error) { toast.danger(error.message, { title: "Could not delete note" }); } }); const deleteNoteButton = document.querySelector("#delete-note"); if (deleteNoteButton && adapter.deleteNote) deleteNoteButton.addEventListener("click", async () => { try { await adapter.deleteNote(info, accessToken); } catch (error) { toast.danger(error.message, { title: "Could not delete note" }); } });
window.addEventListener("error", () => notifyFrontendError());
window.addEventListener("unhandledrejection", () => notifyFrontendError());
initialize(); initialize();
} }