ai_co_discuss 0.4.87 → 0.4.88
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/frontend/locales/en/app.json +1 -0
- package/package.json +1 -1
- package/runner/i18n_en.mjs +1 -1
- package/runner/launcher.mjs +36 -4
- package/web/app.js +5 -1
- package/web/i18n.js +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +33 -33
|
@@ -149,6 +149,7 @@
|
|
|
149
149
|
"本机连接链接无效或无法保存,请重新运行连接命令;尚未发送启动请求": "The local connection link is invalid or could not be saved. Run the connection command again. No launch request was sent.",
|
|
150
150
|
"无法连接本机服务:请在这台电脑运行 codiscuss local open,并允许浏览器访问本机网络,再重试原请求": "Cannot connect to the local service. Run codiscuss local open on this computer, allow the browser to access the local network, then retry the original request.",
|
|
151
151
|
"本机启动请求失败": "Local launch request failed",
|
|
152
|
+
"本机服务返回了无法识别的内容(HTTP {status}):{excerpt}": "The local service returned an unrecognized response (HTTP {status}): {excerpt}",
|
|
152
153
|
"未知设备": "Unknown device",
|
|
153
154
|
"请在已配对的设备上操作": "Use a paired device",
|
|
154
155
|
"网站上还没有绑定电脑,或电脑的 codiscuss 版本过旧": "No computer is bound to this site, or its codiscuss version is too old",
|
package/package.json
CHANGED
package/runner/i18n_en.mjs
CHANGED
|
@@ -381,7 +381,7 @@ export default {
|
|
|
381
381
|
"外网地址正在设置中,请等它完成": "Public address setup is already running; wait for it to finish",
|
|
382
382
|
"准备": "Preparing",
|
|
383
383
|
"启动隧道": "Start tunnel",
|
|
384
|
-
"
|
|
384
|
+
"启动共议": "Start CoDiscuss",
|
|
385
385
|
"创建快捷方式失败:{value1}": "Failed to create shortcut: {value1}",
|
|
386
386
|
"还没有“共议”程序:先在 codiscuss setup 里勾选创建桌面快捷方式,或运行 codiscuss launcher": "CoDiscuss launcher not found. Select Create desktop shortcut in codiscuss setup, or run codiscuss launcher.",
|
|
387
387
|
"启动器仅支持 Windows": "The launcher supports Windows only",
|
package/runner/launcher.mjs
CHANGED
|
@@ -538,13 +538,45 @@ function installed_script(name) {
|
|
|
538
538
|
return installed && existsSync(installed) ? installed : join(RUNNER, name);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
+
// IShellLinkW keeps the Chinese file and target names intact. WScript.Shell passes them through the ANSI code page, so on a
|
|
542
|
+
// computer whose non-Unicode language is not Chinese "共议" turns into "??" and Save() fails (test machine, 2026-11-19).
|
|
543
|
+
const SHELL_LINK_SOURCE = `using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text;
|
|
544
|
+
public static class CoShortcut {
|
|
545
|
+
[ComImport, Guid("00021401-0000-0000-C000-000000000046")] class ShellLink {}
|
|
546
|
+
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
|
|
547
|
+
interface IShellLinkW {
|
|
548
|
+
void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder file, int size, IntPtr data, int flags);
|
|
549
|
+
void GetIDList(out IntPtr list); void SetIDList(IntPtr list);
|
|
550
|
+
void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder name, int size);
|
|
551
|
+
void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string name);
|
|
552
|
+
void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder dir, int size);
|
|
553
|
+
void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string dir);
|
|
554
|
+
void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder args, int size);
|
|
555
|
+
void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string args);
|
|
556
|
+
void GetHotkey(out short key); void SetHotkey(short key);
|
|
557
|
+
void GetShowCmd(out int show); void SetShowCmd(int show);
|
|
558
|
+
void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path, int size, out int index);
|
|
559
|
+
void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string path, int index);
|
|
560
|
+
void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string path, int reserved);
|
|
561
|
+
void Resolve(IntPtr window, int flags);
|
|
562
|
+
void SetPath([MarshalAs(UnmanagedType.LPWStr)] string file);
|
|
563
|
+
}
|
|
564
|
+
public static void Save(string path, string target, string args, string cwd, string icon, string description) {
|
|
565
|
+
IShellLinkW link = (IShellLinkW)new ShellLink();
|
|
566
|
+
link.SetPath(target); link.SetArguments(args); link.SetWorkingDirectory(cwd); link.SetDescription(description);
|
|
567
|
+
if (!String.IsNullOrEmpty(icon)) link.SetIconLocation(icon, 0);
|
|
568
|
+
((IPersistFile)link).Save(path, true);
|
|
569
|
+
}
|
|
570
|
+
}`;
|
|
571
|
+
|
|
541
572
|
/** Put a shortcut to the exe in a special folder (Desktop, Programs or Startup); values pass through the environment. */
|
|
542
573
|
function write_shortcut(folder, exe, icon, args = '') {
|
|
543
|
-
const script = "$
|
|
544
|
-
+ " $
|
|
545
|
-
+
|
|
574
|
+
const script = "$ErrorActionPreference='Stop'; Add-Type -TypeDefinition $env:SC_SOURCE;"
|
|
575
|
+
+ " $p=Join-Path ([Environment]::GetFolderPath($env:SC_FOLDER)) $env:SC_NAME;"
|
|
576
|
+
+ " [CoShortcut]::Save($p, $env:SC_TARGET, $env:SC_ARGS, $env:SC_CWD, $env:SC_ICON, $env:SC_DESC); Write-Output $p";
|
|
546
577
|
const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', `[Console]::OutputEncoding=[Text.Encoding]::UTF8; ${script}`],
|
|
547
|
-
{ encoding: 'utf8', windowsHide: true, env: { ...process.env, SC_FOLDER: folder, SC_NAME: SHORTCUT_NAME, SC_TARGET: exe,
|
|
578
|
+
{ encoding: 'utf8', windowsHide: true, env: { ...process.env, SC_SOURCE: SHELL_LINK_SOURCE, SC_FOLDER: folder, SC_NAME: SHORTCUT_NAME, SC_TARGET: exe,
|
|
579
|
+
SC_ARGS: args, SC_CWD: dirname(exe), SC_ICON: icon || '', SC_DESC: t('启动共议') } });
|
|
548
580
|
if (result.status !== 0) throw new Error(t('创建快捷方式失败:{value1}', { value1: result.stderr }));
|
|
549
581
|
return result.stdout.trim();
|
|
550
582
|
}
|
package/web/app.js
CHANGED
|
@@ -3178,7 +3178,11 @@ async function local_launch_request(action, payload) {
|
|
|
3178
3178
|
if (!local_connection) throw error;
|
|
3179
3179
|
throw new Error(t('无法连接本机服务:请在这台电脑运行 codiscuss local open,并允许浏览器访问本机网络,再重试原请求'));
|
|
3180
3180
|
}
|
|
3181
|
-
|
|
3181
|
+
// A proxy or tunnel in between may answer with a page instead of JSON; its status says more than the browser's parse error.
|
|
3182
|
+
const raw = await response.text();
|
|
3183
|
+
let result;
|
|
3184
|
+
try { result = JSON.parse(raw); }
|
|
3185
|
+
catch { throw new Error(t('本机服务返回了无法识别的内容(HTTP {status}):{excerpt}', { status: response.status, excerpt: raw.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim().slice(0, 80) })); }
|
|
3182
3186
|
if (!response.ok) throw Object.assign(new Error(server_text(result.error_text, result.error) || t('本机启动请求失败')), { launch: result.launch });
|
|
3183
3187
|
return result;
|
|
3184
3188
|
}
|