崮生(子虚) 7fceccfe4d 重构前端UI,新增字体上传/下载/模糊匹配功能
- 前端UI重构:字体选择器、文本预览、CSS输出+复制、下载字体、上传区域
- 后端新增API:/api/fonts(列出字体)、/api/config(公开配置)、/api/upload(上传字体)
- 字体查找支持模糊匹配(精确 > 前缀 > 包含)
- 上传功能分两种模式:临时上传(ENV开关,FIFO上限10个)和管理员上传(API Key认证)
- 新增multipart解析器、配置模块、文件系统抽象(writeFile/readdir/mkdir/unlink)
- 后端启动时等待运行时初始化完成,确保接口可用
- dev-all.ts后端启用tsx watch模式自动重载

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 16:18:46 +08:00

38 lines
889 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { implInterface } from "../interface";
implInterface({
async stat(path) {
const r = await tjs.stat(path);
return {
isFile: () => r.isFile,
size: r.size,
};
},
readFile(path) {
return tjs.readFile(path);
},
writeFile(path, data) {
return tjs.writeFile(path, data);
},
async readdir(path) {
const entries: { isFile: () => boolean; name: string }[] = [];
const dir = await tjs.readDir(path);
for await (const entry of dir) {
entries.push({
isFile: () => entry.isFile,
name: entry.name,
});
}
await dir.close();
return entries;
},
/** TJS 没有 mkdir通过写入占位文件来确保目录存在 */
async mkdir(path) {
const placeholder = path + "/.keep";
await tjs.writeFile(placeholder, new Uint8Array(0));
},
unlink(path) {
return tjs.remove(path);
},
});