Release v0.10.40: Unify CLI and config timestamps to Beijing ISO 8601 (+08:00)

This commit is contained in:
gitea committed 2026-09-28 13:13:00 +08:00
1 parent 465ec1e9c3
commit 44882418c0
36 files changed
+334 -267

No files matched your search

+3 -11
View File
@@ -1,5 +1,6 @@
import { assertHoseAssistTenantMatches, exchangeHoseAssistLink, getHoseProvisionalAuthLink } from "../../core/auth/hose.js";
import { clearCorpTokenCache } from "../../core/auth/token-store.js";
import { formatBeijingIso } from "../../core/config/timestamps.js";
import type { CorpConfig } from "../../core/config/types.js";
import { createSealClient, createSealClientForUrl } from "../../core/http/factory.js";
import { resolveSealCustomHeaders } from "../../core/http/request-headers.js";
@@ -418,14 +419,5 @@ function compactObject<T extends Record<string, unknown>>(value: T): T {
) as T;
}
export function formatBeijingIso(timestampMs: number): string {
const pad = (n: number) => String(n).padStart(2, "0");
const d = new Date(timestampMs + 8 * 3600 * 1000);
const year = d.getUTCFullYear();
const month = pad(d.getUTCMonth() + 1);
const day = pad(d.getUTCDate());
const hour = pad(d.getUTCHours());
const minute = pad(d.getUTCMinutes());
const second = pad(d.getUTCSeconds());
return `${year}-${month}-${day}T${hour}:${minute}:${second}+08:00`;
}
export { formatBeijingIso } from "../../core/config/timestamps.js";
+3 -1
View File
@@ -73,8 +73,10 @@ export function maskCellphone(phone: string | undefined | null): string {
return cleaned;
}
import { formatBeijingIso } from "../../../core/config/timestamps.js";
export function formatUtcTimestampSeconds(timestampMs: number): string {
return new Date(timestampMs).toISOString().replace(/\.\d{3}Z$/, "Z");
return formatBeijingIso(timestampMs);
}
export function stringValue(value: unknown): string | undefined {
+1 -1
View File
@@ -172,7 +172,7 @@ describe("update command bgSave and cache integration", () => {
const cache = loadUpdateCache(tempCacheFile);
expect(cache).not.toBeNull();
expect(cache?.latestVersion).toBe("0.10.99");
expect(cache?.publishedAt).toBe("2026-09-20T12:00:00Z");
expect(cache?.publishedAt).toBe("2026-09-20T20:00:00+08:00");
} finally {
globalThis.fetch = originalFetch;
console.log = originalLog;
+3 -2
View File
@@ -2,6 +2,7 @@ import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSy
import { basename, dirname, isAbsolute, join, relative } from "node:path";
import { spawn, spawnSync } from "node:child_process";
import { isCompiledBinary } from "../../core/runtime.js";
import { normalizeBeijingIso } from "../../core/config/timestamps.js";
import { readInstalledSkillVersion } from "../../core/embedded-skill.js";
import { saveUpdateCache } from "../../core/update-cache.js";
import { VERSION, IS_RELEASE } from "../../version.js";
@@ -755,7 +756,7 @@ async function fetchGitHubReleases(repo: string, limit = 20): Promise<GitHubRele
version,
tagName,
name: item.name ?? tagName,
publishedAt: item.published_at,
publishedAt: item.published_at ? normalizeBeijingIso(item.published_at) : undefined,
author: item.author?.login,
notes: item.body ?? "",
htmlUrl: item.html_url ?? "",
@@ -841,7 +842,7 @@ async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise
version,
tagName,
name: json.name ?? tagName,
publishedAt: json.published_at,
publishedAt: json.published_at ? normalizeBeijingIso(json.published_at) : undefined,
author: json.author?.login,
notes: json.body ?? "",
htmlUrl: json.html_url ?? "",
+3 -2
View File
@@ -1,6 +1,7 @@
import { spawn, execFileSync } from "node:child_process";
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { formatBeijingIso } from "../core/config/timestamps.js";
import { startHttpServer, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST } from "../http/server.js";
export type ServiceConfig = {
@@ -121,7 +122,7 @@ async function runService(config: ServiceConfig) {
port,
host,
version: config.version,
startedAt: new Date().toISOString()
startedAt: formatBeijingIso()
},
null,
2
@@ -274,5 +275,5 @@ function ensureStateDir(stateDir: string) {
}
function appendLog(path: string, message: string) {
writeFileSync(path, `${new Date().toISOString()} ${message}\n`, { flag: "a", mode: 0o600 });
writeFileSync(path, `${formatBeijingIso()} ${message}\n`, { flag: "a", mode: 0o600 });
}