fix site announcement timezone

This commit is contained in:
cita
2026-03-20 13:26:55 +08:00
parent 029ee10d26
commit 1af1fe244a
4 changed files with 23 additions and 7 deletions
@@ -122,8 +122,10 @@ describe('settings and auth events', () => {
});
expect(response.statusCode).toBe(200);
const body = response.json() as { currentAdminIp?: string };
const body = response.json() as { currentAdminIp?: string; serverTimeZone?: string };
expect(body.currentAdminIp).toBe('203.0.113.5');
expect(typeof body.serverTimeZone).toBe('string');
expect((body.serverTimeZone || '').length).toBeGreaterThan(0);
});
it('rejects proxy token that does not start with sk-', async () => {
+2 -1
View File
@@ -15,7 +15,7 @@ import {
testDatabaseConnection,
type MigrationDialect,
} from '../../services/databaseMigrationService.js';
import { formatUtcSqlDateTime } from '../../services/localTimeService.js';
import { formatUtcSqlDateTime, getResolvedTimeZone } from '../../services/localTimeService.js';
import { extractClientIp, isIpAllowed } from '../../middleware/auth.js';
import { invalidateSiteProxyCache, normalizeSiteProxyUrl } from '../../services/siteProxy.js';
import { performFactoryReset } from '../../services/factoryResetService.js';
@@ -442,6 +442,7 @@ function getRuntimeSettingsResponse(currentAdminIp = '') {
notifyCooldownSec: config.notifyCooldownSec,
adminIpAllowlist: config.adminIpAllowlist,
currentAdminIp,
serverTimeZone: getResolvedTimeZone(),
systemProxyUrl: config.systemProxyUrl,
proxyErrorKeywords: config.proxyErrorKeywords,
proxyEmptyContentFailEnabled: config.proxyEmptyContentFailEnabled,