@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
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { LOADED_MESSAGE_LIMIT } from "./state.js";
|
|
2
|
+
import { flashMessageRow } from "./message-window.js";
|
|
3
|
+
|
|
4
|
+
// Palette search: local scan first, then lazy history pages until the room's
|
|
5
|
+
// loaded window fills up. There is no server-side search endpoint.
|
|
6
|
+
export const SEARCH_RESULT_LIMIT = 100;
|
|
7
|
+
export const SEARCH_MESSAGE_LIMIT = LOADED_MESSAGE_LIMIT;
|
|
8
|
+
const PAGE_LIMIT = 100;
|
|
9
|
+
const MAX_PAGES_PER_ROOM = Math.ceil(SEARCH_MESSAGE_LIMIT / PAGE_LIMIT);
|
|
10
|
+
|
|
11
|
+
export function initSearch(app) {
|
|
12
|
+
app.searchMessages = (query, scope = "room") => searchMessages(app, query, scope);
|
|
13
|
+
app.openSearchHit = (hit) => openSearchHit(app, hit);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function searchMessages(app, query, scope = "room") {
|
|
17
|
+
const needle = String(query ?? "").trim().toLocaleLowerCase();
|
|
18
|
+
if (!needle) return [];
|
|
19
|
+
const activeId = app.state.room?.id;
|
|
20
|
+
const roomIds = [...app.state.rooms.keys()]
|
|
21
|
+
.filter((roomId) => scope === "all" || roomId === activeId)
|
|
22
|
+
.sort((left, right) => {
|
|
23
|
+
if (left === activeId) return -1;
|
|
24
|
+
if (right === activeId) return 1;
|
|
25
|
+
return latestAt(app, right) - latestAt(app, left);
|
|
26
|
+
});
|
|
27
|
+
const hits = [];
|
|
28
|
+
for (const roomId of roomIds) {
|
|
29
|
+
await collectRoomHits(app, roomId, needle, hits);
|
|
30
|
+
// Keep the page responsive while several rooms are scanned.
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
32
|
+
}
|
|
33
|
+
return hits
|
|
34
|
+
.sort((left, right) => right.createdAt - left.createdAt || (right.seq ?? 0) - (left.seq ?? 0))
|
|
35
|
+
.slice(0, SEARCH_RESULT_LIMIT);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function openSearchHit(app, hit) {
|
|
39
|
+
const roomId = hit?.roomId, messageId = hit?.messageId;
|
|
40
|
+
if (!roomId || !messageId) return false;
|
|
41
|
+
const entry = app.state.rooms.get(roomId);
|
|
42
|
+
if (!entry?.room) return false;
|
|
43
|
+
if (!entry.room.messages.some((message) => message.id === messageId)) {
|
|
44
|
+
const seq = Number(hit.seq);
|
|
45
|
+
// beforeSeq is exclusive: seq + 1 puts the target at the end of the page.
|
|
46
|
+
if (!Number.isSafeInteger(seq)) return false;
|
|
47
|
+
try {
|
|
48
|
+
const page = await app.api(`/rooms/${encodeURIComponent(roomId)}/history?beforeSeq=${seq + 1}&limit=${PAGE_LIMIT}`);
|
|
49
|
+
if (app.state.rooms.get(roomId) !== entry) return false;
|
|
50
|
+
const messages = Array.isArray(page.messages) ? page.messages : [];
|
|
51
|
+
mergeHistory(entry, roomId, messages);
|
|
52
|
+
if (page.hasMore) {
|
|
53
|
+
// Continue upward pagination from the oldest message now loaded.
|
|
54
|
+
const oldest = entry.room.messages.find((message) => Number.isSafeInteger(message.seq))?.seq;
|
|
55
|
+
if (Number.isSafeInteger(oldest)) entry.historyBeforeSeq = oldest;
|
|
56
|
+
} else {
|
|
57
|
+
entry.historyComplete = true;
|
|
58
|
+
entry.historyBeforeSeq = null;
|
|
59
|
+
}
|
|
60
|
+
app.cacheRoomSoon?.(roomId);
|
|
61
|
+
if (!entry.room.messages.some((message) => message.id === messageId)) return false;
|
|
62
|
+
} catch { return false; }
|
|
63
|
+
}
|
|
64
|
+
if (app.state.room?.id !== roomId) app.activateRoom(roomId);
|
|
65
|
+
if (app.state.room?.id !== roomId) return false;
|
|
66
|
+
app.state.room = app.state.rooms.get(roomId)?.room || app.state.room;
|
|
67
|
+
app.state.focusMessageId = messageId;
|
|
68
|
+
app.state.followBottom = false;
|
|
69
|
+
app.state.readAnchorGuard = null;
|
|
70
|
+
app.renderMessages(false);
|
|
71
|
+
const row = document.querySelector(`[data-msg-id="${CSS.escape(messageId)}"]`);
|
|
72
|
+
if (!row) return false;
|
|
73
|
+
flashMessageRow(app, row);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function collectRoomHits(app, roomId, needle, hits) {
|
|
78
|
+
const entry = app.state.rooms.get(roomId);
|
|
79
|
+
if (!entry?.room) return;
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const scan = (messages) => {
|
|
82
|
+
for (const message of messages) {
|
|
83
|
+
if (seen.has(message.id)) continue;
|
|
84
|
+
seen.add(message.id);
|
|
85
|
+
if (message.recalledAt || message.pending || message.senderId === "system") continue;
|
|
86
|
+
const text = typeof message.text === "string" ? message.text : "";
|
|
87
|
+
if (!text || !text.toLocaleLowerCase().includes(needle)) continue;
|
|
88
|
+
hits.push({
|
|
89
|
+
roomId,
|
|
90
|
+
roomName: entry.room.name || roomId,
|
|
91
|
+
messageId: message.id,
|
|
92
|
+
seq: message.seq,
|
|
93
|
+
sender: message.senderId,
|
|
94
|
+
createdAt: message.createdAt,
|
|
95
|
+
text,
|
|
96
|
+
snippet: snippetFor(text, needle),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
scan(entry.room.messages);
|
|
101
|
+
let pages = 0;
|
|
102
|
+
while (!entry.historyComplete && Number.isSafeInteger(entry.historyBeforeSeq)
|
|
103
|
+
&& entry.room.messages.length < SEARCH_MESSAGE_LIMIT && pages++ < MAX_PAGES_PER_ROOM) {
|
|
104
|
+
try {
|
|
105
|
+
const page = await app.api(`/rooms/${encodeURIComponent(roomId)}/history?beforeSeq=${entry.historyBeforeSeq}&limit=${PAGE_LIMIT}`);
|
|
106
|
+
if (app.state.rooms.get(roomId) !== entry) return;
|
|
107
|
+
const messages = Array.isArray(page.messages) ? page.messages : [];
|
|
108
|
+
scan(messages);
|
|
109
|
+
mergeHistory(entry, roomId, messages);
|
|
110
|
+
const next = typeof page.nextBeforeSeq === "number" ? page.nextBeforeSeq : null;
|
|
111
|
+
entry.historyComplete = !page.hasMore;
|
|
112
|
+
if (entry.historyComplete) entry.historyBeforeSeq = null;
|
|
113
|
+
else if (next === null || next >= entry.historyBeforeSeq) break;
|
|
114
|
+
else entry.historyBeforeSeq = next;
|
|
115
|
+
} catch { break; }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function mergeHistory(entry, roomId, messages) {
|
|
120
|
+
const merged = new Map(entry.room.messages.map((message) => [message.id, message]));
|
|
121
|
+
for (const message of messages) if (!merged.has(message.id)) merged.set(message.id, { ...message, roomId });
|
|
122
|
+
entry.room.messages = [...merged.values()]
|
|
123
|
+
.sort((left, right) => left.createdAt - right.createdAt || (left.seq ?? 0) - (right.seq ?? 0))
|
|
124
|
+
.slice(-LOADED_MESSAGE_LIMIT);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function latestAt(app, roomId) {
|
|
128
|
+
return app.state.rooms.get(roomId)?.room.messages.at(-1)?.createdAt ?? 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function snippetFor(text, needle) {
|
|
132
|
+
const flat = text.replace(/\s+/g, " ").trim();
|
|
133
|
+
const index = flat.toLocaleLowerCase().indexOf(needle);
|
|
134
|
+
if (index < 0) return flat.slice(0, 140);
|
|
135
|
+
const start = Math.max(0, index - 40), end = Math.min(flat.length, index + needle.length + 60);
|
|
136
|
+
return `${start > 0 ? "…" : ""}${flat.slice(start, end)}${end < flat.length ? "…" : ""}`;
|
|
137
|
+
}
|
|
@@ -7,7 +7,7 @@ export function initSettings(app) {
|
|
|
7
7
|
if (!dialog) return;
|
|
8
8
|
const tokenInput = $("#inTokenChat"), tokenHint = $("#tokenHint");
|
|
9
9
|
const contentInput = $("#inContentTransition");
|
|
10
|
-
const pageInput = $("#inPageStep");
|
|
10
|
+
const pageInput = $("#inPageStep"), pageValue = $("#pageStepValue");
|
|
11
11
|
const tabs = [...dialog.querySelectorAll('[role="tab"]')];
|
|
12
12
|
const scheme = matchMedia("(prefers-color-scheme: dark)");
|
|
13
13
|
let opener = null;
|
|
@@ -61,6 +61,7 @@ export function initSettings(app) {
|
|
|
61
61
|
syncThemeInputs();
|
|
62
62
|
if (contentInput) contentInput.checked = app.LS.contentTransition;
|
|
63
63
|
if (pageInput) pageInput.value = String(app.LS.pageStep);
|
|
64
|
+
if (pageValue) pageValue.textContent = `${app.LS.pageStep}%`;
|
|
64
65
|
tokenInput.value = app.LS.token;
|
|
65
66
|
if (tokenHint) tokenHint.hidden = !token;
|
|
66
67
|
if (dialog.open) {
|
|
@@ -88,21 +89,26 @@ export function initSettings(app) {
|
|
|
88
89
|
$("#btnCloseSettings")?.addEventListener("click", close);
|
|
89
90
|
dialog.addEventListener("click", (event) => { if (event.target === dialog) close(); });
|
|
90
91
|
dialog.addEventListener("cancel", () => opener?.setAttribute("aria-expanded", "false"));
|
|
92
|
+
pageInput?.addEventListener("input", () => {
|
|
93
|
+
app.LS.pageStep = pageInput.value;
|
|
94
|
+
pageInput.value = String(app.LS.pageStep);
|
|
95
|
+
if (pageValue) pageValue.textContent = `${app.LS.pageStep}%`;
|
|
96
|
+
});
|
|
91
97
|
dialog.addEventListener("change", (event) => {
|
|
92
98
|
if (event.target instanceof HTMLInputElement && event.target.name === "theme") app.setTheme(event.target.value);
|
|
93
99
|
if (event.target === contentInput) app.LS.contentTransition = contentInput.checked;
|
|
94
100
|
if (event.target === pageInput) {
|
|
95
101
|
app.LS.pageStep = pageInput.value;
|
|
96
102
|
pageInput.value = String(app.LS.pageStep);
|
|
103
|
+
if (pageValue) pageValue.textContent = `${app.LS.pageStep}%`;
|
|
97
104
|
}
|
|
98
105
|
});
|
|
99
106
|
dialog.addEventListener("close", () => {
|
|
100
107
|
const target = opener;
|
|
101
108
|
opener = null;
|
|
102
|
-
if (target?.isConnected)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
109
|
+
if (target?.isConnected) target.setAttribute("aria-expanded", "false");
|
|
110
|
+
if (app.focusChatComposer?.({ force: true })) return;
|
|
111
|
+
if (target?.isConnected) target.focus({ preventScroll: true });
|
|
106
112
|
});
|
|
107
113
|
// The palette follows the system through its media query; only the browser chrome needs a nudge.
|
|
108
114
|
scheme.addEventListener("change", () => { if (app.LS.theme === "system") syncThemeColor(); });
|
|
@@ -127,7 +127,7 @@ export function initShortcuts(app) {
|
|
|
127
127
|
// Keep the motion in the room list: a vertical glide shows where the selection moved.
|
|
128
128
|
for (const row of document.querySelectorAll("#roomList .room-row.selected, #roomListChat .room-row.selected")) {
|
|
129
129
|
row.classList.remove("room-switch-enter");
|
|
130
|
-
row.style.setProperty("--room-switch-shift", `${direction > 0 ?
|
|
130
|
+
row.style.setProperty("--room-switch-shift", `${direction > 0 ? 3 : -3}px`);
|
|
131
131
|
void row.offsetWidth;
|
|
132
132
|
row.classList.add("room-switch-enter");
|
|
133
133
|
row.scrollIntoView({ block: "nearest" });
|
|
@@ -231,7 +231,7 @@ export const messages = {
|
|
|
231
231
|
tokenPlaceholder: "Enter if the server requires it", save: "Save",
|
|
232
232
|
tokenHint: "If the server requires an access token (401), all requests will include it.",
|
|
233
233
|
existingRooms: "Rooms", noRooms: "No rooms yet. Create one.", copyRoomId: "Copy room ID", loadingHistory: "Loading earlier messages",
|
|
234
|
-
editRoom: "Edit room", roomOwnerOnlyTitle: "Owner or administrator only", roomOwnerOnlyNote: ({ owner }) => `Only the room owner or a room administrator can change these settings. This room belongs to ${owner}.`, roomNameLabel: "Room name", roomDescriptionLabel: "Description", adminAgentLabel: "Administrator agent", roomOwnerBadge: "Owner", roomAdminBadge: "Admin",
|
|
234
|
+
editRoom: "Edit room", editRoomSections: "Edit room sections", editRoomDetails: "Room details", editRoomJoining: "Joining & approval", editRoomMembers: "Members & roles", editRoomOwnership: "Ownership", roomOwnerOnlyTitle: "Owner or administrator only", roomOwnerOnlyNote: ({ owner }) => `Only the room owner or a room administrator can change these settings. This room belongs to ${owner}.`, roomNameLabel: "Room name", roomDescriptionLabel: "Description", adminAgentLabel: "Administrator agent", roomOwnerBadge: "Owner", roomAdminBadge: "Admin",
|
|
235
235
|
adminIdsLabel: "Human administrators", adminIdsHint: "These members can edit room details, manage members, delete files, and choose a successor. The owner always has the same powers.", adminIdsEmpty: "No other members are in this room yet.", newOwnerLabel: "New owner", newOwnerHint: "Hand the room to another person who is in it. Only the owner can do this; agents cannot own a room.",
|
|
236
236
|
successorLabel: "Successor if the owner leaves", successorNone: "Longest-present member", successorHint: "If the owner leaves, this person becomes owner. If an administrator leaves, this person takes that role. Leave empty to use the longest-present member.", ownerOnlySettingsNote: "Only the owner can change the administrator agent or hand off the room.", adminAgentHint: "The designated agent can use the admin tool to inspect this room and its history. Only the owner can change this; leave empty for none.",
|
|
237
237
|
noAdminAgent: "None", openQuestions: ({ count }) => `${count} unanswered question${count === 1 ? "" : "s"}`,
|
|
@@ -249,6 +249,7 @@ export const messages = {
|
|
|
249
249
|
reminderCreated: "Reminder created.", reminderUpdated: "Reminder updated.", reminderDeleted: "Reminder deleted.",
|
|
250
250
|
reminderInvalid: "Check the date, 5-field CRON expression, IANA timezone, and reminder text.", reminderLoadFailed: "Could not load reminders. Your draft is still here.",
|
|
251
251
|
diagramLoading: "Rendering diagram…", diagramRenderFailed: "Diagram unavailable; showing its source.", resourceLoading: "Loading file…", resourceFailed: "This file could not be loaded.", resourceDownload: "Download", resourceMoreActions: "More actions for {name}", resourcePreview: "Preview", resourceHide: "Hide preview", zoomImage: "Open image", imagePreviewTitle: "Image preview", imageZoomControls: "Image zoom", zoomIn: "Zoom in", zoomOut: "Zoom out", zoomReset: "Reset zoom", installTitle: "Install OC Chat", installBody: "Add it to your home screen for a full-screen chat.", installAction: "Install", installHow: "How to install", installNotNow: "Not now", installIosGuide: "Tap Share, then Add to Home Screen.",
|
|
252
|
+
pwaUpdateTitle: "Update available", pwaUpdateBody: "A new version is ready. Reload now, or update the next time you open the app.", pwaUpdateNow: "Update now", pwaUpdateLater: "Later",
|
|
252
253
|
announcementDelete: "Delete announcement",
|
|
253
254
|
announcementNew: "New announcement", announcementEmpty: "No announcements yet.", announcementLoading: "Loading announcements…",
|
|
254
255
|
announcementLoadFailed: "Could not load announcements. Your draft is still here.", announcementSaved: "Announcement saved.", announcementDeleted: "Announcement deleted.",
|
|
@@ -283,10 +284,25 @@ export const messages = {
|
|
|
283
284
|
shortcutsTitle: "Keyboard shortcuts", shortcutsLead: "ChatRoom shortcuts. Press {modifier} + / to open this list.",
|
|
284
285
|
shortcutsOpen: "All shortcuts",
|
|
285
286
|
shortcutsWriting: "Writing", shortcutsSend: "Send the message", shortcutsNewline: "Start a new line",
|
|
286
|
-
shortcutsMention: "Choose a member to mention", shortcutsRooms: "Rooms",
|
|
287
|
+
shortcutsMention: "Choose a member to mention", shortcutsRooms: "Rooms", shortcutsSearch: "Search and commands", shortcutsOpenPalette: "Open search and commands",
|
|
287
288
|
shortcutsSwitchRoom: "Switch to the previous or next room", shortcutsNumberRoom: "Switch to a joined room by number", shortcutsReading: "Reading",
|
|
288
289
|
shortcutsScroll: "Scroll messages while typing", shortcutsJump: "Jump to the start or end of the conversation", shortcutsMenus: "Menus and dialogs",
|
|
289
290
|
shortcutsClose: "Close the open menu, panel, or dialog",
|
|
291
|
+
paletteTitle: "Search and commands", paletteSearchLabel: "Search messages",
|
|
292
|
+
palettePlaceholder: "Search messages, or type > for commands", paletteScopeRoom: "This room", paletteScopeAll: "All rooms",
|
|
293
|
+
paletteScopeHint: "Tab switches between this room and all joined rooms", paletteSearchMode: "Search", paletteCommandMode: "Commands",
|
|
294
|
+
paletteSearching: "Searching…", paletteNoResults: "No messages found.", paletteNoCommands: "No matching commands.",
|
|
295
|
+
paletteResults: ({ count }) => `${count} result${count === 1 ? "" : "s"}`, paletteCommandsHint: "Common commands",
|
|
296
|
+
paletteHint: "↑↓ or Alt+1–9 select · Enter open · Tab scope · Esc close", paletteSearchFailed: "Search failed. Try again.",
|
|
297
|
+
paletteLeaveRoom: "Leave room", paletteJumpLatest: "Jump to latest",
|
|
298
|
+
filesTitle: "Files", filesEyebrow: "Room files", filesFilter: "Uploaded by", filesEveryone: "Everyone",
|
|
299
|
+
filesUnknownUploader: "Unknown uploader", filesSummary: ({ count, size }) => `${count} file${count === 1 ? "" : "s"} · ${size}`,
|
|
300
|
+
filesLoading: "Loading files…", filesLoadFailed: "Could not load files. Try again.", filesEmpty: "No files in this room yet.",
|
|
301
|
+
filesEmptyFiltered: "No files from this uploader.", filesLoadMore: "Load more",
|
|
302
|
+
filesHint: "Preview images, audio, and video. Download any file.",
|
|
303
|
+
filesPreviewFailed: "Could not load this preview.", filesDownloadFailed: "Could not download this file.",
|
|
304
|
+
filesPreviewLabel: ({ name }) => `Preview ${name}`, filesDownloadLabel: ({ name }) => `Download ${name}`,
|
|
305
|
+
filesDeleteLabel: ({ name }) => `Delete ${name}`, filesRefresh: "Refresh files",
|
|
290
306
|
earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
|
|
291
307
|
savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
|
|
292
308
|
copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.", wrapCode: "Wrap code",
|
|
@@ -308,6 +324,7 @@ export const messages = {
|
|
|
308
324
|
roomsMenu: "Open room list", closeRoomList: "Close room list",
|
|
309
325
|
direct: "Direct", messagePrivately: "Message privately", removeMember: "Remove",
|
|
310
326
|
kickConfirm: ({ name }) => `Remove ${name} from this room? They can rejoin with the room ID.`,
|
|
327
|
+
leaveRoomConfirm: ({ name }) => `Leave “${name}”? You will leave this room; you can rejoin later with its ID.`,
|
|
311
328
|
deleteRoom: "Delete room", deleteConfirm: ({ name }) => `Delete “${name}” and all its messages? This cannot be undone.`,
|
|
312
329
|
allMembers: "Everyone", messageCount: ({ count }) => `${count} / 5000`,
|
|
313
330
|
pasteAsFile: ({ count }) => `Pasted ${count} characters saved as a text file`,
|
|
@@ -348,7 +365,7 @@ export const messages = {
|
|
|
348
365
|
bearerToken: "Bearer Token", tokenPlaceholder: "服务器要求时填写", save: "保存",
|
|
349
366
|
tokenHint: "若服务器设置了访问令牌(401),所有请求都会带上它。", existingRooms: "房间",
|
|
350
367
|
noRooms: "还没有房间,创建一个吧。", copyRoomId: "复制房间 ID", loadingHistory: "正在加载更早的消息",
|
|
351
|
-
editRoom: "编辑房间", roomOwnerOnlyTitle: "仅房主或管理员可修改", roomOwnerOnlyNote: ({ owner }) => `只有房主或房间管理员可以修改这些设置。这个房间属于 ${owner}。`, roomNameLabel: "房间名称", roomDescriptionLabel: "描述", adminAgentLabel: "管理员 Agent", roomOwnerBadge: "房主", roomAdminBadge: "管理员",
|
|
368
|
+
editRoom: "编辑房间", editRoomSections: "编辑房间分区", editRoomDetails: "房间信息", editRoomJoining: "加入与审核", editRoomMembers: "成员与角色", editRoomOwnership: "所有权", roomOwnerOnlyTitle: "仅房主或管理员可修改", roomOwnerOnlyNote: ({ owner }) => `只有房主或房间管理员可以修改这些设置。这个房间属于 ${owner}。`, roomNameLabel: "房间名称", roomDescriptionLabel: "描述", adminAgentLabel: "管理员 Agent", roomOwnerBadge: "房主", roomAdminBadge: "管理员",
|
|
352
369
|
adminIdsLabel: "成员管理员", adminIdsHint: "这些成员可以修改房间信息、管理成员、删除文件并指定接任者。房主始终拥有这些权限。", adminIdsEmpty: "房间里暂无其他成员。", newOwnerLabel: "新房主", newOwnerHint: "可以把房间交给房间里的另一个人。只有房主可以操作;Agent 不能成为房主。",
|
|
353
370
|
successorLabel: "房主离开后的接任者", successorNone: "最早加入的成员", successorHint: "房主离开后,此人接任房主;管理员离开后,此人接任管理员。留空则最早加入的成员接任房主。", ownerOnlySettingsNote: "只有房主可以更改管理员 Agent 或移交房间。", adminAgentHint: "被指定的 Agent 可用 admin 工具查看此房间及其历史。只有房主可以更改,留空表示不指定。",
|
|
354
371
|
noAdminAgent: "不指定", openQuestions: ({ count }) => `${count} 个待回答的问题`,
|
|
@@ -366,6 +383,7 @@ export const messages = {
|
|
|
366
383
|
reminderCreated: "提醒已创建。", reminderUpdated: "提醒已更新。", reminderDeleted: "提醒已删除。",
|
|
367
384
|
reminderInvalid: "请检查日期、5 字段 CRON 表达式、IANA 时区和提醒内容。", reminderLoadFailed: "无法加载提醒,草稿仍已保留。",
|
|
368
385
|
diagramLoading: "正在渲染图表…", diagramRenderFailed: "图表无法显示,以下为源代码。", resourceLoading: "正在加载文件…", resourceFailed: "无法加载此文件。", resourceDownload: "下载", resourceMoreActions: "{name} 的更多操作", resourcePreview: "预览", resourceHide: "收起预览", zoomImage: "查看大图", imagePreviewTitle: "图片预览", imageZoomControls: "图片缩放", zoomIn: "放大", zoomOut: "缩小", zoomReset: "重置缩放", installTitle: "安装 OC Chat", installBody: "添加到主屏幕,获得全屏聊天体验。", installAction: "安装", installHow: "如何安装", installNotNow: "暂不", installIosGuide: "点击共享按钮,然后选择“添加到主屏幕”。",
|
|
386
|
+
pwaUpdateTitle: "有可用更新", pwaUpdateBody: "新版本已准备好。可以立即刷新,或下次打开时再升级。", pwaUpdateNow: "立即升级", pwaUpdateLater: "稍后",
|
|
369
387
|
announcementDelete: "删除公告",
|
|
370
388
|
announcementNew: "新建公告", announcementEmpty: "暂无公告。", announcementLoading: "正在加载公告…",
|
|
371
389
|
announcementLoadFailed: "无法加载公告,草稿仍已保留。", announcementSaved: "公告已保存。", announcementDeleted: "公告已删除。",
|
|
@@ -396,10 +414,25 @@ export const messages = {
|
|
|
396
414
|
shortcutsTitle: "键盘快捷键", shortcutsLead: "ChatRoom 快捷键。按 {modifier} + / 打开此列表。",
|
|
397
415
|
shortcutsOpen: "全部快捷键",
|
|
398
416
|
shortcutsWriting: "输入", shortcutsSend: "发送消息", shortcutsNewline: "换行",
|
|
399
|
-
shortcutsMention: "选择要提及的成员", shortcutsRooms: "房间",
|
|
417
|
+
shortcutsMention: "选择要提及的成员", shortcutsRooms: "房间", shortcutsSearch: "搜索与命令", shortcutsOpenPalette: "打开搜索与命令面板",
|
|
400
418
|
shortcutsSwitchRoom: "切换到上一个或下一个房间", shortcutsNumberRoom: "按编号切换到已加入的房间", shortcutsReading: "阅读",
|
|
401
419
|
shortcutsScroll: "输入时滚动消息", shortcutsJump: "跳到会话开头或结尾", shortcutsMenus: "菜单和对话框",
|
|
402
420
|
shortcutsClose: "关闭当前菜单、面板或对话框",
|
|
421
|
+
paletteTitle: "搜索与命令", paletteSearchLabel: "搜索消息",
|
|
422
|
+
palettePlaceholder: "搜索消息,输入 > 使用命令", paletteScopeRoom: "当前房间", paletteScopeAll: "全部房间",
|
|
423
|
+
paletteScopeHint: "按 Tab 在当前房间和全部已加入房间之间切换", paletteSearchMode: "搜索", paletteCommandMode: "命令",
|
|
424
|
+
paletteSearching: "正在搜索…", paletteNoResults: "没有找到消息。", paletteNoCommands: "没有匹配的命令。",
|
|
425
|
+
paletteResults: ({ count }) => `${count} 条结果`, paletteCommandsHint: "常用命令",
|
|
426
|
+
paletteHint: "↑↓ 或 Alt+1–9 选择 · Enter 打开 · Tab 切换范围 · Esc 关闭", paletteSearchFailed: "搜索失败,请重试。",
|
|
427
|
+
paletteLeaveRoom: "离开房间", paletteJumpLatest: "跳到最新消息",
|
|
428
|
+
filesTitle: "文件", filesEyebrow: "房间文件", filesFilter: "上传者", filesEveryone: "所有人",
|
|
429
|
+
filesUnknownUploader: "未知上传者", filesSummary: ({ count, size }) => `${count} 个文件 · ${size}`,
|
|
430
|
+
filesLoading: "正在加载文件…", filesLoadFailed: "无法加载文件,请重试。", filesEmpty: "这个房间还没有文件。",
|
|
431
|
+
filesEmptyFiltered: "此上传者没有文件。", filesLoadMore: "加载更多",
|
|
432
|
+
filesHint: "可预览图片、音频和视频,所有文件都可下载。",
|
|
433
|
+
filesPreviewFailed: "无法加载预览。", filesDownloadFailed: "无法下载此文件。",
|
|
434
|
+
filesPreviewLabel: ({ name }) => `预览 ${name}`, filesDownloadLabel: ({ name }) => `下载 ${name}`,
|
|
435
|
+
filesDeleteLabel: ({ name }) => `删除 ${name}`, filesRefresh: "刷新文件",
|
|
403
436
|
joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
|
|
404
437
|
today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
|
|
405
438
|
savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
|
|
@@ -418,6 +451,7 @@ export const messages = {
|
|
|
418
451
|
roomListError: "无法加载房间列表,可直接输入房间 ID 加入。", guest: "访客", roomsLabel: "房间列表",
|
|
419
452
|
refreshRooms: "刷新房间", identityLabel: ({ name }) => `当前昵称:${name}`, roomsMenu: "打开房间列表", closeRoomList: "关闭房间列表", direct: "私聊",
|
|
420
453
|
messagePrivately: "私聊", removeMember: "移除", kickConfirm: ({ name }) => `确定将 ${name} 移出此房间?对方仍可用房间 ID 重新加入。`,
|
|
454
|
+
leaveRoomConfirm: ({ name }) => `离开“${name}”?你将离开这个房间,之后可以用房间 ID 重新加入。`,
|
|
421
455
|
deleteRoom: "删除房间", deleteConfirm: ({ name }) => `删除“${name}”及全部聊天记录?此操作无法撤销。`,
|
|
422
456
|
allMembers: "所有人", messageCount: ({ count }) => `${count} / 5000`,
|
|
423
457
|
pasteAsFile: ({ count }) => `已把粘贴的 ${count} 个字符保存为文本文件`,
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
.copy-id.copied .copy-ok { display: inline; color: var(--accent); }
|
|
35
35
|
|
|
36
36
|
.chat-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
|
|
37
|
-
.chat-head .action-icon { width: 19px; height: 19px;
|
|
37
|
+
.chat-head .action-icon { width: 19px; height: 19px; }
|
|
38
38
|
.panel.question-panel { width: min(720px, calc(100vw - 32px)); max-height: min(86vh, 820px); overflow: auto; }
|
|
39
39
|
.questions-trigger { position: relative; }
|
|
40
40
|
.question-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
|
|
@@ -189,6 +189,7 @@
|
|
|
189
189
|
box-shadow: var(--shadow);
|
|
190
190
|
transition: filter .12s, transform .1s;
|
|
191
191
|
}
|
|
192
|
+
.jump .fluent-icon { width: 18px; height: 18px; }
|
|
192
193
|
.jump:hover { filter: brightness(1.07); }
|
|
193
194
|
.jump:active { transform: translateY(1px); }
|
|
194
195
|
.jump .badge {
|
|
@@ -264,13 +265,13 @@
|
|
|
264
265
|
transition: color .14s, background .14s, border-color .14s;
|
|
265
266
|
}
|
|
266
267
|
.msg.own .message-copy { align-self: flex-end; margin-right: 4px; }
|
|
267
|
-
.message-copy-icon { display: block; width: 16px; height: 16px;
|
|
268
|
+
.message-copy-icon { display: block; width: 16px; height: 16px; }
|
|
268
269
|
.message-copy:hover, .message-copy:focus-visible, .message-copy.is-flashing { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
|
|
269
270
|
.message-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
270
271
|
.message-copy-feedback { position: absolute; z-index: 25; left: 0; bottom: calc(100% + 5px); width: max-content; max-width: min(260px, calc(100vw - 32px)); padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-size: 11px; font-weight: 500; line-height: 1.4; text-align: left; white-space: normal; overflow-wrap: anywhere; }
|
|
271
272
|
.message-actions { display: flex; align-items: center; gap: 2px; }
|
|
272
273
|
.message-reply { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 8px; color: var(--ink-3); background: transparent; cursor: pointer; }
|
|
273
|
-
.message-reply-icon { display: block; width: 16px; height: 16px;
|
|
274
|
+
.message-reply-icon { display: block; width: 16px; height: 16px; }
|
|
274
275
|
.message-reply:hover, .message-reply:focus-visible { border-color: var(--line); color: var(--accent); background: var(--accent-soft); }
|
|
275
276
|
.reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(940px, 100%); min-width: 0; margin: 0 auto; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--accent-soft); }
|
|
276
277
|
.reply-preview > div { min-width: 0; flex: 1; }
|
|
@@ -297,7 +298,7 @@
|
|
|
297
298
|
.reader-panel-head .hint { margin: 0 0 4px; }
|
|
298
299
|
.reader-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 10px; color: var(--ink-2); background: transparent; font: inherit; cursor: pointer; transition: background .14s, border-color .14s, color .14s; }
|
|
299
300
|
.reader-close:hover { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
|
|
300
|
-
.close-icon { width: 20px; height: 20px;
|
|
301
|
+
.close-icon { width: 20px; height: 20px; }
|
|
301
302
|
.reader-panel .receipt-reader-list li { display: grid; gap: 3px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
|
|
302
303
|
.image-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 20px; overflow: hidden; border: 0; background: transparent; }
|
|
303
304
|
.image-dialog[open] { display: flex; align-items: center; justify-content: center; }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* Edit room: a settings-style tabbed dialog with a fixed footer. */
|
|
2
|
+
#editRoomDialog {
|
|
3
|
+
width: min(920px, calc(100vw - 32px));
|
|
4
|
+
max-width: none;
|
|
5
|
+
height: min(680px, calc(100dvh - 40px));
|
|
6
|
+
max-height: none;
|
|
7
|
+
margin: auto;
|
|
8
|
+
padding: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border-radius: 22px;
|
|
11
|
+
}
|
|
12
|
+
#editRoomDialog[open] { display: flex; flex-direction: column; animation: edit-room-in .18s ease-out both; }
|
|
13
|
+
@keyframes edit-room-in { from { opacity: 0; transform: translateY(8px); } }
|
|
14
|
+
#editRoomDialog::backdrop { background: rgb(8 20 16 / .52); backdrop-filter: blur(5px); }
|
|
15
|
+
|
|
16
|
+
#editRoomDialog .edit-room-head { flex: none; align-items: flex-start; padding: 22px 24px 14px; }
|
|
17
|
+
#editRoomDialog .edit-room-head h2 { margin: 0; }
|
|
18
|
+
|
|
19
|
+
#editRoomDialog .edit-room-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
|
|
20
|
+
#editRoomDialog .edit-room-body { display: grid; flex: 1; grid-template-columns: 224px minmax(0, 1fr); min-height: 0; }
|
|
21
|
+
#editRoomDialog .edit-room-nav { padding-top: 2px; }
|
|
22
|
+
#editRoomDialog .edit-room-content { min-width: 0; }
|
|
23
|
+
#editRoomDialog .edit-room-panel { padding-top: 2px; }
|
|
24
|
+
|
|
25
|
+
#editRoomDialog .edit-room-hint { margin: -2px 0 18px; }
|
|
26
|
+
#editRoomDialog .admin-fieldset .hint:last-child { margin-bottom: 0; }
|
|
27
|
+
#editRoomDialog .edit-room-owner-note {
|
|
28
|
+
margin: 4px 0 0;
|
|
29
|
+
padding: 10px 12px;
|
|
30
|
+
border-left: 2px solid var(--accent);
|
|
31
|
+
border-radius: 0 8px 8px 0;
|
|
32
|
+
background: color-mix(in srgb, var(--accent-soft) 58%, transparent);
|
|
33
|
+
line-height: 1.5;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#editRoomDialog .edit-room-footer {
|
|
37
|
+
display: grid;
|
|
38
|
+
flex: none;
|
|
39
|
+
gap: 6px;
|
|
40
|
+
padding: 10px 24px calc(14px + env(safe-area-inset-bottom));
|
|
41
|
+
border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
|
|
42
|
+
background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
|
|
43
|
+
}
|
|
44
|
+
#editRoomDialog .edit-room-status { margin: 0; color: var(--danger); font-size: 12.5px; line-height: 1.45; }
|
|
45
|
+
#editRoomDialog .edit-room-status:empty { min-height: 0; }
|
|
46
|
+
#editRoomDialog .edit-room-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
47
|
+
#editRoomDialog .edit-room-actions .btn { min-width: 96px; }
|
|
48
|
+
|
|
49
|
+
@media (max-width: 760px) {
|
|
50
|
+
#editRoomDialog { width: calc(100vw - 20px); height: calc(100dvh - 24px); border-radius: 18px; }
|
|
51
|
+
#editRoomDialog .edit-room-head { padding: 16px 16px 10px; }
|
|
52
|
+
#editRoomDialog .edit-room-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
|
|
53
|
+
#editRoomDialog .edit-room-nav {
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
56
|
+
gap: 4px;
|
|
57
|
+
padding: 0 10px 10px;
|
|
58
|
+
border-right: 0;
|
|
59
|
+
border-bottom: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
|
|
60
|
+
overflow: visible;
|
|
61
|
+
}
|
|
62
|
+
#editRoomDialog[data-owner="false"] .edit-room-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
63
|
+
#editRoomDialog .edit-room-nav .settings-tab {
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
gap: 4px;
|
|
67
|
+
min-height: 58px;
|
|
68
|
+
padding: 6px 3px;
|
|
69
|
+
font-size: 10.5px;
|
|
70
|
+
line-height: 1.2;
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
#editRoomDialog .edit-room-nav .settings-tab svg { width: 16px; height: 16px; }
|
|
74
|
+
#editRoomDialog .edit-room-panel { padding: 10px 16px 22px; }
|
|
75
|
+
#editRoomDialog .edit-room-footer { padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
|
|
76
|
+
#editRoomDialog .edit-room-actions .btn { flex: 1; min-height: 44px; }
|
|
77
|
+
}
|