feat: migrate to Cloudflare Workers with icon and version upload

Replace Express/SQLite and web/ with frontend/, worker/, and wrangler deploy. Add optional app icon upload, date-based app_version, and build-app workflow input.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 13:30:05 +08:00
parent 0921e5f7a1
commit b69dfc4813
55 changed files with 3285 additions and 3411 deletions

View File

@@ -0,0 +1,25 @@
export class VersionValidationError extends Error {
constructor(message: string) {
super(message);
this.name = "VersionValidationError";
}
}
/** 当前日期版本,格式如 2026.5.29(月、日不补零) */
export function getDefaultAppVersion(date = new Date()): string {
return `${date.getFullYear()}.${date.getMonth() + 1}.${date.getDate()}`;
}
export function validateAppVersion(input: string): string {
const value = input.trim() || getDefaultAppVersion();
if (!/^\d{4}\.\d{1,2}\.\d{1,2}$/.test(value)) {
throw new VersionValidationError(
"版本号格式应为 YYYY.M.D例如 2026.5.29",
);
}
const [, month, day] = value.split(".").map(Number);
if (month < 1 || month > 12 || day < 1 || day > 31) {
throw new VersionValidationError("版本号中的月或日无效");
}
return value;
}