feat: 完善账号管理与扩展体验
CI / config (push) Canceled after 0s
CI / test-frontend (push) Canceled after 0s
CI / test-rust (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-e2e-release (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / release (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / docker-website (push) Canceled after 0s

补齐普通用户自助账号、中文设置与快捷键提示,修复大型扩展安装和移动端弹窗,并按服务器能力限制不兼容扩展。

Co-Authored-By: Codex <noreply@anthropic.com>
This commit is contained in:
2026-08-12 22:13:23 +08:00
co-authored by Codex
parent 679bf134e7
commit db73584e2b
43 changed files with 1090 additions and 114 deletions
+3
View File
@@ -12,6 +12,9 @@ export function base64Encode(buffer: Uint8Array | string): string {
if (typeof buffer === "string") {
buffer = new TextEncoder().encode(buffer);
}
if (!(buffer instanceof Uint8Array)) {
throw new TypeError("base64Encode requires text or binary data");
}
let binary = "";
const len = buffer.byteLength;
for (let i = 0; i < len; i++) {
+14 -11
View File
@@ -3,15 +3,18 @@ export const isMacLike =
/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
export function prettifyShortcut(shortcut: string): string {
if (!isMacLike) return shortcut;
const pretty = shortcut
.replace(/Mod-/g, "⌘")
.replace(/Cmd-/g, "⌘")
.replace(/Ctrl-/g, "⌃")
.replace(/Alt-/g, "⌥")
.replace(/Shift-/g, "⇧");
return pretty.replace(
/([⌘⌃⌥⇧])([a-z])$/,
(_, mod, key) => mod + key.toUpperCase(),
);
let pretty = shortcut;
if (isMacLike) {
pretty = pretty
.replace(/Mod-/g, "⌘")
.replace(/Cmd-/g, "⌘")
.replace(/Ctrl-/g, "⌃")
.replace(/Alt-/g, "⌥")
.replace(/Shift-/g, "⇧")
.replace(/([⌘⌃⌥⇧])([a-z])$/, (_, mod, key) => mod + key.toUpperCase());
}
return pretty
.replaceAll("Backspace", "退格")
.replaceAll("Escape", "退出键")
.replaceAll("Enter", "回车键");
}
+16
View File
@@ -153,6 +153,11 @@ export function readFile(name: string): Promise<Uint8Array> {
return syscall("space.readFile", name);
}
/** Read a file as Base64 without transferring binary data across a plug worker. */
export function readFileBase64(name: string): Promise<string> {
return syscall("space.readFileBase64", name);
}
/**
* Reads a reference (e.g. page#header or page@20) and returns it as a string
*/
@@ -192,6 +197,17 @@ export function writeFile(name: string, data: Uint8Array): Promise<FileMeta> {
return syscall("space.writeFile", name, data);
}
/**
* Write a Base64-encoded file to the space. This avoids browser-specific
* TypedArray serialization issues at the plug worker boundary.
*/
export function writeFileBase64(
name: string,
base64Data: string,
): Promise<FileMeta> {
return syscall("space.writeFileBase64", name, base64Data);
}
/**
* Delete a file from the space.
* @param name the name of the file to delete
+10
View File
@@ -101,6 +101,16 @@ export function getVersion(): Promise<string> {
return syscall("system.getVersion");
}
export type SystemCapabilities = {
shell: boolean;
runtimeApi: boolean;
};
/** Returns optional server capabilities available to the current space. */
export function getCapabilities(): Promise<SystemCapabilities> {
return syscall("system.getCapabilities");
}
export function getConfig<T = any>(
key: string,
defaultValue: any = undefined,