@alexsun-top/opencode-chat-room 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +12 -5
- package/README.zh-CN.md +12 -5
- package/cli.ts +26 -6
- package/dist/cli.js +7804 -0
- package/package.json +19 -6
- package/plugin.ts +7 -4
- package/server/admin-auth.ts +1 -1
- package/server/admin-routes.ts +2 -2
- package/server/admin-state.ts +2 -1
- package/server/assets/FLUENT-ICONS-LICENSE +25 -0
- package/server/assets/NOTICE.txt +2 -1
- package/server/assets/attachments.css +1 -1
- package/server/assets/base.css +29 -7
- package/server/assets/chat/admin.js +43 -3
- package/server/assets/chat/announcements.js +5 -3
- package/server/assets/chat/confirm-dialog.js +12 -2
- package/server/assets/chat/create-room-dialog.js +5 -3
- package/server/assets/chat/events.js +32 -7
- package/server/assets/chat/files.js +369 -0
- package/server/assets/chat/history-loader.js +36 -26
- package/server/assets/chat/icons.js +15 -0
- package/server/assets/chat/index.js +7 -1
- package/server/assets/chat/locales/de.js +19 -2
- package/server/assets/chat/locales/es.js +19 -2
- package/server/assets/chat/locales/fr.js +19 -2
- package/server/assets/chat/locales/it.js +19 -2
- package/server/assets/chat/locales/ja.js +19 -2
- package/server/assets/chat/locales/ko.js +19 -2
- package/server/assets/chat/markdown.js +5 -33
- package/server/assets/chat/message-polling.js +61 -6
- package/server/assets/chat/message-window.js +28 -0
- package/server/assets/chat/messages.js +32 -12
- package/server/assets/chat/palette.js +396 -0
- package/server/assets/chat/pwa.js +67 -9
- package/server/assets/chat/recall.js +3 -2
- package/server/assets/chat/replies.js +2 -1
- package/server/assets/chat/rooms.js +20 -7
- package/server/assets/chat/search.js +137 -0
- package/server/assets/chat/settings.js +11 -5
- package/server/assets/chat/shortcuts.js +1 -1
- package/server/assets/chat/state.js +38 -4
- package/server/assets/code-highlight.css +0 -5
- package/server/assets/conversation.css +5 -4
- package/server/assets/edit-room.css +77 -0
- package/server/assets/files.css +222 -0
- package/server/assets/fluent-icons.svg +42 -0
- package/server/assets/icons.css +9 -0
- package/server/assets/palette.css +263 -0
- package/server/assets/recall.css +2 -2
- package/server/assets/responsive.css +6 -5
- package/server/assets/room-create.css +1 -1
- package/server/assets/settings.css +10 -7
- package/server/chat-server.ts +46 -29
- package/server/chat.html +175 -61
- package/server/http-server.ts +182 -0
- package/server/join-requests.ts +4 -4
- package/server/manifest.webmanifest +1 -1
- package/server/member-routes.ts +3 -3
- package/server/message-recall-routes.ts +1 -1
- package/server/newrooms.ts +4 -4
- package/server/resource-routes.ts +19 -4
- package/server/room-join.ts +1 -1
- package/server/room-payload.ts +1 -1
- package/server/sw.js +12 -1
- package/server/wake.ts +1 -1
- package/src/README.md +4 -2
- package/src/config/file-config.ts +294 -0
- package/src/rooms/resource-read.ts +2 -1
- package/src/rooms/resource-upload.ts +6 -3
- package/src/rooms/resources.ts +7 -2
- package/src/runtime/watch.ts +13 -8
- package/src/state/receiver-state.ts +3 -5
- package/src/state/sqlite-state.ts +11 -7
- package/src/state/sqlite.ts +80 -0
- package/src/state/store.ts +1 -0
- package/src/tui/app.mjs +417 -0
- package/src/tui/config.mjs +194 -0
- package/src/tui/http.mjs +103 -0
- package/src/tui/main.mjs +176 -0
- package/src/tui/messages.mjs +67 -0
- package/src/tui/palette-app.mjs +265 -0
- package/src/tui/palette.mjs +101 -0
- package/src/tui/session.mjs +40 -0
- package/src/tui/ui-content.mjs +426 -0
- package/src/tui/ui-theme.mjs +60 -0
- package/src/tui/ui-view.mjs +452 -0
- package/src/tui/ui.mjs +262 -0
- package/src/tests/announcement-board.ts +0 -186
|
@@ -26,7 +26,7 @@ export const fr = {
|
|
|
26
26
|
tokenPlaceholder: "À remplir si le serveur l’exige", save: "Enregistrer",
|
|
27
27
|
tokenHint: "Si le serveur exige un jeton d’accès (401), toutes les requêtes l’incluront.",
|
|
28
28
|
existingRooms: "Salons", noRooms: "Aucun salon pour l’instant. Créez-en un.", copyRoomId: "Copier l’identifiant du salon", loadingHistory: "Chargement des messages précédents",
|
|
29
|
-
editRoom: "Modifier le salon", roomOwnerOnlyTitle: "Propriétaire ou administrateur uniquement", roomOwnerOnlyNote: ({ owner }) => `Seuls le propriétaire ou un administrateur du salon peuvent modifier ces réglages. Ce salon appartient à ${owner}.`, roomNameLabel: "Nom du salon", roomDescriptionLabel: "Description", adminAgentLabel: "Agent administrateur", roomOwnerBadge: "Propriétaire", roomAdminBadge: "Admin",
|
|
29
|
+
editRoom: "Modifier le salon", editRoomSections: "Sections de modification du salon", editRoomDetails: "Détails du salon", editRoomJoining: "Adhésion et approbation", editRoomMembers: "Membres et rôles", editRoomOwnership: "Propriété", roomOwnerOnlyTitle: "Propriétaire ou administrateur uniquement", roomOwnerOnlyNote: ({ owner }) => `Seuls le propriétaire ou un administrateur du salon peuvent modifier ces réglages. Ce salon appartient à ${owner}.`, roomNameLabel: "Nom du salon", roomDescriptionLabel: "Description", adminAgentLabel: "Agent administrateur", roomOwnerBadge: "Propriétaire", roomAdminBadge: "Admin",
|
|
30
30
|
adminIdsLabel: "Administrateurs humains", adminIdsHint: "Ces membres peuvent modifier les détails du salon, gérer les membres, supprimer des fichiers et choisir un successeur. Le propriétaire dispose toujours des mêmes droits.", adminIdsEmpty: "Aucun autre membre dans ce salon pour l’instant.", newOwnerLabel: "Nouveau propriétaire", newOwnerHint: "Transmettez le salon à une autre personne qui en fait partie. Seul le propriétaire peut le faire ; les agents ne peuvent pas posséder un salon.",
|
|
31
31
|
successorLabel: "Successeur si le propriétaire part", successorNone: "Membre présent depuis le plus longtemps", successorHint: "Si le propriétaire part, cette personne devient propriétaire. Si un administrateur part, cette personne reprend ce rôle. Laissez vide pour utiliser le membre présent depuis le plus longtemps.", ownerOnlySettingsNote: "Seul le propriétaire peut changer l’agent administrateur ou céder le salon.", adminAgentHint: "L’agent désigné peut utiliser l’outil d’administration pour consulter ce salon et son historique. Seul le propriétaire peut modifier ceci ; laissez vide pour aucun.",
|
|
32
32
|
noAdminAgent: "Aucun", openQuestions: ({ count }) => `${count} question${count > 1 ? "s" : ""} sans réponse`,
|
|
@@ -44,6 +44,7 @@ export const fr = {
|
|
|
44
44
|
reminderCreated: "Rappel créé.", reminderUpdated: "Rappel mis à jour.", reminderDeleted: "Rappel supprimé.",
|
|
45
45
|
reminderInvalid: "Vérifiez la date, l’expression CRON à 5 champs, le fuseau IANA et le texte du rappel.", reminderLoadFailed: "Impossible de charger les rappels. Votre brouillon est toujours là.",
|
|
46
46
|
diagramLoading: "Rendu du diagramme…", diagramRenderFailed: "Diagramme indisponible, affichage de sa source.", resourceLoading: "Chargement du fichier…", resourceFailed: "Impossible de charger ce fichier.", resourceDownload: "Télécharger", resourceMoreActions: "Plus d’actions pour {name}", resourcePreview: "Aperçu", resourceHide: "Masquer l’aperçu", zoomImage: "Ouvrir l’image", imagePreviewTitle: "Aperçu de l’image", imageZoomControls: "Zoom de l’image", zoomIn: "Zoom avant", zoomOut: "Zoom arrière", zoomReset: "Réinitialiser le zoom", installTitle: "Installer OC Chat", installBody: "Ajoutez-le à votre écran d’accueil pour discuter en plein écran.", installAction: "Installer", installHow: "Comment installer", installNotNow: "Plus tard", installIosGuide: "Touchez Partager, puis Ajouter à l’écran d’accueil.",
|
|
47
|
+
pwaUpdateTitle: "Mise à jour disponible", pwaUpdateBody: "Une nouvelle version est prête. Rechargez maintenant ou mettez à jour à la prochaine ouverture de l’application.", pwaUpdateNow: "Mettre à jour", pwaUpdateLater: "Plus tard",
|
|
47
48
|
announcementDelete: "Supprimer l’annonce",
|
|
48
49
|
announcementNew: "Nouvelle annonce", announcementEmpty: "Aucune annonce pour l’instant.", announcementLoading: "Chargement des annonces…",
|
|
49
50
|
announcementLoadFailed: "Impossible de charger les annonces. Votre brouillon est toujours là.", announcementSaved: "Annonce enregistrée.", announcementDeleted: "Annonce supprimée.",
|
|
@@ -78,10 +79,25 @@ export const fr = {
|
|
|
78
79
|
shortcutsTitle: "Raccourcis clavier", shortcutsLead: "Raccourcis de ChatRoom. Appuyez sur {modifier} + / pour ouvrir cette liste.",
|
|
79
80
|
shortcutsOpen: "Tous les raccourcis",
|
|
80
81
|
shortcutsWriting: "Rédaction", shortcutsSend: "Envoyer le message", shortcutsNewline: "Passer à la ligne",
|
|
81
|
-
shortcutsMention: "Choisir un membre à mentionner", shortcutsRooms: "Salons",
|
|
82
|
+
shortcutsMention: "Choisir un membre à mentionner", shortcutsRooms: "Salons", shortcutsSearch: "Recherche et commandes", shortcutsOpenPalette: "Ouvrir la recherche et les commandes",
|
|
82
83
|
shortcutsSwitchRoom: "Passer au salon précédent ou suivant", shortcutsNumberRoom: "Passer à un salon rejoint par son numéro", shortcutsReading: "Lecture",
|
|
83
84
|
shortcutsScroll: "Faire défiler les messages pendant la saisie", shortcutsJump: "Aller au début ou à la fin de la conversation", shortcutsMenus: "Menus et boîtes de dialogue",
|
|
84
85
|
shortcutsClose: "Fermer le menu, le panneau ou la boîte de dialogue ouverts",
|
|
86
|
+
paletteTitle: "Recherche et commandes", paletteSearchLabel: "Rechercher des messages",
|
|
87
|
+
palettePlaceholder: "Rechercher des messages, ou > pour les commandes", paletteScopeRoom: "Ce salon", paletteScopeAll: "Tous les salons",
|
|
88
|
+
paletteScopeHint: "Tab bascule entre ce salon et tous les salons rejoints", paletteSearchMode: "Recherche", paletteCommandMode: "Commandes",
|
|
89
|
+
paletteSearching: "Recherche…", paletteNoResults: "Aucun message trouvé.", paletteNoCommands: "Aucune commande correspondante.",
|
|
90
|
+
paletteResults: ({ count }) => `${count} résultat${count === 1 ? "" : "s"}`, paletteCommandsHint: "Commandes courantes",
|
|
91
|
+
paletteHint: "↑↓ ou Alt+1–9 sélectionner · Entrée ouvrir · Tab portée · Échap fermer", paletteSearchFailed: "La recherche a échoué. Réessayez.",
|
|
92
|
+
paletteLeaveRoom: "Quitter le salon", paletteJumpLatest: "Aller au plus récent",
|
|
93
|
+
filesTitle: "Fichiers", filesEyebrow: "Fichiers du salon", filesFilter: "Envoyé par", filesEveryone: "Tout le monde",
|
|
94
|
+
filesUnknownUploader: "Envoyeur inconnu", filesSummary: ({ count, size }) => `${count} fichier${count === 1 ? "" : "s"} · ${size}`,
|
|
95
|
+
filesLoading: "Chargement des fichiers…", filesLoadFailed: "Impossible de charger les fichiers. Réessayez.", filesEmpty: "Ce salon n’a pas encore de fichiers.",
|
|
96
|
+
filesEmptyFiltered: "Aucun fichier de cet envoyeur.", filesLoadMore: "Charger plus",
|
|
97
|
+
filesHint: "Prévisualisez les images, l’audio et la vidéo. Tous les fichiers peuvent être téléchargés.",
|
|
98
|
+
filesPreviewFailed: "Impossible de charger cet aperçu.", filesDownloadFailed: "Impossible de télécharger ce fichier.",
|
|
99
|
+
filesPreviewLabel: ({ name }) => `Aperçu de ${name}`, filesDownloadLabel: ({ name }) => `Télécharger ${name}`,
|
|
100
|
+
filesDeleteLabel: ({ name }) => `Supprimer ${name}`, filesRefresh: "Actualiser les fichiers",
|
|
85
101
|
earlierMessages: "Messages précédents omis", messagesBetweenOmitted: "Les messages entre ce point de lecture et les derniers sont omis.", you: "Vous", saved: "Enregistré",
|
|
86
102
|
savedMemory: "Enregistré pour cet onglet uniquement", copyFailed: ({ id }) => `Copie impossible. Copiez manuellement : ${id}`,
|
|
87
103
|
copyMessage: "Copier", copiedMessage: "Copié", copyMessageFailed: "Copie impossible. Sélectionnez et copiez le message manuellement.", wrapCode: "Retour à la ligne",
|
|
@@ -103,6 +119,7 @@ export const fr = {
|
|
|
103
119
|
roomsMenu: "Ouvrir la liste des salons", closeRoomList: "Fermer la liste des salons",
|
|
104
120
|
direct: "Direct", messagePrivately: "Envoyer un message privé", removeMember: "Retirer",
|
|
105
121
|
kickConfirm: ({ name }) => `Retirer ${name} de ce salon ? Cette personne pourra le rejoindre à nouveau avec l’identifiant.`,
|
|
122
|
+
leaveRoomConfirm: ({ name }) => `Quitter «\u00A0${name}\u00A0» ? Vous allez quitter ce salon ; vous pourrez le rejoindre plus tard avec son identifiant.`,
|
|
106
123
|
deleteRoom: "Supprimer le salon", deleteConfirm: ({ name }) => `Supprimer «\u00A0${name}\u00A0» et tous ses messages ? Cette action est irréversible.`,
|
|
107
124
|
allMembers: "Tout le monde", messageCount: ({ count }) => `${count} / 5000`,
|
|
108
125
|
pasteAsFile: ({ count }) => `${count} caractères collés enregistrés dans un fichier texte`,
|
|
@@ -26,7 +26,7 @@ export const it = {
|
|
|
26
26
|
tokenPlaceholder: "Inseriscilo se il server lo richiede", save: "Salva",
|
|
27
27
|
tokenHint: "Se il server richiede un token di accesso (401), tutte le richieste lo includeranno.",
|
|
28
28
|
existingRooms: "Stanze", noRooms: "Nessuna stanza. Creane una.", copyRoomId: "Copia ID stanza", loadingHistory: "Caricamento dei messaggi precedenti",
|
|
29
|
-
editRoom: "Modifica stanza", roomOwnerOnlyTitle: "Solo proprietario o amministratore", roomOwnerOnlyNote: ({ owner }) => `Solo il proprietario della stanza o un amministratore possono modificare queste impostazioni. Questa stanza appartiene a ${owner}.`, roomNameLabel: "Nome della stanza", roomDescriptionLabel: "Descrizione", adminAgentLabel: "Agent amministratore", roomOwnerBadge: "Proprietario", roomAdminBadge: "Amministratore",
|
|
29
|
+
editRoom: "Modifica stanza", editRoomSections: "Sezioni di modifica della stanza", editRoomDetails: "Dettagli della stanza", editRoomJoining: "Accesso e approvazione", editRoomMembers: "Membri e ruoli", editRoomOwnership: "Proprietà", roomOwnerOnlyTitle: "Solo proprietario o amministratore", roomOwnerOnlyNote: ({ owner }) => `Solo il proprietario della stanza o un amministratore possono modificare queste impostazioni. Questa stanza appartiene a ${owner}.`, roomNameLabel: "Nome della stanza", roomDescriptionLabel: "Descrizione", adminAgentLabel: "Agent amministratore", roomOwnerBadge: "Proprietario", roomAdminBadge: "Amministratore",
|
|
30
30
|
adminIdsLabel: "Amministratori umani", adminIdsHint: "Questi membri possono modificare i dettagli della stanza, gestire i membri, eliminare i file e scegliere un successore. Il proprietario ha sempre gli stessi poteri.", adminIdsEmpty: "Non ci sono ancora altri membri in questa stanza.", newOwnerLabel: "Nuovo proprietario", newOwnerHint: "Passa la stanza a un’altra persona presente. Solo il proprietario può farlo; gli Agent non possono possedere una stanza.",
|
|
31
31
|
successorLabel: "Successore se il proprietario lascia", successorNone: "Membro più anziano", successorHint: "Se il proprietario lascia, questa persona diventa proprietario. Se un amministratore lascia, questa persona assume il ruolo. Lascia vuoto per usare il membro più anziano.", ownerOnlySettingsNote: "Solo il proprietario può cambiare l’Agent amministratore o cedere la stanza.", adminAgentHint: "L’Agent designato può usare lo strumento di amministrazione per esaminare questa stanza e la sua cronologia. Solo il proprietario può cambiarlo; lascia vuoto per nessuno.",
|
|
32
32
|
noAdminAgent: "Nessuno", roomNameRequired: "Inserisci il nome della stanza", openQuestions: ({ count }) => `${count} domanda${count === 1 ? "" : "e"} senza risposta`,
|
|
@@ -44,6 +44,7 @@ export const it = {
|
|
|
44
44
|
reminderCreated: "Promemoria creato.", reminderUpdated: "Promemoria aggiornato.", reminderDeleted: "Promemoria eliminato.",
|
|
45
45
|
reminderInvalid: "Controlla la data, l’espressione CRON a 5 campi, il fuso orario IANA e il testo del promemoria.", reminderLoadFailed: "Impossibile caricare i promemoria. La tua bozza è ancora qui.",
|
|
46
46
|
diagramLoading: "Rendering del diagramma…", diagramRenderFailed: "Diagramma non disponibile; viene mostrato il codice sorgente.", resourceLoading: "Caricamento del file…", resourceFailed: "Impossibile caricare questo file.", resourceDownload: "Scarica", resourceMoreActions: "Altre azioni per {name}", resourcePreview: "Anteprima", resourceHide: "Nascondi anteprima", zoomImage: "Apri immagine", imagePreviewTitle: "Anteprima immagine", imageZoomControls: "Zoom immagine", zoomIn: "Ingrandisci", zoomOut: "Riduci", zoomReset: "Reimposta zoom", installTitle: "Installa OC Chat", installBody: "Aggiungilo alla schermata Home per una chat a schermo intero.", installAction: "Installa", installHow: "Come installare", installNotNow: "Non ora", installIosGuide: "Tocca Condividi, poi Aggiungi alla schermata Home.",
|
|
47
|
+
pwaUpdateTitle: "Aggiornamento disponibile", pwaUpdateBody: "È pronta una nuova versione. Ricarica ora o aggiorna la prossima volta che apri l’app.", pwaUpdateNow: "Aggiorna ora", pwaUpdateLater: "Più tardi",
|
|
47
48
|
announcementDelete: "Elimina annuncio",
|
|
48
49
|
announcementNew: "Nuovo annuncio", announcementEmpty: "Nessun annuncio.", announcementLoading: "Caricamento degli annunci…",
|
|
49
50
|
announcementLoadFailed: "Impossibile caricare gli annunci. La tua bozza è ancora qui.", announcementSaved: "Annuncio salvato.", announcementDeleted: "Annuncio eliminato.",
|
|
@@ -78,10 +79,25 @@ export const it = {
|
|
|
78
79
|
shortcutsTitle: "Scorciatoie da tastiera", shortcutsLead: "Scorciatoie di ChatRoom. Premi {modifier} + / per aprire questo elenco.",
|
|
79
80
|
shortcutsOpen: "Tutte le scorciatoie",
|
|
80
81
|
shortcutsWriting: "Scrittura", shortcutsSend: "Invia il messaggio", shortcutsNewline: "Vai a capo",
|
|
81
|
-
shortcutsMention: "Scegli un membro da menzionare", shortcutsRooms: "Stanze",
|
|
82
|
+
shortcutsMention: "Scegli un membro da menzionare", shortcutsRooms: "Stanze", shortcutsSearch: "Ricerca e comandi", shortcutsOpenPalette: "Apri ricerca e comandi",
|
|
82
83
|
shortcutsSwitchRoom: "Passa alla stanza precedente o successiva", shortcutsNumberRoom: "Passa a una stanza partecipata per numero", shortcutsReading: "Lettura",
|
|
83
84
|
shortcutsScroll: "Scorri i messaggi mentre scrivi", shortcutsJump: "Vai all’inizio o alla fine della conversazione", shortcutsMenus: "Menu e finestre di dialogo",
|
|
84
85
|
shortcutsClose: "Chiudi il menu, il pannello o la finestra di dialogo aperti",
|
|
86
|
+
paletteTitle: "Ricerca e comandi", paletteSearchLabel: "Cerca messaggi",
|
|
87
|
+
palettePlaceholder: "Cerca messaggi o digita > per i comandi", paletteScopeRoom: "Questa stanza", paletteScopeAll: "Tutte le stanze",
|
|
88
|
+
paletteScopeHint: "Tab alterna tra questa stanza e tutte le stanze a cui hai aderito", paletteSearchMode: "Ricerca", paletteCommandMode: "Comandi",
|
|
89
|
+
paletteSearching: "Ricerca in corso…", paletteNoResults: "Nessun messaggio trovato.", paletteNoCommands: "Nessun comando corrispondente.",
|
|
90
|
+
paletteResults: ({ count }) => `${count} risultat${count === 1 ? "o" : "i"}`, paletteCommandsHint: "Comandi frequenti",
|
|
91
|
+
paletteHint: "↑↓ o Alt+1–9 seleziona · Enter apri · Tab ambito · Esc chiudi", paletteSearchFailed: "Ricerca non riuscita. Riprova.",
|
|
92
|
+
paletteLeaveRoom: "Esci dalla stanza", paletteJumpLatest: "Vai ai più recenti",
|
|
93
|
+
filesTitle: "File", filesEyebrow: "File della stanza", filesFilter: "Caricato da", filesEveryone: "Tutti",
|
|
94
|
+
filesUnknownUploader: "Autore sconosciuto", filesSummary: ({ count, size }) => `${count} file · ${size}`,
|
|
95
|
+
filesLoading: "Caricamento dei file…", filesLoadFailed: "Impossibile caricare i file. Riprova.", filesEmpty: "Questa stanza non ha ancora file.",
|
|
96
|
+
filesEmptyFiltered: "Nessun file di questo autore.", filesLoadMore: "Carica altri",
|
|
97
|
+
filesHint: "Puoi visualizzare immagini, audio e video. Tutti i file si possono scaricare.",
|
|
98
|
+
filesPreviewFailed: "Impossibile caricare l’anteprima.", filesDownloadFailed: "Impossibile scaricare questo file.",
|
|
99
|
+
filesPreviewLabel: ({ name }) => `Anteprima di ${name}`, filesDownloadLabel: ({ name }) => `Scarica ${name}`,
|
|
100
|
+
filesDeleteLabel: ({ name }) => `Elimina ${name}`, filesRefresh: "Aggiorna i file",
|
|
85
101
|
earlierMessages: "Messaggi precedenti omessi", messagesBetweenOmitted: "I messaggi tra questo punto di lettura e i più recenti sono omessi.", you: "Tu", saved: "Salvato",
|
|
86
102
|
savedMemory: "Salvato solo per questa scheda", copyFailed: ({ id }) => `Copia non riuscita. Copia manualmente: ${id}`,
|
|
87
103
|
copyMessage: "Copia", copiedMessage: "Copiato", copyMessageFailed: "Impossibile copiare. Seleziona e copia il messaggio manualmente.", wrapCode: "Adatta il codice",
|
|
@@ -103,6 +119,7 @@ export const it = {
|
|
|
103
119
|
roomsMenu: "Apri elenco stanze", closeRoomList: "Chiudi elenco stanze",
|
|
104
120
|
direct: "Diretto", messagePrivately: "Invia messaggio privato", removeMember: "Rimuovi",
|
|
105
121
|
kickConfirm: ({ name }) => `Rimuovere ${name} da questa stanza? Può rientrare con l’ID della stanza.`,
|
|
122
|
+
leaveRoomConfirm: ({ name }) => `Uscire da «${name}»? Lascerai questa stanza; potrai rientrare più tardi con il suo ID.`,
|
|
106
123
|
deleteRoom: "Elimina stanza", deleteConfirm: ({ name }) => `Eliminare «${name}» e tutti i suoi messaggi? L’operazione non può essere annullata.`,
|
|
107
124
|
allMembers: "Tutti", messageCount: ({ count }) => `${count} / 5000`,
|
|
108
125
|
pasteAsFile: ({ count }) => `${count} caratteri incollati salvati come file di testo`,
|
|
@@ -27,7 +27,7 @@ export const ja = {
|
|
|
27
27
|
tokenPlaceholder: "サーバーが要求する場合に入力", save: "保存",
|
|
28
28
|
tokenHint: "サーバーがアクセストークンを要求する場合(401)、すべてのリクエストに含まれます。",
|
|
29
29
|
existingRooms: "ルーム", noRooms: "ルームはまだありません。作成してください。", copyRoomId: "ルーム ID をコピー", loadingHistory: "以前のメッセージを読み込み中",
|
|
30
|
-
editRoom: "ルームを編集", roomOwnerOnlyTitle: "オーナーまたは管理者のみ", roomOwnerOnlyNote: ({ owner }) => `これらの設定を変更できるのはルームのオーナーまたは管理者だけです。このルームのオーナーは ${owner} です。`, roomNameLabel: "ルーム名", roomDescriptionLabel: "説明", adminAgentLabel: "管理者 Agent", roomOwnerBadge: "オーナー", roomAdminBadge: "管理者",
|
|
30
|
+
editRoom: "ルームを編集", editRoomSections: "ルーム編集セクション", editRoomDetails: "ルーム情報", editRoomJoining: "参加と承認", editRoomMembers: "メンバーと役割", editRoomOwnership: "所有権", roomOwnerOnlyTitle: "オーナーまたは管理者のみ", roomOwnerOnlyNote: ({ owner }) => `これらの設定を変更できるのはルームのオーナーまたは管理者だけです。このルームのオーナーは ${owner} です。`, roomNameLabel: "ルーム名", roomDescriptionLabel: "説明", adminAgentLabel: "管理者 Agent", roomOwnerBadge: "オーナー", roomAdminBadge: "管理者",
|
|
31
31
|
adminIdsLabel: "人間の管理者", adminIdsHint: "これらのメンバーはルーム情報の編集、メンバー管理、ファイルの削除、後任者の指名ができます。オーナーは常に同じ権限を持ちます。", adminIdsEmpty: "このルームにはまだ他のメンバーがいません。", newOwnerLabel: "新しいオーナー", newOwnerHint: "ルームを参加中の別の人に引き渡します。オーナーのみが実行でき、Agent はオーナーになれません。",
|
|
32
32
|
successorLabel: "オーナーが退出した場合の後任", successorNone: "最も古くから参加しているメンバー", successorHint: "オーナーが退出すると、この人がオーナーになります。管理者が退出した場合は、この人がその役割を引き継ぎます。空欄の場合は最も古くから参加しているメンバーが選ばれます。", ownerOnlySettingsNote: "管理者 Agent の変更やルームの引き渡しはオーナーのみが行えます。", adminAgentHint: "指定された Agent は管理ツールでこのルームと履歴を確認できます。オーナーのみが変更でき、空欄の場合はなしになります。",
|
|
33
33
|
noAdminAgent: "なし", roomNameRequired: "ルーム名を入力してください", openQuestions: ({ count }) => `未回答の質問 ${count} 件`,
|
|
@@ -45,6 +45,7 @@ export const ja = {
|
|
|
45
45
|
reminderCreated: "リマインダーを作成しました。", reminderUpdated: "リマインダーを更新しました。", reminderDeleted: "リマインダーを削除しました。",
|
|
46
46
|
reminderInvalid: "日時、5 フィールドの CRON 式、IANA タイムゾーン、リマインダーのテキストを確認してください。", reminderLoadFailed: "リマインダーを読み込めませんでした。下書きは残っています。",
|
|
47
47
|
diagramLoading: "図を描画中…", diagramRenderFailed: "図を表示できません。ソースを表示しています。", resourceLoading: "ファイルを読み込み中…", resourceFailed: "このファイルを読み込めませんでした。", resourceDownload: "ダウンロード", resourceMoreActions: "{name} のその他の操作", resourcePreview: "プレビュー", resourceHide: "プレビューを隠す", zoomImage: "画像を開く", imagePreviewTitle: "画像プレビュー", imageZoomControls: "画像のズーム", zoomIn: "拡大", zoomOut: "縮小", zoomReset: "ズームをリセット", installTitle: "OC Chat をインストール", installBody: "ホーム画面に追加すると、全画面でチャットできます。", installAction: "インストール", installHow: "インストール方法", installNotNow: "後で", installIosGuide: "共有をタップし、「ホーム画面に追加」を選択します。",
|
|
48
|
+
pwaUpdateTitle: "アップデートがあります", pwaUpdateBody: "新しいバージョンの準備ができました。今すぐ再読み込みするか、次回起動時に更新できます。", pwaUpdateNow: "今すぐ更新", pwaUpdateLater: "後で",
|
|
48
49
|
announcementDelete: "お知らせを削除",
|
|
49
50
|
announcementNew: "新しいお知らせ", announcementEmpty: "お知らせはまだありません。", announcementLoading: "お知らせを読み込み中…",
|
|
50
51
|
announcementLoadFailed: "お知らせを読み込めませんでした。下書きは残っています。", announcementSaved: "お知らせを保存しました。", announcementDeleted: "お知らせを削除しました。",
|
|
@@ -78,10 +79,25 @@ export const ja = {
|
|
|
78
79
|
shortcutsTitle: "キーボードショートカット", shortcutsLead: "ChatRoom のショートカット。{modifier} + / でこの一覧を開きます。",
|
|
79
80
|
shortcutsOpen: "すべてのショートカット",
|
|
80
81
|
shortcutsWriting: "入力", shortcutsSend: "メッセージを送信", shortcutsNewline: "改行",
|
|
81
|
-
shortcutsMention: "メンションするメンバーを選択", shortcutsRooms: "ルーム",
|
|
82
|
+
shortcutsMention: "メンションするメンバーを選択", shortcutsRooms: "ルーム", shortcutsSearch: "検索とコマンド", shortcutsOpenPalette: "検索とコマンドを開く",
|
|
82
83
|
shortcutsSwitchRoom: "前後のルームに切り替え", shortcutsNumberRoom: "番号で参加中のルームに切り替え", shortcutsReading: "閲覧",
|
|
83
84
|
shortcutsScroll: "入力中にメッセージをスクロール", shortcutsJump: "会話の先頭または末尾に移動", shortcutsMenus: "メニューとダイアログ",
|
|
84
85
|
shortcutsClose: "開いているメニュー、パネル、ダイアログを閉じる",
|
|
86
|
+
paletteTitle: "検索とコマンド", paletteSearchLabel: "メッセージを検索",
|
|
87
|
+
palettePlaceholder: "メッセージを検索、> でコマンド", paletteScopeRoom: "このルーム", paletteScopeAll: "すべてのルーム",
|
|
88
|
+
paletteScopeHint: "Tab でこのルームと参加中のすべてのルームを切り替えます", paletteSearchMode: "検索", paletteCommandMode: "コマンド",
|
|
89
|
+
paletteSearching: "検索中…", paletteNoResults: "メッセージは見つかりませんでした。", paletteNoCommands: "一致するコマンドはありません。",
|
|
90
|
+
paletteResults: ({ count }) => `${count} 件の結果`, paletteCommandsHint: "よく使うコマンド",
|
|
91
|
+
paletteHint: "↑↓ または Alt+1–9 で選択 · Enter で開く · Tab で範囲切替 · Esc で閉じる", paletteSearchFailed: "検索に失敗しました。もう一度お試しください。",
|
|
92
|
+
paletteLeaveRoom: "ルームを退出", paletteJumpLatest: "最新へ移動",
|
|
93
|
+
filesTitle: "ファイル", filesEyebrow: "ルームのファイル", filesFilter: "アップロード者", filesEveryone: "全員",
|
|
94
|
+
filesUnknownUploader: "不明なアップロード者", filesSummary: ({ count, size }) => `${count} 個のファイル · ${size}`,
|
|
95
|
+
filesLoading: "ファイルを読み込み中…", filesLoadFailed: "ファイルを読み込めませんでした。もう一度お試しください。", filesEmpty: "このルームにはまだファイルがありません。",
|
|
96
|
+
filesEmptyFiltered: "このアップロード者のファイルはありません。", filesLoadMore: "さらに読み込む",
|
|
97
|
+
filesHint: "画像・音声・動画をプレビューできます。すべてのファイルをダウンロードできます。",
|
|
98
|
+
filesPreviewFailed: "プレビューを読み込めませんでした。", filesDownloadFailed: "このファイルをダウンロードできませんでした。",
|
|
99
|
+
filesPreviewLabel: ({ name }) => `${name} をプレビュー`, filesDownloadLabel: ({ name }) => `${name} をダウンロード`,
|
|
100
|
+
filesDeleteLabel: ({ name }) => `${name} を削除`, filesRefresh: "ファイルを更新",
|
|
85
101
|
earlierMessages: "以前のメッセージは省略されています", messagesBetweenOmitted: "この閲覧位置と最新の間のメッセージは省略されています。", you: "あなた", saved: "保存済み",
|
|
86
102
|
savedMemory: "このタブにのみ保存", copyFailed: ({ id }) => `コピーに失敗しました。手動でコピーしてください:${id}`,
|
|
87
103
|
copyMessage: "コピー", copiedMessage: "コピーしました", copyMessageFailed: "コピーできませんでした。メッセージを選択して手動でコピーしてください。", wrapCode: "コードを折り返す",
|
|
@@ -103,6 +119,7 @@ export const ja = {
|
|
|
103
119
|
roomsMenu: "ルーム一覧を開く", closeRoomList: "ルーム一覧を閉じる",
|
|
104
120
|
direct: "ダイレクト", messagePrivately: "非公開メッセージ", removeMember: "削除",
|
|
105
121
|
kickConfirm: ({ name }) => `${name} をこのルームから削除しますか?ルーム ID を使えば再参加できます。`,
|
|
122
|
+
leaveRoomConfirm: ({ name }) => `「${name}」を退出しますか?このルームから退出します。ルーム ID を使って後で再参加できます。`,
|
|
106
123
|
deleteRoom: "ルームを削除", deleteConfirm: ({ name }) => `「${name}」とすべてのメッセージを削除しますか?この操作は元に戻せません。`,
|
|
107
124
|
allMembers: "全員", messageCount: ({ count }) => `${count} / 5000`,
|
|
108
125
|
pasteAsFile: ({ count }) => `貼り付けた ${count} 文字をテキストファイルとして保存しました`,
|
|
@@ -27,7 +27,7 @@ export const ko = {
|
|
|
27
27
|
tokenPlaceholder: "서버에서 요구하는 경우 입력", save: "저장",
|
|
28
28
|
tokenHint: "서버가 액세스 토큰을 요구하면(401) 모든 요청에 포함됩니다.",
|
|
29
29
|
existingRooms: "방", noRooms: "아직 방이 없습니다. 하나 만들어 보세요.", copyRoomId: "방 ID 복사", loadingHistory: "이전 메시지 불러오는 중",
|
|
30
|
-
editRoom: "방 편집", roomOwnerOnlyTitle: "소유자 또는 관리자만", roomOwnerOnlyNote: ({ owner }) => `이 설정은 방 소유자나 방 관리자만 변경할 수 있습니다. 이 방의 소유자는 ${owner} 님입니다.`, roomNameLabel: "방 이름", roomDescriptionLabel: "설명", adminAgentLabel: "관리자 Agent", roomOwnerBadge: "소유자", roomAdminBadge: "관리자",
|
|
30
|
+
editRoom: "방 편집", editRoomSections: "방 편집 섹션", editRoomDetails: "방 정보", editRoomJoining: "참여 및 승인", editRoomMembers: "멤버 및 역할", editRoomOwnership: "소유권", roomOwnerOnlyTitle: "소유자 또는 관리자만", roomOwnerOnlyNote: ({ owner }) => `이 설정은 방 소유자나 방 관리자만 변경할 수 있습니다. 이 방의 소유자는 ${owner} 님입니다.`, roomNameLabel: "방 이름", roomDescriptionLabel: "설명", adminAgentLabel: "관리자 Agent", roomOwnerBadge: "소유자", roomAdminBadge: "관리자",
|
|
31
31
|
adminIdsLabel: "사람 관리자", adminIdsHint: "이 멤버들은 방 정보 편집, 멤버 관리, 파일 삭제, 후임자 지정을 할 수 있습니다. 소유자는 항상 같은 권한을 가집니다.", adminIdsEmpty: "이 방에는 아직 다른 멤버가 없습니다.", newOwnerLabel: "새 소유자", newOwnerHint: "방을 참여 중인 다른 사람에게 넘깁니다. 소유자만 할 수 있으며 Agent는 소유자가 될 수 없습니다.",
|
|
32
32
|
successorLabel: "소유자가 나갈 때의 후임자", successorNone: "가장 오래 참여한 멤버", successorHint: "소유자가 나가면 이 사람이 소유자가 됩니다. 관리자가 나가면 이 사람이 그 역할을 이어받습니다. 비워 두면 가장 오래 참여한 멤버가 됩니다.", ownerOnlySettingsNote: "관리자 Agent 변경과 방 넘기기는 소유자만 할 수 있습니다.", adminAgentHint: "지정된 Agent는 관리 도구로 이 방과 기록을 확인할 수 있습니다. 소유자만 변경할 수 있으며 비워 두면 없음입니다.",
|
|
33
33
|
noAdminAgent: "없음", roomNameRequired: "방 이름을 입력하세요", openQuestions: ({ count }) => `답변 없는 질문 ${count}개`,
|
|
@@ -45,6 +45,7 @@ export const ko = {
|
|
|
45
45
|
reminderCreated: "리마인더를 만들었습니다.", reminderUpdated: "리마인더를 수정했습니다.", reminderDeleted: "리마인더를 삭제했습니다.",
|
|
46
46
|
reminderInvalid: "날짜, 5필드 CRON 식, IANA 시간대, 리마인더 텍스트를 확인하세요.", reminderLoadFailed: "리마인더를 불러오지 못했습니다. 작성 중인 내용은 그대로 있습니다.",
|
|
47
47
|
diagramLoading: "다이어그램 그리는 중…", diagramRenderFailed: "다이어그램을 표시할 수 없습니다. 원본을 표시합니다.", resourceLoading: "파일 불러오는 중…", resourceFailed: "이 파일을 불러오지 못했습니다.", resourceDownload: "다운로드", resourceMoreActions: "{name}의 추가 작업", resourcePreview: "미리 보기", resourceHide: "미리 보기 숨기기", zoomImage: "이미지 열기", imagePreviewTitle: "이미지 미리 보기", imageZoomControls: "이미지 확대/축소", zoomIn: "확대", zoomOut: "축소", zoomReset: "확대/축소 초기화", installTitle: "OC Chat 설치", installBody: "홈 화면에 추가하면 전체 화면으로 채팅할 수 있습니다.", installAction: "설치", installHow: "설치 방법", installNotNow: "나중에", installIosGuide: "공유를 탭한 다음 홈 화면에 추가를 선택하세요.",
|
|
48
|
+
pwaUpdateTitle: "업데이트 가능", pwaUpdateBody: "새 버전이 준비되었습니다. 지금 새로고침하거나 다음에 앱을 열 때 업데이트할 수 있습니다.", pwaUpdateNow: "지금 업데이트", pwaUpdateLater: "나중에",
|
|
48
49
|
announcementDelete: "공지 삭제",
|
|
49
50
|
announcementNew: "새 공지", announcementEmpty: "아직 공지가 없습니다.", announcementLoading: "공지 불러오는 중…",
|
|
50
51
|
announcementLoadFailed: "공지를 불러오지 못했습니다. 작성 중인 내용은 그대로 있습니다.", announcementSaved: "공지를 저장했습니다.", announcementDeleted: "공지를 삭제했습니다.",
|
|
@@ -78,10 +79,25 @@ export const ko = {
|
|
|
78
79
|
shortcutsTitle: "키보드 단축키", shortcutsLead: "ChatRoom 단축키입니다. {modifier} + / 를 눌러 이 목록을 여세요.",
|
|
79
80
|
shortcutsOpen: "모든 단축키",
|
|
80
81
|
shortcutsWriting: "작성", shortcutsSend: "메시지 보내기", shortcutsNewline: "줄 바꾸기",
|
|
81
|
-
shortcutsMention: "멘션할 멤버 선택", shortcutsRooms: "방",
|
|
82
|
+
shortcutsMention: "멘션할 멤버 선택", shortcutsRooms: "방", shortcutsSearch: "검색 및 명령", shortcutsOpenPalette: "검색 및 명령 열기",
|
|
82
83
|
shortcutsSwitchRoom: "이전 또는 다음 방으로 전환", shortcutsNumberRoom: "번호로 참여 중인 방으로 전환", shortcutsReading: "읽기",
|
|
83
84
|
shortcutsScroll: "입력 중에 메시지 스크롤", shortcutsJump: "대화의 시작이나 끝으로 이동", shortcutsMenus: "메뉴 및 대화 상자",
|
|
84
85
|
shortcutsClose: "열린 메뉴, 패널 또는 대화 상자 닫기",
|
|
86
|
+
paletteTitle: "검색 및 명령", paletteSearchLabel: "메시지 검색",
|
|
87
|
+
palettePlaceholder: "메시지를 검색하거나 > 로 명령 사용", paletteScopeRoom: "이 방", paletteScopeAll: "모든 방",
|
|
88
|
+
paletteScopeHint: "Tab 키로 이 방과 참여 중인 모든 방을 전환합니다", paletteSearchMode: "검색", paletteCommandMode: "명령",
|
|
89
|
+
paletteSearching: "검색 중…", paletteNoResults: "메시지를 찾지 못했습니다.", paletteNoCommands: "일치하는 명령이 없습니다.",
|
|
90
|
+
paletteResults: ({ count }) => `결과 ${count}개`, paletteCommandsHint: "자주 쓰는 명령",
|
|
91
|
+
paletteHint: "↑↓ 또는 Alt+1–9 선택 · Enter 열기 · Tab 범위 전환 · Esc 닫기", paletteSearchFailed: "검색에 실패했습니다. 다시 시도해 주세요.",
|
|
92
|
+
paletteLeaveRoom: "방 나가기", paletteJumpLatest: "최신으로 이동",
|
|
93
|
+
filesTitle: "파일", filesEyebrow: "방 파일", filesFilter: "업로더", filesEveryone: "모두",
|
|
94
|
+
filesUnknownUploader: "알 수 없는 업로더", filesSummary: ({ count, size }) => `${count}개 파일 · ${size}`,
|
|
95
|
+
filesLoading: "파일을 불러오는 중…", filesLoadFailed: "파일을 불러오지 못했습니다. 다시 시도해 주세요.", filesEmpty: "이 방에는 아직 파일이 없습니다.",
|
|
96
|
+
filesEmptyFiltered: "이 업로더의 파일이 없습니다.", filesLoadMore: "더 불러오기",
|
|
97
|
+
filesHint: "이미지, 오디오, 동영상을 미리 볼 수 있습니다. 모든 파일을 다운로드할 수 있습니다.",
|
|
98
|
+
filesPreviewFailed: "미리보기를 불러오지 못했습니다.", filesDownloadFailed: "이 파일을 다운로드하지 못했습니다.",
|
|
99
|
+
filesPreviewLabel: ({ name }) => `${name} 미리보기`, filesDownloadLabel: ({ name }) => `${name} 다운로드`,
|
|
100
|
+
filesDeleteLabel: ({ name }) => `${name} 삭제`, filesRefresh: "파일 새로고침",
|
|
85
101
|
earlierMessages: "이전 메시지는 생략됨", messagesBetweenOmitted: "이 읽기 지점과 최신 메시지 사이는 생략되었습니다.", you: "나", saved: "저장됨",
|
|
86
102
|
savedMemory: "이 탭에만 저장됨", copyFailed: ({ id }) => `복사하지 못했습니다. 직접 복사하세요: ${id}`,
|
|
87
103
|
copyMessage: "복사", copiedMessage: "복사됨", copyMessageFailed: "복사하지 못했습니다. 메시지를 선택해 직접 복사하세요.", wrapCode: "코드 줄 바꿈",
|
|
@@ -103,6 +119,7 @@ export const ko = {
|
|
|
103
119
|
roomsMenu: "방 목록 열기", closeRoomList: "방 목록 닫기",
|
|
104
120
|
direct: "다이렉트", messagePrivately: "비공개 메시지", removeMember: "추방",
|
|
105
121
|
kickConfirm: ({ name }) => `${name} 님을 이 방에서 추방할까요? 방 ID로 다시 참여할 수 있습니다.`,
|
|
122
|
+
leaveRoomConfirm: ({ name }) => `“${name}” 방에서 나갈까요? 이 방을 나가게 되며, 나중에 방 ID로 다시 참여할 수 있습니다.`,
|
|
106
123
|
deleteRoom: "방 삭제", deleteConfirm: ({ name }) => `“${name}” 방과 모든 메시지를 삭제할까요? 되돌릴 수 없습니다.`,
|
|
107
124
|
allMembers: "모두", messageCount: ({ count }) => `${count} / 5000`,
|
|
108
125
|
pasteAsFile: ({ count }) => `붙여넣은 ${count}자를 텍스트 파일로 저장했습니다`,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRandomId, LS } from "./state.js";
|
|
2
2
|
import { isRoomAdmin } from "./admin-badge.js";
|
|
3
|
+
import { iconNode } from "./icons.js";
|
|
3
4
|
|
|
4
5
|
const mentionPattern = /<at>@([^<]+)<\/at>/g;
|
|
5
6
|
const resourcePattern = /\[\[resource:([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\]\]/gi;
|
|
6
7
|
let mermaidReady = false;
|
|
7
8
|
const previewUrls = new Map();
|
|
8
|
-
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
9
9
|
let previewObserver;
|
|
10
10
|
|
|
11
11
|
export function renderMarkdown(root, text, app) {
|
|
@@ -113,36 +113,9 @@ function codeToolButton(className, key, app, ...icons) {
|
|
|
113
113
|
return button;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
svg.setAttribute("aria-hidden", "true");
|
|
120
|
-
svg.classList.add("code-tool-icon", className);
|
|
121
|
-
for (const [tag, attributes] of shapes) {
|
|
122
|
-
const node = document.createElementNS(svgNamespace, tag);
|
|
123
|
-
for (const [name, value] of Object.entries(attributes)) node.setAttribute(name, value);
|
|
124
|
-
svg.append(node);
|
|
125
|
-
}
|
|
126
|
-
return svg;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function wrapIcon() {
|
|
130
|
-
return codeIcon("code-wrap-icon", [
|
|
131
|
-
["path", { d: "M4 5h16M4 11h13a3.5 3.5 0 0 1 0 7h-4M4 18h5" }],
|
|
132
|
-
["path", { d: "m8 16-3 3 3 3" }],
|
|
133
|
-
]);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function copyIcon() {
|
|
137
|
-
return codeIcon("code-copy-icon", [
|
|
138
|
-
["rect", { x: "4", y: "3", width: "13", height: "15", rx: "2" }],
|
|
139
|
-
["rect", { x: "8", y: "7", width: "12", height: "14", rx: "2" }],
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function checkIcon() {
|
|
144
|
-
return codeIcon("code-check-icon", [["path", { d: "m5 12 4.5 4.5L19 7" }]]);
|
|
145
|
-
}
|
|
116
|
+
const wrapIcon = () => iconNode("text_wrap", "code-tool-icon code-wrap-icon");
|
|
117
|
+
const copyIcon = () => iconNode("copy", "code-tool-icon code-copy-icon");
|
|
118
|
+
const checkIcon = () => iconNode("checkmark", "code-tool-icon code-check-icon");
|
|
146
119
|
|
|
147
120
|
async function copyCode(button, code, app) {
|
|
148
121
|
const copied = await copyTextToClipboard(code.textContent);
|
|
@@ -280,8 +253,7 @@ function resourceSplit(app, resource, download, item) {
|
|
|
280
253
|
toggle.setAttribute("data-i18n-aria-label", "resourceMoreActions");
|
|
281
254
|
toggle._i18nValues = { name: resource.name };
|
|
282
255
|
toggle.setAttribute("aria-label", app.t("resourceMoreActions", { name: resource.name }));
|
|
283
|
-
|
|
284
|
-
icon.setAttribute("aria-hidden", "true"); icon.setAttribute("viewBox", "0 0 24 24"); path.setAttribute("d", "M6 9l6 6 6-6"); icon.append(path); toggle.append(icon);
|
|
256
|
+
toggle.append(iconNode("chevron_down"));
|
|
285
257
|
menu.className = "resource-split-menu"; menu.hidden = true; menu.setAttribute("role", "menu"); menu.append(item);
|
|
286
258
|
group.append(download, toggle, menu);
|
|
287
259
|
function close(focusToggle = false) {
|
|
@@ -5,14 +5,63 @@ import { setRoomPreview } from "./system-messages.js";
|
|
|
5
5
|
export function initMessagePolling(app, isUnreadMessage) {
|
|
6
6
|
const $ = app.$;
|
|
7
7
|
let pollDelay = 2000;
|
|
8
|
+
let recoveryTimer = null;
|
|
9
|
+
let recoveryRoom = null;
|
|
10
|
+
let recoveryGeneration = 0;
|
|
8
11
|
|
|
9
|
-
// A
|
|
12
|
+
// A hung long-poll cannot notice that the network came back. Probe separately
|
|
13
|
+
// so the connection bar clears as soon as any authenticated request succeeds.
|
|
14
|
+
function stopRecovery() {
|
|
15
|
+
if (recoveryTimer) clearTimeout(recoveryTimer);
|
|
16
|
+
recoveryTimer = null;
|
|
17
|
+
recoveryRoom = null;
|
|
18
|
+
recoveryGeneration = 0;
|
|
19
|
+
}
|
|
20
|
+
function scheduleRecovery(immediate = false) {
|
|
21
|
+
const roomId = app.state.room?.id;
|
|
22
|
+
if (!app.state.polling || !roomId) return;
|
|
23
|
+
if (recoveryTimer && recoveryRoom === roomId) {
|
|
24
|
+
if (!immediate) return;
|
|
25
|
+
clearTimeout(recoveryTimer);
|
|
26
|
+
} else stopRecovery();
|
|
27
|
+
recoveryRoom = roomId;
|
|
28
|
+
recoveryGeneration = app.state.pollGeneration;
|
|
29
|
+
recoveryTimer = setTimeout(() => { void probeRecovery(roomId, recoveryGeneration); }, immediate ? 0 : 2000);
|
|
30
|
+
}
|
|
31
|
+
async function probeRecovery(roomId, generation) {
|
|
32
|
+
recoveryTimer = null;
|
|
33
|
+
if (!app.state.polling || app.state.room?.id !== roomId || app.state.pollGeneration !== generation) { stopRecovery(); return; }
|
|
34
|
+
const controller = new AbortController();
|
|
35
|
+
const timer = setTimeout(() => controller.abort(), 3000);
|
|
36
|
+
try {
|
|
37
|
+
await app.api(`/rooms/${encodeURIComponent(roomId)}`, { signal: controller.signal });
|
|
38
|
+
if (!app.state.polling || app.state.room?.id !== roomId || app.state.pollGeneration !== generation) { stopRecovery(); return; }
|
|
39
|
+
app.setOnline(true);
|
|
40
|
+
stopRecovery();
|
|
41
|
+
pollDelay = 2000;
|
|
42
|
+
app.startPolling();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (!app.state.polling || app.state.room?.id !== roomId || app.state.pollGeneration !== generation) { stopRecovery(); return; }
|
|
45
|
+
if (error.status === 404) {
|
|
46
|
+
stopRecovery();
|
|
47
|
+
void app.removeJoinedRoom(roomId, { reason: true });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (error.status === 401) {
|
|
51
|
+
stopRecovery();
|
|
52
|
+
app.setOnline(false);
|
|
53
|
+
if (!app.settingsOpen()) app.openChatSettings();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
recoveryTimer = setTimeout(() => { void probeRecovery(roomId, generation); }, 2000);
|
|
57
|
+
} finally {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// A restarted network can leave the browser's old request hanging. Probe at
|
|
10
63
|
// once instead of waiting for the long-poll timeout.
|
|
11
|
-
window.addEventListener("online", () =>
|
|
12
|
-
if (!app.state.polling || !app.state.room) return;
|
|
13
|
-
pollDelay = 2000;
|
|
14
|
-
app.startPolling();
|
|
15
|
-
});
|
|
64
|
+
window.addEventListener("online", () => scheduleRecovery(true));
|
|
16
65
|
|
|
17
66
|
function isCurrentPoll(roomId, generation) {
|
|
18
67
|
return app.state.polling && app.state.pollGeneration === generation && app.state.room?.id === roomId;
|
|
@@ -32,6 +81,7 @@ export function initMessagePolling(app, isUnreadMessage) {
|
|
|
32
81
|
app.state.pollGeneration++;
|
|
33
82
|
app.state.pollController?.abort();
|
|
34
83
|
app.state.pollController = null;
|
|
84
|
+
stopRecovery();
|
|
35
85
|
};
|
|
36
86
|
|
|
37
87
|
async function pollLoop(generation, signal) {
|
|
@@ -121,10 +171,12 @@ export function initMessagePolling(app, isUnreadMessage) {
|
|
|
121
171
|
void app.reconcileRoom(roomId, generation);
|
|
122
172
|
}
|
|
123
173
|
app.setOnline(true);
|
|
174
|
+
stopRecovery();
|
|
124
175
|
pollDelay = data.hasMore && (entry?.receivedTs || 0) > previousReceivedTs ? 0 : 2000;
|
|
125
176
|
} catch (error) {
|
|
126
177
|
if (!isCurrentPoll(roomId, generation)) return;
|
|
127
178
|
if (error.status === 401) {
|
|
179
|
+
stopRecovery();
|
|
128
180
|
app.setOnline(false);
|
|
129
181
|
if (!app.settingsOpen()) app.openChatSettings();
|
|
130
182
|
pollDelay = Math.min(pollDelay * 2, 30000);
|
|
@@ -133,6 +185,7 @@ export function initMessagePolling(app, isUnreadMessage) {
|
|
|
133
185
|
} else {
|
|
134
186
|
app.setOnline(false);
|
|
135
187
|
pollDelay = 2000;
|
|
188
|
+
if (error.network || error.name === "AbortError" || error.name === "TimeoutError") scheduleRecovery();
|
|
136
189
|
}
|
|
137
190
|
}
|
|
138
191
|
}
|
|
@@ -142,6 +195,7 @@ export function initMessagePolling(app, isUnreadMessage) {
|
|
|
142
195
|
try {
|
|
143
196
|
const room = await app.api(`/rooms/${encodeURIComponent(roomId)}`);
|
|
144
197
|
if (!isCurrentPoll(roomId, generation)) return;
|
|
198
|
+
app.setOnline(true);
|
|
145
199
|
const before = JSON.stringify([app.state.room.ownerId, app.state.room.adminIds ?? [], app.state.room.successorId ?? null, app.state.room.adminSessionID ?? null]);
|
|
146
200
|
const openQuestions = Number(room.openQuestions);
|
|
147
201
|
Object.assign(app.state.room, { participants: room.participants, ownerId: room.ownerId ?? app.state.room.ownerId, adminIds: room.adminIds ?? [], successorId: room.successorId ?? null, adminSessionID: room.adminSessionID ?? null, openQuestions: Number.isFinite(openQuestions) ? Math.max(0, openQuestions) : app.state.room.openQuestions });
|
|
@@ -156,6 +210,7 @@ export function initMessagePolling(app, isUnreadMessage) {
|
|
|
156
210
|
try {
|
|
157
211
|
const room = await app.api(`/rooms/${encodeURIComponent(roomId)}`);
|
|
158
212
|
if (!isCurrentPoll(roomId, generation)) return;
|
|
213
|
+
app.setOnline(true);
|
|
159
214
|
if (entry && Number.isFinite(Number(room.recallVersion))) entry.recallVersion = Number(room.recallVersion);
|
|
160
215
|
const current = app.state.room.messages;
|
|
161
216
|
const ids = new Set(current.map((message) => message.id));
|
|
@@ -26,8 +26,36 @@ export function followsBottom(app, threshold = -1) {
|
|
|
26
26
|
return Boolean(app.state.followBottom || (thread && thread.scrollHeight - thread.scrollTop - thread.clientHeight <= threshold));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// A search jump parks one row near the top of the thread and flashes it briefly.
|
|
30
|
+
export function flashMessageRow(app, row) {
|
|
31
|
+
const thread = document.querySelector("#thread");
|
|
32
|
+
thread.scrollTop += row.getBoundingClientRect().top - (thread.getBoundingClientRect().top + thread.clientTop) - 12;
|
|
33
|
+
app.state.followBottom = false;
|
|
34
|
+
// Keep a programmatic search jump from being mistaken for the reader returning to the tail.
|
|
35
|
+
app.state.focusHoldUntil = performance.now() + 900;
|
|
36
|
+
clearTimeout(row._jumpFlashTimer);
|
|
37
|
+
row.classList.remove("jump-flash");
|
|
38
|
+
void row.offsetWidth;
|
|
39
|
+
row.classList.add("jump-flash");
|
|
40
|
+
row._jumpFlashTimer = setTimeout(() => row.classList.remove("jump-flash"), 900);
|
|
41
|
+
app.updateJump?.();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Resolve app.state.focusMessageId against the loaded state and rendered rows.
|
|
45
|
+
export function focusedMessage(app, list, messages) {
|
|
46
|
+
const id = app.state.focusMessageId;
|
|
47
|
+
if (!id) return null;
|
|
48
|
+
const index = messages.findIndex((message) => message.id === id);
|
|
49
|
+
if (index < 0) { app.state.focusMessageId = null; return null; }
|
|
50
|
+
return { id, index, existing: list.querySelector(`[data-msg-id="${CSS.escape(id)}"]`) };
|
|
51
|
+
}
|
|
52
|
+
|
|
29
53
|
export function trimMessages(list, app) {
|
|
30
54
|
if (list.children.length <= 400 || hasMessageSelection(list)) return;
|
|
55
|
+
// Trimming removes content above the reader. While they are browsing older
|
|
56
|
+
// history that would shift the viewport, so only trim near the newest tail.
|
|
57
|
+
const thread = document.querySelector("#thread");
|
|
58
|
+
if (thread && thread.scrollHeight - thread.scrollTop - thread.clientHeight > 80) return;
|
|
31
59
|
const saved = app.state.positions.get(app.state.room?.id), rows = [...list.querySelectorAll("[data-msg-id]")];
|
|
32
60
|
const anchor = saved?.messageId && rows.find((row) => row.dataset.msgId === saved.messageId);
|
|
33
61
|
if (anchor && rows.indexOf(anchor) < rows.length - 280) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createRandomId, LS, LOADED_MESSAGE_LIMIT } from "./state.js";
|
|
2
2
|
import { renderMarkdown } from "./markdown.js";
|
|
3
|
-
import { hasMessageSelection, pruneMessageRows, trimMessages } from "./message-window.js";
|
|
3
|
+
import { hasMessageSelection, pruneMessageRows, trimMessages, focusedMessage } from "./message-window.js";
|
|
4
4
|
import { formatSystemMessage, setRoomPreview } from "./system-messages.js";
|
|
5
5
|
import { installEditor } from "./editor.js";
|
|
6
6
|
import { adminAgentBadge, isAdminAgent } from "./admin-badge.js";
|
|
7
7
|
import { initMessagePolling } from "./message-polling.js";
|
|
8
|
+
import { iconNode } from "./icons.js";
|
|
8
9
|
|
|
9
10
|
export function initMessages(app) {
|
|
10
11
|
const $ = app.$;
|
|
@@ -102,6 +103,10 @@ export function initMessages(app) {
|
|
|
102
103
|
app.jumpToBottom = () => {
|
|
103
104
|
app.state.readAnchorGuard = null;
|
|
104
105
|
app.state.followBottom = true;
|
|
106
|
+
if (app.state.focusMessageId) {
|
|
107
|
+
app.state.focusMessageId = null;
|
|
108
|
+
app.rerenderMessages();
|
|
109
|
+
}
|
|
105
110
|
$("#thread").scrollTop = $("#thread").scrollHeight;
|
|
106
111
|
const entry = app.state.room && app.state.rooms.get(app.state.room.id);
|
|
107
112
|
app.state.unread = entry ? entry.unreadIds.size + (entry.unreadOverflow ? 100 : 0) : 0;
|
|
@@ -188,6 +193,11 @@ export function initMessages(app) {
|
|
|
188
193
|
}
|
|
189
194
|
};
|
|
190
195
|
|
|
196
|
+
// Today keeps the compact clock; older messages carry the date because the
|
|
197
|
+
// day separator scrolls away or gets trimmed.
|
|
198
|
+
app.messageTime = (timestamp) => new Date(timestamp).toDateString() === new Date().toDateString()
|
|
199
|
+
? app.timeHM(timestamp) : app.fmtTime(timestamp);
|
|
200
|
+
|
|
191
201
|
app.renderMessage = (message, live) => {
|
|
192
202
|
const row = document.createElement("li");
|
|
193
203
|
row.dataset.sender = message.senderId;
|
|
@@ -210,7 +220,7 @@ export function initMessages(app) {
|
|
|
210
220
|
name.className = "msg-name";
|
|
211
221
|
name.textContent = own ? app.t("you") : sender;
|
|
212
222
|
time.className = "msg-time";
|
|
213
|
-
time.textContent = app.
|
|
223
|
+
time.textContent = app.messageTime(message.createdAt);
|
|
214
224
|
meta.append(name);
|
|
215
225
|
if (isAdminAgent(app, message.senderSessionID || message.senderId)) meta.append(adminAgentBadge(app));
|
|
216
226
|
meta.append(time);
|
|
@@ -232,13 +242,7 @@ export function initMessages(app) {
|
|
|
232
242
|
copy.dataset.i18nAriaLabel = "copyMessage";
|
|
233
243
|
copy.dataset.i18nTitle = "copyMessage";
|
|
234
244
|
copy.title = app.t("copyMessage");
|
|
235
|
-
const icon =
|
|
236
|
-
icon.classList.add("message-copy-icon"); icon.setAttribute("viewBox", "0 0 24 24"); icon.setAttribute("aria-hidden", "true");
|
|
237
|
-
const back = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
238
|
-
back.setAttribute("x", "4"); back.setAttribute("y", "3"); back.setAttribute("width", "13"); back.setAttribute("height", "15"); back.setAttribute("rx", "2");
|
|
239
|
-
const front = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
240
|
-
front.setAttribute("x", "8"); front.setAttribute("y", "7"); front.setAttribute("width", "12"); front.setAttribute("height", "14"); front.setAttribute("rx", "2");
|
|
241
|
-
icon.append(back, front);
|
|
245
|
+
const icon = iconNode("copy", "message-copy-icon");
|
|
242
246
|
const feedback = document.createElement("span");
|
|
243
247
|
feedback.className = "message-copy-feedback"; feedback.dataset.flashOutput = ""; feedback.dataset.i18n = "copyMessage";
|
|
244
248
|
feedback.hidden = true; feedback.setAttribute("role", "status"); feedback.setAttribute("aria-live", "polite"); feedback.textContent = app.t("copyMessage");
|
|
@@ -251,22 +255,35 @@ export function initMessages(app) {
|
|
|
251
255
|
return row;
|
|
252
256
|
};
|
|
253
257
|
|
|
254
|
-
app.renderMessages = (live = false) => {
|
|
258
|
+
app.renderMessages = (live = false, tailLimit = 0) => {
|
|
255
259
|
const thread = $("#thread"), list = $("#msgList"), messages = app.state.room.messages;
|
|
256
|
-
|
|
260
|
+
// A palette jump renders a window around the target instead of the newest
|
|
261
|
+
// tail. While that window is up, live appends stay off screen so the target
|
|
262
|
+
// is not trimmed away.
|
|
263
|
+
const focus = focusedMessage(app, list, messages);
|
|
264
|
+
if (focus?.existing) { app.updateJump(); return { skipped: 0 }; }
|
|
265
|
+
const nearBottom = !focus && thread.scrollHeight - thread.scrollTop - thread.clientHeight <= 80;
|
|
257
266
|
let skipped = 0;
|
|
258
267
|
let anchorId = null, anchorOffset = 0, oldTop = thread.scrollTop;
|
|
259
268
|
const viewport = thread.getBoundingClientRect();
|
|
260
269
|
const firstVisible = [...list.children].find((node) => node.dataset.msgId && node.getBoundingClientRect().bottom > viewport.top);
|
|
261
270
|
anchorId = firstVisible?.dataset.msgId || null;
|
|
262
271
|
anchorOffset = firstVisible ? firstVisible.getBoundingClientRect().top - viewport.top : 0;
|
|
272
|
+
if (focus) {
|
|
273
|
+
// Start a fresh window containing the target, wherever it sits in the
|
|
274
|
+
// loaded state (which can hold up to LOADED_MESSAGE_LIMIT messages).
|
|
275
|
+
list.textContent = "";
|
|
276
|
+
app.rendered = 0;
|
|
277
|
+
}
|
|
263
278
|
pruneMessageRows(list, messages);
|
|
264
279
|
let last = list.lastElementChild;
|
|
265
280
|
const renderedIds = new Set([...list.querySelectorAll("[data-msg-id]")].map((node) => node.dataset.msgId));
|
|
266
281
|
let startIndex = 0;
|
|
267
282
|
const lastId = [...list.querySelectorAll("[data-msg-id]")].at(-1)?.dataset.msgId;
|
|
268
283
|
if (lastId) for (let index = messages.length - 1; index >= 0; index--) if (messages[index].id === lastId) { startIndex = index + 1; break; }
|
|
269
|
-
|
|
284
|
+
const renderStart = focus ? Math.max(0, focus.index - 120) : Math.max(startIndex, tailLimit ? messages.length - tailLimit : 0);
|
|
285
|
+
const renderEnd = focus ? Math.min(messages.length, focus.index + 120) : messages.length;
|
|
286
|
+
for (let index = renderStart; index < renderEnd; index++) {
|
|
270
287
|
const message = messages[index];
|
|
271
288
|
if (renderedIds.has(message.id) || app.failedRenderIds.has(message.id)) continue;
|
|
272
289
|
try {
|
|
@@ -378,6 +395,9 @@ export function initMessages(app) {
|
|
|
378
395
|
else updated = await app.api(`/rooms/${encodeURIComponent(room.id)}/messages`, {
|
|
379
396
|
method: "POST", body: JSON.stringify({ sessionID: LS.sessionID, text, ...(replyTarget ? { replyToMessageID: replyTarget.id } : {}) }),
|
|
380
397
|
});
|
|
398
|
+
// A successful request proves the connection is usable, even if a stale
|
|
399
|
+
// long-poll is still waiting to time out.
|
|
400
|
+
app.setOnline(true);
|
|
381
401
|
app.completeAttachments?.(room.id, message.ids);
|
|
382
402
|
const pendingIndex = room.messages.findIndex((item) => item.id === pending.id);
|
|
383
403
|
if (pendingIndex >= 0) room.messages.splice(pendingIndex, 1);
|