ai_co_discuss 0.4.55 → 0.4.57
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/docs/runner.md +1 -1
- package/frontend/locales/en/discussion.json +10 -10
- package/frontend/locales/en/room.json +3 -3
- package/frontend/locales/en/settings.json +4 -4
- package/package.json +1 -1
- package/runner/os_users.mjs +22 -7
- package/web/app.js +61 -8
- package/web/i18n.js +1 -1
- package/web/markdown.js +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +51 -51
package/docs/runner.md
CHANGED
|
@@ -57,7 +57,7 @@ Windows 上在终端运行 `codiscuss setup` 时,“安装配置”一步有
|
|
|
57
57
|
|
|
58
58
|
房间设置了项目目录后,左栏“房间”下方的“文件”页可浏览电脑上的文件夹与文件,查看大小和修改时间。点击文件打开悬浮预览,支持文本、Markdown 渲染与 HTML 静态渲染,并可切换源码。图片可缩放、旋转(聊天里点开图片附件也一样);视频和音频用带倍速、全屏的播放器直接播放(聊天里的音视频附件同样)(浏览器解不了的格式如 AVI、WMV 请下载后用本机软件打开);CSV 显示为表格,字幕(SRT、VTT、ASS、LRC)显示为时间轴;Word、Excel、PowerPoint 与 PDF 文档只读预览(Word 和 PDF 按窗口宽度显示整页)(Excel 只显示数值,不含样式与图表;PowerPoint 的还原度因文件而异);Premiere 工程解压后显示其 XML,fcpxml 等文本格式的剪辑工程按文本显示。在其他设备上经电脑查看时,图片、音视频和文档整份传过去再显示,单个文件最多 64 MB。Markdown 里用相对路径引用的项目图片(PNG、JPEG、GIF 动图、WebP、SVG 等)会直接显示,其他设备经电脑查看时同样能看到;找不到或在项目目录外的图片在预览顶部列出。可同时打开多个文件,以标签切换;标题栏的“收起”(手机上也可按住标签栏下拉,或正文在顶部时下拉)把预览缩成内容区左上角的悬浮按钮,悬浮按钮可拖到左侧或右侧;切到其他频道或其他房间后点它回到原处(打开的文件、模式和滚动位置都保留),关闭才清空。未设置项目目录时入口灰显。
|
|
59
59
|
|
|
60
|
-
在 Markdown
|
|
60
|
+
在 Markdown 预览或成员回答正文中选中文字后点“添加到对话”,选中处上方出现批注框(可留空),回车后这段文字成为一条注释,原文末尾标上编号;文件注释随即收起预览、回到“消息”页。输入框上方显示“N 条注释”,点开可逐条查看、修改批注或删除,悬停时的 × 一次移除全部;点原文上的编号也能重新编辑批注或删除该条。发送时每段注释以“文件路径 + 行号”或“成员名 + 消息编号”加引用原文与批注附在正文之后,引用中的 @ 不会唤醒成员。
|
|
61
61
|
|
|
62
62
|
其他设备通过已配对电脑的加密连接读取同一目录。文件内容最多预览前 128 KB,支持 UTF-8 和带 BOM 的 UTF-16;HTML 展示内联样式与内嵌图片。文件访问限于房间项目目录,目录外的链接灰显。
|
|
63
63
|
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"发言快速导航": "Quick message navigation",
|
|
103
103
|
"· 主持人": "· Host",
|
|
104
104
|
"· 运行回执": "· Run receipt",
|
|
105
|
-
"
|
|
105
|
+
"把选中的文字作为注释添加到对话": "Add selected text to the conversation as a note",
|
|
106
106
|
"添加到对话": "Add to conversation",
|
|
107
107
|
"从选中处开始朗读": "Read from selection",
|
|
108
108
|
"添加批注(可选)": "Add a comment (optional)",
|
|
109
|
-
"
|
|
109
|
+
"注释的批注(可选)": "Note annotation (optional)",
|
|
110
110
|
"取消添加": "Cancel adding",
|
|
111
111
|
"取消": "Cancel",
|
|
112
112
|
"添加到对话(Enter)": "Add to conversation (Enter)",
|
|
@@ -182,8 +182,8 @@
|
|
|
182
182
|
"编辑后的消息": "Edited message",
|
|
183
183
|
"正在读取回退范围…": "Reading rollback scope…",
|
|
184
184
|
"回退并发送": "Roll back and send",
|
|
185
|
-
"
|
|
186
|
-
"
|
|
185
|
+
"注释 {value1}:点击修改批注": "Note {value1}: click to edit annotation",
|
|
186
|
+
"修改注释 {value1} 的批注": "Edit annotation for note {value1}",
|
|
187
187
|
"展开全文": "Show full text",
|
|
188
188
|
"收起回答": "Collapse reply",
|
|
189
189
|
"展开完整回答": "Expand full reply",
|
|
@@ -250,15 +250,15 @@
|
|
|
250
250
|
"没有匹配的成员": "No matching members",
|
|
251
251
|
"发消息到 # {value1}": "Message # {value1}",
|
|
252
252
|
"留言正文": "Message text",
|
|
253
|
-
"
|
|
254
|
-
"{value1}
|
|
255
|
-
"
|
|
256
|
-
"
|
|
253
|
+
"查看注释、修改批注": "View notes and edit annotations",
|
|
254
|
+
"{value1} 条注释": "{value1} notes",
|
|
255
|
+
"移除全部注释": "Remove all notes",
|
|
256
|
+
"注释": "Notes",
|
|
257
257
|
"选中文字 · {value1}": "Selected text · {value1}",
|
|
258
258
|
"批注": "Annotation",
|
|
259
|
-
"
|
|
259
|
+
"注释的批注": "Note comment",
|
|
260
260
|
"修改批注": "Edit annotation",
|
|
261
|
-
"
|
|
261
|
+
"移除注释 {value1}": "Remove note {value1}",
|
|
262
262
|
"移除": "Remove",
|
|
263
263
|
"项目文件夹": "Project folder",
|
|
264
264
|
"移除 {value1}": "Remove {value1}",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"允许并重发": "Allow and resend",
|
|
34
34
|
"把这些操作加入该成员的放行规则(下次执行起生效),并把原消息填回输入框": "Allow these operations for this member starting with the next run, and restore the original message in the composer",
|
|
35
35
|
"添加批注(可选)": "Add a comment (optional)",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
36
|
+
"注释的批注": "Note comment",
|
|
37
|
+
"移除这条注释": "Remove this note",
|
|
38
|
+
"移除注释": "Remove note",
|
|
39
39
|
"沿用这个目标重新开启 Goal,需本机接入程序在运行": "Restart Goal with this objective; the local runner must be running",
|
|
40
40
|
"过程说明": "Progress notes",
|
|
41
41
|
"正在读取过程说明": "Loading progress notes",
|
|
@@ -407,13 +407,13 @@
|
|
|
407
407
|
"内容": "Contents",
|
|
408
408
|
"正在载入页面引用的文件…": "Loading files referenced by the page…",
|
|
409
409
|
"HTML 文件预览": "HTML file preview",
|
|
410
|
-
"
|
|
411
|
-
"
|
|
412
|
-
"
|
|
410
|
+
"注释 {value1}:点击修改批注": "Note {value1}: click to edit annotation",
|
|
411
|
+
"修改注释 {value1} 的批注": "Edit annotation for note {value1}",
|
|
412
|
+
"把选中的文字作为注释添加到对话": "Add selected text to the conversation as a note",
|
|
413
413
|
"添加到对话": "Add to conversation",
|
|
414
414
|
"从选中处开始朗读": "Read from selection",
|
|
415
415
|
"添加批注(可选)": "Add a comment (optional)",
|
|
416
|
-
"
|
|
416
|
+
"注释的批注(可选)": "Note annotation (optional)",
|
|
417
417
|
"取消添加": "Cancel adding",
|
|
418
418
|
"添加到对话(Enter)": "Add to conversation (Enter)",
|
|
419
419
|
"手动滚动即取消跟随": "Scroll manually to stop following",
|
package/package.json
CHANGED
package/runner/os_users.mjs
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* owner's files. The owner's management panel creates the user (one elevation prompt), runs programs as it with the
|
|
6
6
|
* stored password, installs the command-line programs where every user can run them, and signs them in.
|
|
7
7
|
*
|
|
8
|
-
* The password is kept in the owner's service directory,
|
|
9
|
-
* the owner
|
|
8
|
+
* The password is kept in the owner's service directory, which only the owner and administrators can read, encrypted with
|
|
9
|
+
* Windows DPAPI for this computer. The computer scope, not the owner's own, because an administrator signed in over SSH
|
|
10
|
+
* with a key has no user DPAPI key (Windows answers "Access is denied"; seen 2026-11-15 on the hosting test computer),
|
|
11
|
+
* and hosted computers are managed over SSH. Passwords saved earlier with the owner's scope still work where that scope
|
|
12
|
+
* does. Everything here is Windows only.
|
|
10
13
|
*/
|
|
11
14
|
import { spawnSync } from 'node:child_process';
|
|
12
15
|
import { randomBytes } from 'node:crypto';
|
|
@@ -33,6 +36,9 @@ const JOB_ROOT = join(SHARED_ROOT, 'jobs');
|
|
|
33
36
|
// the shared folder, so they cannot depend on it already being secure.
|
|
34
37
|
const OWNER_JOB_ROOT = join(tmpdir(), 'codiscuss-owner-jobs');
|
|
35
38
|
const POWERSHELL = 'powershell.exe';
|
|
39
|
+
// Stored passwords encrypted for this computer start with this; older ones are the owner's DPAPI (ConvertFrom-SecureString).
|
|
40
|
+
const MACHINE_SECRET = 'machine:';
|
|
41
|
+
const SECRET_ENTROPY = 'AI CoDiscuss hosted account';
|
|
36
42
|
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
37
43
|
const ELEVATED_TIMEOUT_MS = 300_000;
|
|
38
44
|
|
|
@@ -158,9 +164,16 @@ exit $process.ExitCode`;
|
|
|
158
164
|
} finally { rmSync(job, { recursive: true, force: true }); }
|
|
159
165
|
}
|
|
160
166
|
|
|
161
|
-
/**
|
|
167
|
+
/** A password encrypted with DPAPI for this computer; what keeps it private is the owner-only file it is stored in. */
|
|
162
168
|
function protect(password) {
|
|
163
|
-
return run_powershell(`
|
|
169
|
+
return MACHINE_SECRET + run_powershell(`Add-Type -AssemblyName System.Security
|
|
170
|
+
[Convert]::ToBase64String([Security.Cryptography.ProtectedData]::Protect([Text.Encoding]::UTF8.GetBytes(${quote(password)}), [Text.Encoding]::UTF8.GetBytes(${quote(SECRET_ENTROPY)}), 'LocalMachine'))`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** A PowerShell expression giving the stored password back as a SecureString (either encryption). */
|
|
174
|
+
function secure_secret(secret) {
|
|
175
|
+
if (!secret.startsWith(MACHINE_SECRET)) return `(ConvertTo-SecureString ${quote(secret)})`;
|
|
176
|
+
return `(& { Add-Type -AssemblyName System.Security; ConvertTo-SecureString ([Text.Encoding]::UTF8.GetString([Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String(${quote(secret.slice(MACHINE_SECRET.length))}), [Text.Encoding]::UTF8.GetBytes(${quote(SECRET_ENTROPY)}), 'LocalMachine'))) -AsPlainText -Force })`;
|
|
164
177
|
}
|
|
165
178
|
|
|
166
179
|
/**
|
|
@@ -173,6 +186,8 @@ export function create_os_user(data, account, account_folder, { run = run_powers
|
|
|
173
186
|
const user = os_user_name(account);
|
|
174
187
|
if (read_os_users(data)[account]) throw new Error(`账号 ${account} 已有 Windows 用户 ${user}`);
|
|
175
188
|
const password = `Cd!${randomBytes(18).toString('base64url')}`;
|
|
189
|
+
// Encrypted before anything changes, so a failure here leaves the computer as it was.
|
|
190
|
+
const secret = protect(password);
|
|
176
191
|
run(`$secure = ConvertTo-SecureString ${quote(password)} -AsPlainText -Force
|
|
177
192
|
if (Get-LocalUser -Name ${quote(user)} -ErrorAction SilentlyContinue) { Set-LocalUser -Name ${quote(user)} -Password $secure }
|
|
178
193
|
else { New-LocalUser -Name ${quote(user)} -Password $secure -PasswordNeverExpires -UserMayNotChangePassword -Description 'AI CoDiscuss hosted account' | Out-Null }
|
|
@@ -180,7 +195,7 @@ if (-not (Get-LocalGroupMember -Group 'Users' -Member ${quote(user)} -ErrorActio
|
|
|
180
195
|
icacls ${quote(account_folder)} /grant ${quote(`${user}:(OI)(CI)M`)} /T /C /Q | Out-Null
|
|
181
196
|
${register_task_script(account, user, '$secure', owner_sid({ run }))}
|
|
182
197
|
'ok'`, { elevated: true });
|
|
183
|
-
write_os_users(data, { ...read_os_users(data), [account]: { user, secret
|
|
198
|
+
write_os_users(data, { ...read_os_users(data), [account]: { user, secret } });
|
|
184
199
|
return { user };
|
|
185
200
|
}
|
|
186
201
|
|
|
@@ -249,7 +264,7 @@ export function run_as_user(data, account, script, { files = {}, folders = {}, v
|
|
|
249
264
|
writeFileSync(job, `\ufeff[Console]::OutputEncoding = [Text.Encoding]::UTF8\n$Job = ${quote(folder)}\n$Out = ${quote(join(folder, 'out'))}\n${script}\n`, 'utf8');
|
|
250
265
|
const command = visible ? `-NoProfile -ExecutionPolicy Bypass -NoExit -File ${quote(job)}`
|
|
251
266
|
: `-NoProfile -ExecutionPolicy Bypass -Command & ${quote(job)} *> ${quote(output)}`;
|
|
252
|
-
const start = `$credential = New-Object System.Management.Automation.PSCredential(${quote(record.user)},
|
|
267
|
+
const start = `$credential = New-Object System.Management.Automation.PSCredential(${quote(record.user)}, ${secure_secret(record.secret)})
|
|
253
268
|
$process = Start-Process ${POWERSHELL} -Credential $credential -LoadUserProfile -WorkingDirectory ${quote(folder)} -PassThru ${visible ? '' : '-WindowStyle Hidden'} -ArgumentList ${quote(command)}
|
|
254
269
|
${wait ? `if (-not $process.WaitForExit(${timeout})) { $process.Kill(); throw '运行超时' }` : ''}
|
|
255
270
|
$process.Id`;
|
|
@@ -520,7 +535,7 @@ $task.SetSecurityDescriptor($task.GetSecurityDescriptor(4) + '(A;;GRGX;;;${sid})
|
|
|
520
535
|
/** Register the instance task of an account isolated before instances ran as tasks (one elevation prompt). */
|
|
521
536
|
function register_instance_task(data, account, { run = run_powershell } = {}) {
|
|
522
537
|
const record = read_os_users(data)[account];
|
|
523
|
-
run(`$secure =
|
|
538
|
+
run(`$secure = ${secure_secret(record.secret)}
|
|
524
539
|
${register_task_script(account, record.user, '$secure', owner_sid({ run }))}
|
|
525
540
|
'ok'`, { elevated: true });
|
|
526
541
|
}
|
package/web/app.js
CHANGED
|
@@ -15,6 +15,10 @@ const SAFETY_REFRESH_MS = 5 * 60 * 1000;
|
|
|
15
15
|
const WORKING_STATUSES = ["dispatched", "started"];
|
|
16
16
|
const UPDATE_BATCH_MS = 100;
|
|
17
17
|
const UPDATE_DRAG_RETRY_MS = 500;
|
|
18
|
+
// A page back from the background after this long shows the opening load until its first full read, instead of old
|
|
19
|
+
// cards that then change all at once; the cap keeps the cards from staying hidden behind a read that never ends.
|
|
20
|
+
const RESUME_LOADING_AFTER_MS = 10000;
|
|
21
|
+
const RESUME_LOADING_MAX_MS = 15000;
|
|
18
22
|
const TOAST_DURATION_MS = 3500;
|
|
19
23
|
// How long an archived room can be taken back before the archive is saved.
|
|
20
24
|
const ARCHIVE_UNDO_MS = 4000;
|
|
@@ -110,7 +114,9 @@ const state = { rooms: [], folders: [], room: null, page: 1, pages: 1, query: ""
|
|
|
110
114
|
reply_to: null, tab: "discussion", refresh_version: 0, context_dirty: false, topic_dirty: false,
|
|
111
115
|
snapshot_id: 0, pending_submission: null, pending_room: null, toast_timer: null, queued_taken: 0,
|
|
112
116
|
// When live room data stopped (page hidden, connection lost); null while it is current. Silence is judged only up to here.
|
|
113
|
-
observed_until: null
|
|
117
|
+
observed_until: null,
|
|
118
|
+
// Back from the background: the transcript shows the opening load until the next full read finishes.
|
|
119
|
+
resuming: false };
|
|
114
120
|
const live_updates = { source: null, connected: false, enabled: false, timer: null, poll_timer: null,
|
|
115
121
|
running: false, dirty: false, full: false, revisions: "", refreshed_at: 0 };
|
|
116
122
|
state.messages = [];
|
|
@@ -2014,7 +2020,8 @@ function attachment_file_icon(file_name) {
|
|
|
2014
2020
|
|
|
2015
2021
|
/**
|
|
2016
2022
|
* Keep original files in memory until sending; reject an invalid selection as a whole. Each file also puts its
|
|
2017
|
-
* placeholder (`[图片 #n]` / `[文件 #n]`, n its position) into the text where it was pasted or dropped,
|
|
2023
|
+
* placeholder (`[图片 #n]` / `[文件 #n]`, n its position) into the text where it was pasted or dropped, or at the caret the
|
|
2024
|
+
* file picker was opened from, else at the end,
|
|
2018
2025
|
* as Claude Code does with a pasted screenshot: the text says where each file belongs, and members read it the same way.
|
|
2019
2026
|
*/
|
|
2020
2027
|
function add_attachments(files, target = null) {
|
|
@@ -2034,6 +2041,15 @@ function add_attachments(files, target = null) {
|
|
|
2034
2041
|
publish_view();
|
|
2035
2042
|
}
|
|
2036
2043
|
|
|
2044
|
+
// The composer's textarea the file picker was opened from: its files' placeholders go where its caret was.
|
|
2045
|
+
let attachment_target = null;
|
|
2046
|
+
|
|
2047
|
+
/** Open the file picker; `target` is the textarea whose caret takes the chosen files' placeholders. */
|
|
2048
|
+
function choose_attachments(target = null) {
|
|
2049
|
+
attachment_target = target;
|
|
2050
|
+
element("attachment-input").click();
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2037
2053
|
/** `[图片 #n]` for an image the page previews, `[文件 #n]` for any other file. */
|
|
2038
2054
|
function draft_placeholder(item, number) {
|
|
2039
2055
|
return `[${item.preview_url ? "图片" : "文件"} #${number}]`;
|
|
@@ -2051,7 +2067,10 @@ function insert_placeholders(text, target) {
|
|
|
2051
2067
|
if (editor !== element("message-input")) return;
|
|
2052
2068
|
}
|
|
2053
2069
|
const input = element("message-input");
|
|
2054
|
-
if (
|
|
2070
|
+
if (editor) return;
|
|
2071
|
+
// Trailing spaces give way to the separating space; a trailing line break is the user's own and stays.
|
|
2072
|
+
const base = input.value.replace(/[ \t]+$/, "");
|
|
2073
|
+
input.value = `${base}${base && !base.endsWith("\n") ? " " : ""}${text} `;
|
|
2055
2074
|
}
|
|
2056
2075
|
|
|
2057
2076
|
/** Deleting a file's placeholder while typing removes that file, as in Claude Code's own prompt; true when one went. */
|
|
@@ -2323,7 +2342,7 @@ async function render_attachment_pdf() {
|
|
|
2323
2342
|
/** Bind the shared picker, paste/drop handlers, and accessible preview dialog once. */
|
|
2324
2343
|
function bind_attachment_controls() {
|
|
2325
2344
|
element("choose-attachments").addEventListener("click", () => element("attachment-input").click());
|
|
2326
|
-
element("attachment-input").addEventListener("change", event => { add_attachments(event.target.files); event.target.value = ""; });
|
|
2345
|
+
element("attachment-input").addEventListener("change", event => { add_attachments(event.target.files, attachment_target); attachment_target = null; event.target.value = ""; });
|
|
2327
2346
|
for (const event of ["dragover", "drop"]) element("message-form").addEventListener(event, drop_attachments);
|
|
2328
2347
|
element("message-input").addEventListener("paste", paste_attachments);
|
|
2329
2348
|
document.addEventListener("click", event => {
|
|
@@ -3057,12 +3076,26 @@ async function relay_room_request_once(path, payload, etag) {
|
|
|
3057
3076
|
return answer;
|
|
3058
3077
|
}
|
|
3059
3078
|
|
|
3079
|
+
/**
|
|
3080
|
+
* Read one part of a room file through the relay, asked again after a dropped or timed-out exchange as other reads
|
|
3081
|
+
* are: a large image takes several parts, and one lost frame would otherwise leave it failed until the page reloads.
|
|
3082
|
+
*/
|
|
3083
|
+
async function relay_file_part(path, offset) {
|
|
3084
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
3085
|
+
try { return await relay_exchange("room-api", { method: "GET", path, offset }); }
|
|
3086
|
+
catch (error) {
|
|
3087
|
+
if (attempt >= RELAY_READ_RETRY_MS.length) throw error;
|
|
3088
|
+
await new Promise((resolve) => setTimeout(resolve, RELAY_READ_RETRY_MS[attempt]));
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3060
3093
|
/** Read a whole file of the computer's rooms through the relay; larger files come in several parts. */
|
|
3061
3094
|
async function relay_room_bytes(path) {
|
|
3062
3095
|
const parts = [];
|
|
3063
3096
|
let offset = 0, total = 0, type = "";
|
|
3064
3097
|
do {
|
|
3065
|
-
const answer = await
|
|
3098
|
+
const answer = await relay_file_part(path, offset);
|
|
3066
3099
|
if (answer.status >= 400) throw Object.assign(new Error(server_text(answer.body?.error_text, answer.body?.error) || t('文件读取失败')), { status: answer.status });
|
|
3067
3100
|
if (typeof answer.body_base64 !== "string") throw new Error(t('文件读取失败'));
|
|
3068
3101
|
const bytes = base64_to_bytes(answer.body_base64);
|
|
@@ -5154,7 +5187,9 @@ async function flush_live_refresh() {
|
|
|
5154
5187
|
while (state.opening) await state.opening.catch(() => {});
|
|
5155
5188
|
await refresh_room({ room: full });
|
|
5156
5189
|
if (full && state.observed_until !== null) { state.observed_until = null; publish_view(); }
|
|
5190
|
+
if (full) end_resuming();
|
|
5157
5191
|
} catch (error) {
|
|
5192
|
+
end_resuming();
|
|
5158
5193
|
console.warn("refresh failed", error);
|
|
5159
5194
|
if (state.reconnecting) show_toast(t('仍未连接:{value1}', { value1: error.message }), true);
|
|
5160
5195
|
set_connection(false);
|
|
@@ -5278,6 +5313,24 @@ function stop_live_updates() {
|
|
|
5278
5313
|
live_updates.poll_timer = null;
|
|
5279
5314
|
}
|
|
5280
5315
|
|
|
5316
|
+
let resuming_timer = null;
|
|
5317
|
+
/** After a long stay in the background, show the opening load instead of old cards until the room is read again. */
|
|
5318
|
+
function begin_resuming() {
|
|
5319
|
+
if (!state.room || state.observed_until === null || Date.now() - state.observed_until < RESUME_LOADING_AFTER_MS) return;
|
|
5320
|
+
state.resuming = true;
|
|
5321
|
+
clearTimeout(resuming_timer);
|
|
5322
|
+
resuming_timer = setTimeout(end_resuming, RESUME_LOADING_MAX_MS);
|
|
5323
|
+
publish_view();
|
|
5324
|
+
}
|
|
5325
|
+
|
|
5326
|
+
/** Show the cards again: the room has been read, the read failed, or it took too long. */
|
|
5327
|
+
function end_resuming() {
|
|
5328
|
+
clearTimeout(resuming_timer);
|
|
5329
|
+
if (!state.resuming) return;
|
|
5330
|
+
state.resuming = false;
|
|
5331
|
+
publish_view();
|
|
5332
|
+
}
|
|
5333
|
+
|
|
5281
5334
|
/** Initialize forms and the shared discussion controller. */
|
|
5282
5335
|
async function initialize() {
|
|
5283
5336
|
render_identities();
|
|
@@ -5339,7 +5392,7 @@ async function initialize() {
|
|
|
5339
5392
|
start_live_updates();
|
|
5340
5393
|
document.addEventListener("visibilitychange", () => {
|
|
5341
5394
|
if (document.hidden) stop_live_updates();
|
|
5342
|
-
else { start_live_updates(); load_admin_state(); }
|
|
5395
|
+
else { begin_resuming(); start_live_updates(); load_admin_state(); }
|
|
5343
5396
|
});
|
|
5344
5397
|
window.addEventListener("pagehide", stop_live_updates);
|
|
5345
5398
|
// The network coming back (a phone leaving a lift, a laptop waking) reconnects at once.
|
|
@@ -5364,7 +5417,7 @@ function view_snapshot() {
|
|
|
5364
5417
|
room_site: room_site(), rooms: ordered_rooms(), folders: state.folders, folder_groups: ordered_folders(), room: state.room, archive_view: state.archive_view, directory_sort: state.directory_sort, messages: state.messages, history_cards: state.history_cards, total: state.message_total,
|
|
5365
5418
|
archive_pending: [...state.archive_changes.keys()], import_progress: structuredClone(state.import_progress),
|
|
5366
5419
|
directory_pending: [...state.directory_pending.keys()], folder_pending: [...state.folder_moves.keys()], creating_room: state.creating_room,
|
|
5367
|
-
connected: state.connected, reconnecting: state.reconnecting, rooms_loading: state.rooms_loading, observed_until: state.observed_until, backup_pending: Boolean(state.backup_pending), page: state.page, pages: state.pages, query: state.query,
|
|
5420
|
+
connected: state.connected, reconnecting: state.reconnecting, rooms_loading: state.rooms_loading, observed_until: state.observed_until, resuming: state.resuming, backup_pending: Boolean(state.backup_pending), page: state.page, pages: state.pages, query: state.query,
|
|
5368
5421
|
attachment_drafts: state.attachment_drafts.map(item => ({ id: item.id, file_name: item.file.name, size: item.file.size, preview_url: item.preview_url, placeholder: item.placeholder || "" })),
|
|
5369
5422
|
upload_status: state.upload_status, sending_message: state.sending_message, sending_preview: state.sending_preview, queueing_preview: state.queueing_preview,
|
|
5370
5423
|
failed_sends: state.failed_sends.map((failed) => ({ id: failed.id, ...failed.preview })),
|
|
@@ -5604,7 +5657,7 @@ async function execute_view_action(name, value) {
|
|
|
5604
5657
|
const event = { preventDefault() {} };
|
|
5605
5658
|
const actions = { refresh: refresh_room, room: select_room, tab: select_tab,
|
|
5606
5659
|
archives: toggle_archives, backup: backup_room, backup_rooms, import_rooms, manage_channel, move_channel, create_folder, move_folder, rename_folder, delete_folder, sort_directory,
|
|
5607
|
-
send: () => send_from_composer(event), discard_sending, retry_sending, choose_attachments
|
|
5660
|
+
send: () => send_from_composer(event), discard_sending, retry_sending, choose_attachments, remove_attachment, preview_attachment,
|
|
5608
5661
|
create: (folder_id) => submit_room(event, folder_id), quick_create: quick_create_room, welcome: open_welcome,
|
|
5609
5662
|
save_context: () => save_context(event), save_topic: () => save_topic(event),
|
|
5610
5663
|
filter: filter_view, reply: set_view_reply, cancel_reply, skip_turn,
|