@naosystem/cf-workers-status-page 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.html +3 -3
- package/dist/chunks/{timeline-YJXjehRf.js → timeline-CsHxR6qb.js} +217 -2
- package/dist/chunks/timeline-CsHxR6qb.js.map +1 -0
- package/dist/client/assets/admin-BiljT5iG.js +1 -0
- package/dist/client/assets/{admin-Be4X0WFj.css → admin-F_WwOjdr.css} +1 -1
- package/dist/client/assets/index-BKO57-TM.css +1 -0
- package/dist/client/assets/index-RHRzex3u.js +2 -0
- package/dist/client/assets/ja--qZUtFbA.js +1 -0
- package/dist/client/assets/{ja-BT5brvxP.js → ja-C9aIPKYh.js} +1 -1
- package/dist/client/assets/src-seeRRxzL.js +63 -0
- package/dist/client/assets/{views-CSeX_2-u.css → views-Bben_u0C.css} +1 -1
- package/dist/client/assets/views-CFQp4HPA.js +1 -0
- package/dist/client/index.html +3 -3
- package/dist/client/licenses/third-party.txt +27 -0
- package/dist/index.js +2 -2
- package/dist/worker.js +454 -313
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/timeline-YJXjehRf.js.map +0 -1
- package/dist/client/assets/admin-BBJxKTF6.js +0 -1
- package/dist/client/assets/index-BgOspfsy.js +0 -2
- package/dist/client/assets/index-xpKyzvog.css +0 -1
- package/dist/client/assets/ja-DSSblLff.js +0 -1
- package/dist/client/assets/src-BDi4qpij.js +0 -9
- package/dist/client/assets/views-DHTTEaNV.js +0 -1
package/dist/worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as resolveConfig,
|
|
1
|
+
import { C as resolveConfig, D as FRAME_LIMITS, H as recentDays, L as confirmState, O as footerSchema, R as observationsNeeded, a as excludeWindows, d as uptimeRatio, f as LATE_GRACE_MS, g as staleAfterMs, h as isCheckState, i as downPeriods, j as localizedTextSchema, k as headerSchema, l as monitorTimeline, m as displayState, n as concatSegments, p as componentState, r as coverageRatio, s as mergeDownPeriods, t as combineTimelines, u as summarize, v as worstState } from "./chunks/timeline-CsHxR6qb.js";
|
|
2
2
|
import { i as destinationOptionOf, n as NotifierError, o as isPublicHostname, t as NOTIFICATION_EVENTS } from "./chunks/notifier-DODVuFhr.js";
|
|
3
3
|
import { r as runCheck, s as redactSecrets } from "./chunks/run-check-bbo3LqI7.js";
|
|
4
4
|
import * as z from "zod";
|
|
@@ -143,6 +143,15 @@ var D1_MIGRATIONS = [
|
|
|
143
143
|
"ALTER TABLE page_appearance ADD COLUMN favicon_image TEXT",
|
|
144
144
|
"ALTER TABLE page_appearance ADD COLUMN colors TEXT"
|
|
145
145
|
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
version: 5,
|
|
149
|
+
name: "a page's texts by language, header and footer",
|
|
150
|
+
statements: [
|
|
151
|
+
"ALTER TABLE page_appearance ADD COLUMN translations TEXT",
|
|
152
|
+
"ALTER TABLE page_appearance ADD COLUMN header TEXT",
|
|
153
|
+
"ALTER TABLE page_appearance ADD COLUMN footer TEXT"
|
|
154
|
+
]
|
|
146
155
|
}
|
|
147
156
|
];
|
|
148
157
|
async function appliedVersion(db) {
|
|
@@ -532,7 +541,10 @@ function isJsonRequest(request) {
|
|
|
532
541
|
}
|
|
533
542
|
// ../../worker/admin/http.ts
|
|
534
543
|
/** JSON responses, errors and request parsing for the admin API. */
|
|
535
|
-
/**
|
|
544
|
+
/**
|
|
545
|
+
* Largest request body accepted. Incident texts are limited well below this (shared/admin-api.ts).
|
|
546
|
+
* A page's appearance has its own, larger limit (`FRAME_LIMITS.appearanceRequestBytes`).
|
|
547
|
+
*/
|
|
536
548
|
var MAX_BODY_BYTES = 65536;
|
|
537
549
|
/** On every admin API response: never cached, never sniffed. */
|
|
538
550
|
var API_HEADERS = {
|
|
@@ -685,15 +697,15 @@ async function readCapped(request, limit) {
|
|
|
685
697
|
* Reads a JSON body and validates it with `schema`: 415 without a JSON content type, 413
|
|
686
698
|
* when too large, 400 when it is not JSON or not valid.
|
|
687
699
|
*/
|
|
688
|
-
async function readBody(request, schema) {
|
|
700
|
+
async function readBody(request, schema, maxBytes = MAX_BODY_BYTES) {
|
|
689
701
|
if (!isJsonRequest(request)) return {
|
|
690
702
|
ok: false,
|
|
691
703
|
response: apiError(415, "unsupported_media_type", "Send the request body as Content-Type: application/json")
|
|
692
704
|
};
|
|
693
|
-
const bytes = await readCapped(request,
|
|
705
|
+
const bytes = await readCapped(request, maxBytes);
|
|
694
706
|
if (bytes === null) return {
|
|
695
707
|
ok: false,
|
|
696
|
-
response: apiError(413, "payload_too_large", `The request body must be at most ${
|
|
708
|
+
response: apiError(413, "payload_too_large", `The request body must be at most ${maxBytes} bytes`)
|
|
697
709
|
};
|
|
698
710
|
let value;
|
|
699
711
|
try {
|
|
@@ -722,6 +734,11 @@ function validate(schema, value, base = []) {
|
|
|
722
734
|
};
|
|
723
735
|
}
|
|
724
736
|
// ../../shared/vocabulary.ts
|
|
737
|
+
/**
|
|
738
|
+
* The admin API's vocabulary and limits, without Zod: shared/admin-api.ts builds its schemas
|
|
739
|
+
* from these and re-exports them, and the admin UI imports them from here so that its bundle
|
|
740
|
+
* does not carry the schemas (the Worker validates every request).
|
|
741
|
+
*/
|
|
725
742
|
/** 調査中 → 原因特定 → 経過観察 → 解決. Any order is allowed; `resolved` closes the incident. */
|
|
726
743
|
var INCIDENT_STAGES = [
|
|
727
744
|
"investigating",
|
|
@@ -743,8 +760,8 @@ var LIMITS = {
|
|
|
743
760
|
title: 200,
|
|
744
761
|
body: 2e4,
|
|
745
762
|
components: 100,
|
|
746
|
-
appearanceTitle:
|
|
747
|
-
appearanceDescription:
|
|
763
|
+
appearanceTitle: FRAME_LIMITS.title,
|
|
764
|
+
appearanceDescription: FRAME_LIMITS.description,
|
|
748
765
|
url: 2e3,
|
|
749
766
|
/** Largest page size of a list. */
|
|
750
767
|
pageSize: 100,
|
|
@@ -803,6 +820,21 @@ var NO_COLORS = {
|
|
|
803
820
|
/** Events a target receives when it does not say: `down` and recovery; administrators' targets also `unknown`. */
|
|
804
821
|
var DEFAULT_TARGET_EVENTS = ["down", "recovered"];
|
|
805
822
|
// ../../shared/admin-api.ts
|
|
823
|
+
/**
|
|
824
|
+
* Request schemas and response types of the admin API (`/api/admin/*`), shared by the
|
|
825
|
+
* Worker and the admin UI. The UI can validate forms with the same Zod schemas before
|
|
826
|
+
* sending; the Worker validates again, and also checks what only it knows (that pages and
|
|
827
|
+
* components exist in status.config.ts).
|
|
828
|
+
*
|
|
829
|
+
* Conventions:
|
|
830
|
+
* - Times are epoch milliseconds (integers), as everywhere else in the hub.
|
|
831
|
+
* - Objects are strict: unknown keys are rejected, so a misspelt field is an error.
|
|
832
|
+
* - Text is trimmed.
|
|
833
|
+
* - Edits are optimistic: an incident, a maintenance and a page's
|
|
834
|
+
* appearance have a `version`, which an edit sends back as it was when the editor started.
|
|
835
|
+
* When someone else saved in between, the edit is refused with 409 `edit_conflict` and the
|
|
836
|
+
* current state ({@link EditConflict}). Posting a timeline update never conflicts.
|
|
837
|
+
*/
|
|
806
838
|
/** Epoch milliseconds, within the range of `Date`. */
|
|
807
839
|
var timestampSchema = z.int().min(0).max(864e13);
|
|
808
840
|
/** A refinement's message, with a code the admin UI translates (see {@link ApiIssue}). */
|
|
@@ -940,27 +972,33 @@ var appearanceColorsSchema = z.strictObject({
|
|
|
940
972
|
dark: themeColorsSchema
|
|
941
973
|
});
|
|
942
974
|
/**
|
|
943
|
-
* Replaces the page's appearance. `null`
|
|
944
|
-
*
|
|
945
|
-
*
|
|
975
|
+
* Replaces the page's appearance. `null` keeps what status.config.ts sets, else the
|
|
976
|
+
* default; `""` clears what it sets (a text, or a URL). Texts are one for every language, or
|
|
977
|
+
* texts by language tag. The fields added after the first four (`logoImage`, `faviconImage`,
|
|
978
|
+
* `colors`, `header`, `footer`) may be left out: they then keep their current values, so that
|
|
979
|
+
* clients written before them keep working.
|
|
946
980
|
*/
|
|
947
981
|
var pageAppearanceSchema = z.strictObject({
|
|
948
982
|
/** The appearance's `version` when the editor started; `0` while the page uses the defaults. */
|
|
949
983
|
version: versionSchema,
|
|
950
|
-
/** Heading and document title. Default: the page ID. */
|
|
951
|
-
title:
|
|
984
|
+
/** Heading and document title; never empty. Default: status.config.ts's `title`, else the page ID. */
|
|
985
|
+
title: localizedTextSchema(LIMITS.appearanceTitle).nullable(),
|
|
952
986
|
/** A line under the heading. */
|
|
953
|
-
description:
|
|
987
|
+
description: localizedTextSchema(LIMITS.appearanceDescription, { allowEmpty: true }).nullable(),
|
|
954
988
|
/** Image shown instead of the title text (https). An uploaded `logoImage` takes its place. */
|
|
955
|
-
logoUrl: httpsUrlSchema.nullable(),
|
|
989
|
+
logoUrl: z.union([z.literal(""), httpsUrlSchema]).nullable(),
|
|
956
990
|
/** Where the heading links to, such as the organisation's website (http or https). */
|
|
957
|
-
websiteUrl: httpUrlSchema.nullable(),
|
|
991
|
+
websiteUrl: z.union([z.literal(""), httpUrlSchema]).nullable(),
|
|
958
992
|
/** An uploaded image shown instead of the title text, before `logoUrl`. */
|
|
959
993
|
logoImage: imageIdSchema.nullable().optional(),
|
|
960
994
|
/** An uploaded image for the browser tab and bookmarks. */
|
|
961
995
|
faviconImage: imageIdSchema.nullable().optional(),
|
|
962
996
|
/** `null` for the template's colours throughout. */
|
|
963
|
-
colors: appearanceColorsSchema.nullable().optional()
|
|
997
|
+
colors: appearanceColorsSchema.nullable().optional(),
|
|
998
|
+
/** The header's navigation, replacing status.config.ts's as a whole (an empty `nav`: none). */
|
|
999
|
+
header: headerSchema.nullable().optional(),
|
|
1000
|
+
/** The footer, replacing status.config.ts's as a whole. */
|
|
1001
|
+
footer: footerSchema.nullable().optional()
|
|
964
1002
|
});
|
|
965
1003
|
/** A component of a page, as a target's selection names it. */
|
|
966
1004
|
var componentRefSchema = z.strictObject({
|
|
@@ -1330,9 +1368,108 @@ async function listIncidentsSince(db, pageId, from, cap = MAX_HISTORY_INCIDENTS)
|
|
|
1330
1368
|
if (more) console.warn(`Page "${pageId}" has more than ${cap} incidents in the history's window; showing the most recent ${cap}`);
|
|
1331
1369
|
return incidents;
|
|
1332
1370
|
}
|
|
1371
|
+
/** The canonical form of a BCP 47 tag (`pt-br` → `pt-BR`), or `undefined` when it is not one. */
|
|
1372
|
+
function canonicalLocale(tag) {
|
|
1373
|
+
try {
|
|
1374
|
+
return Intl.getCanonicalLocales(tag)[0];
|
|
1375
|
+
} catch {
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
/** The language of a translation file, from its name (`./locales/pt-BR.ts` → `pt-BR`). */
|
|
1380
|
+
function localeOfFile(path) {
|
|
1381
|
+
const tag = /\/([^/]+)\.ts$/.exec(path)?.[1];
|
|
1382
|
+
return tag === void 0 ? void 0 : canonicalLocale(tag);
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* The language of `available` that best matches `requested` (a tag, or a list in order of
|
|
1386
|
+
* preference such as `navigator.languages`): an exact match, else the same language without
|
|
1387
|
+
* region or script (`ja-JP` → `ja`), else a regional variant of it (`pt` → `pt-BR`), else
|
|
1388
|
+
* English.
|
|
1389
|
+
*/
|
|
1390
|
+
function matchLocale(requested, available) {
|
|
1391
|
+
const tags = requested === null || requested === void 0 ? [] : typeof requested === "string" ? [requested] : requested;
|
|
1392
|
+
const sorted = [...available].sort();
|
|
1393
|
+
const byLowerCase = new Map(sorted.map((tag) => [tag.toLowerCase(), tag]));
|
|
1394
|
+
for (const tag of tags) {
|
|
1395
|
+
const wanted = canonicalLocale(tag)?.toLowerCase();
|
|
1396
|
+
if (wanted === void 0) continue;
|
|
1397
|
+
const exact = byLowerCase.get(wanted);
|
|
1398
|
+
if (exact !== void 0) return exact;
|
|
1399
|
+
const language = wanted.split("-")[0];
|
|
1400
|
+
const base = byLowerCase.get(language);
|
|
1401
|
+
if (base !== void 0) return base;
|
|
1402
|
+
const variant = sorted.find((candidate) => candidate.toLowerCase().startsWith(`${language}-`));
|
|
1403
|
+
if (variant !== void 0) return variant;
|
|
1404
|
+
}
|
|
1405
|
+
return "en";
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* A text an operator wrote in the language `locale`: the text itself when it is one for
|
|
1409
|
+
* every language, else its language that best matches `locale` (as {@link matchLocale}), else
|
|
1410
|
+
* English, else the first one written. `null` for `null`.
|
|
1411
|
+
*/
|
|
1412
|
+
function pickText(text, locale) {
|
|
1413
|
+
if (text === null || typeof text === "string") return text;
|
|
1414
|
+
const tags = Object.keys(text);
|
|
1415
|
+
return text[matchLocale([locale, "en"], tags)] ?? (tags[0] === void 0 ? null : text[tags[0]] ?? null);
|
|
1416
|
+
}
|
|
1417
|
+
/** Replaces each `{name}` with `params[name]`; placeholders without a value are left as they are. */
|
|
1418
|
+
function interpolate(template, params = {}) {
|
|
1419
|
+
return template.replace(/\{([^{}]+)\}/g, (placeholder, name) => Object.hasOwn(params, name) ? String(params[name]) : placeholder);
|
|
1420
|
+
}
|
|
1421
|
+
var reported = /* @__PURE__ */ new Set();
|
|
1422
|
+
/**
|
|
1423
|
+
* Messages from `messages`, falling back to `reference` (English) message by message. A key that
|
|
1424
|
+
* no message has (a state or stage newer than this code, sent by a newer API) shows as the key
|
|
1425
|
+
* itself, and is logged once, rather than failing the page.
|
|
1426
|
+
*/
|
|
1427
|
+
function makeTranslator(messages, reference) {
|
|
1428
|
+
return (key, params) => {
|
|
1429
|
+
const template = messages[key] ?? reference[key];
|
|
1430
|
+
if (typeof template === "string") return interpolate(template, params);
|
|
1431
|
+
if (!reported.has(key)) {
|
|
1432
|
+
reported.add(key);
|
|
1433
|
+
console.warn(`No message "${key}"`);
|
|
1434
|
+
}
|
|
1435
|
+
return key;
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
/** A duration in at most two units, such as "1 hour, 5 minutes" or "45 seconds", in the language `tag`. */
|
|
1439
|
+
function durationText(ms, tag) {
|
|
1440
|
+
const seconds = Math.max(0, Math.round(ms / 1e3));
|
|
1441
|
+
const units = [
|
|
1442
|
+
["day", Math.floor(seconds / 86400)],
|
|
1443
|
+
["hour", Math.floor(seconds % 86400 / 3600)],
|
|
1444
|
+
["minute", Math.floor(seconds % 3600 / 60)],
|
|
1445
|
+
["second", seconds % 60]
|
|
1446
|
+
];
|
|
1447
|
+
const first = units.findIndex(([, value]) => value > 0);
|
|
1448
|
+
if (first === -1) return new Intl.NumberFormat(tag, {
|
|
1449
|
+
style: "unit",
|
|
1450
|
+
unit: "second",
|
|
1451
|
+
unitDisplay: "long"
|
|
1452
|
+
}).format(0);
|
|
1453
|
+
const parts = units.slice(first, first + 2).filter(([, value]) => value > 0).map(([unit, value]) => new Intl.NumberFormat(tag, {
|
|
1454
|
+
style: "unit",
|
|
1455
|
+
unit,
|
|
1456
|
+
unitDisplay: "long"
|
|
1457
|
+
}).format(value));
|
|
1458
|
+
return new Intl.ListFormat(tag, {
|
|
1459
|
+
style: "long",
|
|
1460
|
+
type: "unit"
|
|
1461
|
+
}).format(parts);
|
|
1462
|
+
}
|
|
1333
1463
|
// ../../worker/db/appearance.ts
|
|
1334
|
-
/**
|
|
1335
|
-
|
|
1464
|
+
/**
|
|
1465
|
+
* Per-page appearance in D1. One row per page that has been customised.
|
|
1466
|
+
*
|
|
1467
|
+
* Every field that status.config.ts can also set is NULL to keep status.config.ts's, and
|
|
1468
|
+
* `""` (a text or URL) or an empty list (header, footer) to clear it: the two never collapse
|
|
1469
|
+
* into one another. Titles and descriptions written per language keep the English (else first)
|
|
1470
|
+
* text in their own column and the languages in `translations` (worker/db/schema.ts, version 5).
|
|
1471
|
+
*/
|
|
1472
|
+
var COLUMNS$1 = "page_id, title, description, logo_url, website_url, logo_image, favicon_image, colors, translations, header, footer, updated_at, updated_by, version";
|
|
1336
1473
|
/** Whether no colour is set. */
|
|
1337
1474
|
function noColorSet(colors) {
|
|
1338
1475
|
return Object.values(colors).every((scheme) => Object.values(scheme).every((color) => color === null));
|
|
@@ -1341,26 +1478,71 @@ function noColorSet(colors) {
|
|
|
1341
1478
|
function colorsColumn(colors) {
|
|
1342
1479
|
return colors === null || noColorSet(colors) ? null : JSON.stringify(colors);
|
|
1343
1480
|
}
|
|
1481
|
+
/** JSON of a column, or `undefined` when it is not JSON. */
|
|
1482
|
+
function parseJson(text) {
|
|
1483
|
+
try {
|
|
1484
|
+
return JSON.parse(text);
|
|
1485
|
+
} catch {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1344
1489
|
/** The colours of a row; the template's when the column is empty or not valid (written by a newer version, say). */
|
|
1345
1490
|
function parseColors(text) {
|
|
1346
1491
|
if (text === null) return NO_COLORS;
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (parsed.success) return parsed.data;
|
|
1350
|
-
} catch {}
|
|
1492
|
+
const parsed = appearanceColorsSchema.safeParse(parseJson(text));
|
|
1493
|
+
if (parsed.success) return parsed.data;
|
|
1351
1494
|
console.warn("A page's colours could not be read; showing the template's");
|
|
1352
1495
|
return NO_COLORS;
|
|
1353
1496
|
}
|
|
1497
|
+
/**
|
|
1498
|
+
* The header or footer of a row: `null` (status.config.ts's) when the column is NULL, or when it
|
|
1499
|
+
* is not valid (written by a newer version, say), as the fields an administrator never set.
|
|
1500
|
+
*/
|
|
1501
|
+
function parseFrameColumn(text, schema, what) {
|
|
1502
|
+
if (text === null) return null;
|
|
1503
|
+
const parsed = schema.safeParse(parseJson(text));
|
|
1504
|
+
if (parsed.success) return parsed.data;
|
|
1505
|
+
console.warn(`A page's ${what} could not be read; showing status.config.ts's`);
|
|
1506
|
+
return null;
|
|
1507
|
+
}
|
|
1508
|
+
/** Texts by language of a row; none when the column is NULL or not valid (its columns' texts then show). */
|
|
1509
|
+
function parseTranslations(text) {
|
|
1510
|
+
if (text === null) return {};
|
|
1511
|
+
const value = parseJson(text);
|
|
1512
|
+
const isTexts = (texts) => typeof texts === "object" && texts !== null && !Array.isArray(texts) && Object.keys(texts).length > 0 && Object.values(texts).every((item) => typeof item === "string");
|
|
1513
|
+
if (typeof value !== "object" || value === null) {
|
|
1514
|
+
console.warn("A page's texts by language could not be read; showing them in one language");
|
|
1515
|
+
return {};
|
|
1516
|
+
}
|
|
1517
|
+
const { title, description } = value;
|
|
1518
|
+
return {
|
|
1519
|
+
...isTexts(title) ? { title } : {},
|
|
1520
|
+
...isTexts(description) ? { description } : {}
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
/** The columns of a text: itself, or its English (else first) text and its languages. */
|
|
1524
|
+
function textColumn(text) {
|
|
1525
|
+
return typeof text === "object" && text !== null ? {
|
|
1526
|
+
column: pickText(text, "en"),
|
|
1527
|
+
languages: text
|
|
1528
|
+
} : {
|
|
1529
|
+
column: text,
|
|
1530
|
+
languages: void 0
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1354
1533
|
function toAppearance(row) {
|
|
1534
|
+
const translations = parseTranslations(row.translations);
|
|
1355
1535
|
return {
|
|
1356
1536
|
pageId: row.page_id,
|
|
1357
|
-
title: row.title,
|
|
1358
|
-
description: row.description,
|
|
1537
|
+
title: translations.title ?? row.title,
|
|
1538
|
+
description: translations.description ?? row.description,
|
|
1359
1539
|
logoUrl: row.logo_url,
|
|
1360
1540
|
websiteUrl: row.website_url,
|
|
1361
1541
|
logoImage: row.logo_image,
|
|
1362
1542
|
faviconImage: row.favicon_image,
|
|
1363
1543
|
colors: parseColors(row.colors),
|
|
1544
|
+
header: parseFrameColumn(row.header, headerSchema, "header"),
|
|
1545
|
+
footer: parseFrameColumn(row.footer, footerSchema, "footer"),
|
|
1364
1546
|
updatedAt: row.updated_at,
|
|
1365
1547
|
updatedBy: row.updated_by,
|
|
1366
1548
|
version: row.version
|
|
@@ -1377,6 +1559,8 @@ function defaultAppearance(pageId) {
|
|
|
1377
1559
|
logoImage: null,
|
|
1378
1560
|
faviconImage: null,
|
|
1379
1561
|
colors: NO_COLORS,
|
|
1562
|
+
header: null,
|
|
1563
|
+
footer: null,
|
|
1380
1564
|
updatedAt: null,
|
|
1381
1565
|
updatedBy: null,
|
|
1382
1566
|
version: 0
|
|
@@ -1387,29 +1571,43 @@ async function getAppearance(db, pageId) {
|
|
|
1387
1571
|
const row = await db.prepare(`SELECT ${COLUMNS$1} FROM page_appearance WHERE page_id = ?`).bind(pageId).first();
|
|
1388
1572
|
return row === null ? defaultAppearance(pageId) : toAppearance(row);
|
|
1389
1573
|
}
|
|
1574
|
+
/** `undefined` stays `undefined` (keep the column); `null` is NULL; anything else JSON. */
|
|
1575
|
+
function jsonColumn(value) {
|
|
1576
|
+
return value === void 0 || value === null ? value : JSON.stringify(value);
|
|
1577
|
+
}
|
|
1390
1578
|
/**
|
|
1391
1579
|
* Replaces the page's appearance, if it is still at `version` (0: never customised),
|
|
1392
1580
|
* checked in the same statement as the write. Optional fields left `undefined` keep their
|
|
1393
1581
|
* values (on a first save: the defaults).
|
|
1394
1582
|
*/
|
|
1395
1583
|
async function putAppearance(db, pageId, version, fields, actor, now = Date.now()) {
|
|
1584
|
+
const title = textColumn(fields.title);
|
|
1585
|
+
const description = textColumn(fields.description);
|
|
1586
|
+
const languages = {
|
|
1587
|
+
title: title.languages,
|
|
1588
|
+
description: description.languages
|
|
1589
|
+
};
|
|
1396
1590
|
const columns = [
|
|
1397
|
-
["title",
|
|
1398
|
-
["description",
|
|
1591
|
+
["title", title.column],
|
|
1592
|
+
["description", description.column],
|
|
1399
1593
|
["logo_url", fields.logoUrl],
|
|
1400
|
-
["website_url", fields.websiteUrl]
|
|
1594
|
+
["website_url", fields.websiteUrl],
|
|
1595
|
+
["translations", languages.title === void 0 && languages.description === void 0 ? null : JSON.stringify(languages)]
|
|
1401
1596
|
];
|
|
1402
1597
|
const optional = [
|
|
1403
1598
|
["logo_image", fields.logoImage],
|
|
1404
1599
|
["favicon_image", fields.faviconImage],
|
|
1405
|
-
["colors", fields.colors === void 0 ? void 0 : colorsColumn(fields.colors)]
|
|
1600
|
+
["colors", fields.colors === void 0 ? void 0 : colorsColumn(fields.colors)],
|
|
1601
|
+
["header", jsonColumn(fields.header)],
|
|
1602
|
+
["footer", jsonColumn(fields.footer)]
|
|
1406
1603
|
];
|
|
1407
1604
|
let statement;
|
|
1408
1605
|
if (version === 0) {
|
|
1409
|
-
const
|
|
1410
|
-
statement = db.prepare(`INSERT INTO page_appearance (${
|
|
1606
|
+
const all = [...columns, ...optional];
|
|
1607
|
+
statement = db.prepare(`INSERT INTO page_appearance (page_id, ${all.map(([column]) => column).join(", ")}, updated_at, updated_by, version)
|
|
1608
|
+
VALUES (?, ${all.map(() => "?").join(", ")}, ?, ?, 1)
|
|
1411
1609
|
ON CONFLICT (page_id) DO NOTHING
|
|
1412
|
-
RETURNING ${COLUMNS$1}`).bind(pageId, ...
|
|
1610
|
+
RETURNING ${COLUMNS$1}`).bind(pageId, ...all.map(([, value]) => value ?? null), now, actorName(actor));
|
|
1413
1611
|
} else {
|
|
1414
1612
|
const set = [...columns, ...optional.filter(([, value]) => value !== void 0)];
|
|
1415
1613
|
statement = db.prepare(`UPDATE page_appearance SET ${set.map(([column]) => `${column} = ?`).join(", ")},
|
|
@@ -1427,7 +1625,10 @@ async function putAppearance(db, pageId, version, fields, actor, now = Date.now(
|
|
|
1427
1625
|
current: await getAppearance(db, pageId)
|
|
1428
1626
|
};
|
|
1429
1627
|
}
|
|
1430
|
-
/**
|
|
1628
|
+
/**
|
|
1629
|
+
* The title an administrator set, in one language (English, else the first), of every page that
|
|
1630
|
+
* has one, for the public list of pages. Reads one row per customised page.
|
|
1631
|
+
*/
|
|
1431
1632
|
async function listAppearanceTitles(db) {
|
|
1432
1633
|
const { results } = await db.prepare("SELECT page_id, title FROM page_appearance WHERE title IS NOT NULL").all();
|
|
1433
1634
|
return new Map(results.map((row) => [row.page_id, row.title]));
|
|
@@ -3343,21 +3544,41 @@ function publicMaintenance(maintenance, page) {
|
|
|
3343
3544
|
components
|
|
3344
3545
|
};
|
|
3345
3546
|
}
|
|
3547
|
+
/** A text or URL as visitors get it: `""` (cleared by an administrator) is none. */
|
|
3548
|
+
function shown(value) {
|
|
3549
|
+
return value === "" ? null : value;
|
|
3550
|
+
}
|
|
3346
3551
|
/**
|
|
3347
|
-
* The appearance as visitors get it
|
|
3348
|
-
*
|
|
3552
|
+
* The appearance as visitors get it: the administrators' fields over status.config.ts's,
|
|
3553
|
+
* each where it is not `null`; `""` clears. `uploads`: whether the Worker has its R2 bucket;
|
|
3554
|
+
* without it, uploaded images are left out (they could not be served), and the logo URL shows
|
|
3555
|
+
* instead.
|
|
3349
3556
|
*/
|
|
3350
|
-
function publicAppearance(appearance, uploads) {
|
|
3557
|
+
function publicAppearance(appearance, page, uploads) {
|
|
3351
3558
|
const image = (id) => uploads && id !== null ? imagePath(appearance.pageId, id) : null;
|
|
3559
|
+
const { frame } = page;
|
|
3560
|
+
const title = appearance.title ?? frame.title;
|
|
3561
|
+
const description = shown(appearance.description ?? frame.description);
|
|
3562
|
+
const logoUrl = shown(appearance.logoUrl ?? frame.logoUrl);
|
|
3352
3563
|
return {
|
|
3353
|
-
title:
|
|
3354
|
-
description:
|
|
3355
|
-
|
|
3356
|
-
|
|
3564
|
+
title: pickText(title, "en"),
|
|
3565
|
+
description: pickText(description, "en"),
|
|
3566
|
+
localized: {
|
|
3567
|
+
title,
|
|
3568
|
+
description
|
|
3569
|
+
},
|
|
3570
|
+
logoUrl: image(appearance.logoImage) ?? (logoUrl?.startsWith("https://") === true ? logoUrl : null),
|
|
3571
|
+
websiteUrl: shown(appearance.websiteUrl ?? frame.websiteUrl),
|
|
3357
3572
|
faviconUrl: image(appearance.faviconImage),
|
|
3358
|
-
colors: appearance.colors
|
|
3573
|
+
colors: appearance.colors,
|
|
3574
|
+
header: appearance.header ?? frame.header,
|
|
3575
|
+
footer: appearance.footer ?? frame.footer
|
|
3359
3576
|
};
|
|
3360
3577
|
}
|
|
3578
|
+
/** A page's title in one language, as `PublicAppearance.title`, from the title an administrator set (`null`: none). */
|
|
3579
|
+
function publicTitle(adminTitle, page) {
|
|
3580
|
+
return adminTitle ?? pickText(page.frame.title, "en");
|
|
3581
|
+
}
|
|
3361
3582
|
// ../../worker/notifications/unknown.ts
|
|
3362
3583
|
/** A stopped monitor (or one not started yet) is looked at again after this; a sweep refreshes it sooner. */
|
|
3363
3584
|
var STOPPED_RECHECK_MS = 6e5;
|
|
@@ -4679,7 +4900,7 @@ var StatusPage = class extends DurableObject {
|
|
|
4679
4900
|
});
|
|
4680
4901
|
return view({
|
|
4681
4902
|
pageId: page.id,
|
|
4682
|
-
appearance: publicAppearance(appearance, uploadsBucket(this.env) !== void 0),
|
|
4903
|
+
appearance: publicAppearance(appearance, page, uploadsBucket(this.env) !== void 0),
|
|
4683
4904
|
template: page.template,
|
|
4684
4905
|
reportUrl: page.reportUrl,
|
|
4685
4906
|
overall: worstState(components.map((component) => component.state), "unknown"),
|
|
@@ -5253,7 +5474,7 @@ async function pagesView(env) {
|
|
|
5253
5474
|
const titles = await listAppearanceTitles(env.DB);
|
|
5254
5475
|
const body = { pages: config.pages.map((page) => ({
|
|
5255
5476
|
id: page.id,
|
|
5256
|
-
title: titles.get(page.id) ?? null
|
|
5477
|
+
title: publicTitle(titles.get(page.id) ?? null, page)
|
|
5257
5478
|
})) };
|
|
5258
5479
|
return {
|
|
5259
5480
|
status: 200,
|
|
@@ -6303,6 +6524,8 @@ var en_default = {
|
|
|
6303
6524
|
"impact.down": "Outage",
|
|
6304
6525
|
"public.defaultTitle": "Status",
|
|
6305
6526
|
"public.header.website": "opens the website",
|
|
6527
|
+
"public.nav.label": "Links",
|
|
6528
|
+
"public.nav.menu": "Menu",
|
|
6306
6529
|
"public.footer.timeZone": "Times are shown in your time zone ({timeZone}).",
|
|
6307
6530
|
"public.state.up": "Operational",
|
|
6308
6531
|
"public.state.degraded": "Degraded",
|
|
@@ -6444,278 +6667,195 @@ var en_default = {
|
|
|
6444
6667
|
"public.modern.notices.hide": "Hide updates",
|
|
6445
6668
|
"public.modern.history.title": "Incident history"
|
|
6446
6669
|
};
|
|
6447
|
-
// ../../shared/i18n/locales/ja.ts
|
|
6448
|
-
/** Japanese. */
|
|
6449
|
-
var ja_default = {
|
|
6450
|
-
"state.up": "正常",
|
|
6451
|
-
"state.degraded": "性能低下",
|
|
6452
|
-
"state.down": "停止",
|
|
6453
|
-
"state.unknown": "不明",
|
|
6454
|
-
"notification.down.title": "{monitor} が停止しています",
|
|
6455
|
-
"notification.down.text": "{monitor} は {time} から停止しています。",
|
|
6456
|
-
"notification.down.afterMaintenance": "メンテナンスが終了しましたが、{monitor} は停止したままです。{time} から停止しています。",
|
|
6457
|
-
"notification.recovered.title": "{monitor} が復旧しました",
|
|
6458
|
-
"notification.recovered.text": "{monitor} は {time} に「{state}」に戻りました。停止していた時間: {duration}",
|
|
6459
|
-
"notification.recovered.partial.title": "{monitor} が一部復旧しました",
|
|
6460
|
-
"notification.recovered.partial.text": "{monitor} は {time} から停止ではなく性能低下の状態です。停止していた時間: {duration}",
|
|
6461
|
-
"notification.degraded.title": "{monitor} の性能が低下しています",
|
|
6462
|
-
"notification.degraded.text": "{monitor} は {time} から性能が低下しています。",
|
|
6463
|
-
"notification.degraded_recovered.title": "{monitor} の性能低下が解消しました",
|
|
6464
|
-
"notification.degraded_recovered.text": "{monitor} は {time} に正常に戻りました。性能が低下していた時間: {duration}",
|
|
6465
|
-
"notification.unknown.title": "{monitor}: 最近の結果がありません",
|
|
6466
|
-
"notification.unknown.late": "{monitor} のチェック結果が {last} から届いていないため、{time} から状態が不明です。監視が動いているか、Worker のログと、Free プランでは Cloudflare の1日あたりの上限を確認してください。",
|
|
6467
|
-
"notification.unknown.unconfirmed": "{monitor} は {last} から結果が届いていますが、状態を確定できていないため、{time} から状態が不明です。チェックの成功と失敗が交互に起きている可能性があります。",
|
|
6468
|
-
"notification.unknown.unreachable": "{time} から {monitor} の状態を読み取れません。Durable Object が応答しません。Worker のログを確認してください。",
|
|
6469
|
-
"notification.lastCheck": "最後のチェック: {message}",
|
|
6470
|
-
"notification.test.title": "cf-workers-status-page からのテスト通知",
|
|
6471
|
-
"notification.test.text": "通知先「{target}」に送信できました。送信時刻: {time}",
|
|
6472
|
-
"notification.link.createIncident": "ページ {page} に障害告知を作成",
|
|
6473
|
-
"incident.auto.title": "{components} の障害",
|
|
6474
|
-
"incident.auto.investigating": "{time} から {components} が停止していることを検知しました。調査しています。",
|
|
6475
|
-
"incident.auto.update": "{time} から {components} も停止していることを検知しました。",
|
|
6476
|
-
"incident.auto.stopped": "{time} に {components} の監視が止まったため、この告知は自動で解決されました。",
|
|
6477
|
-
"incident.auto.resolved": "{time} に {components} が復旧しました。この告知は自動で解決されました。",
|
|
6478
|
-
"incident.auto.reopened": "{time} から {components} が再び停止していることを検知したため、この告知を再開しました。",
|
|
6479
|
-
"incident.auto.partial": "{time} から {components} の停止は解消しましたが、性能低下が続いています。",
|
|
6480
|
-
"ui.language": "言語",
|
|
6481
|
-
"ui.loading": "読み込み中…",
|
|
6482
|
-
"ui.skipToContent": "本文へ移動",
|
|
6483
|
-
"stage.investigating": "調査中",
|
|
6484
|
-
"stage.identified": "原因特定",
|
|
6485
|
-
"stage.monitoring": "経過観察",
|
|
6486
|
-
"stage.resolved": "解決",
|
|
6487
|
-
"impact.none": "影響なし",
|
|
6488
|
-
"impact.degraded": "性能低下",
|
|
6489
|
-
"impact.down": "停止",
|
|
6490
|
-
"public.defaultTitle": "ステータス",
|
|
6491
|
-
"public.header.website": "Web サイトを開く",
|
|
6492
|
-
"public.footer.timeZone": "時刻はお使いのタイムゾーン({timeZone})で表示しています。",
|
|
6493
|
-
"public.state.up": "正常",
|
|
6494
|
-
"public.state.degraded": "性能低下",
|
|
6495
|
-
"public.state.down": "停止",
|
|
6496
|
-
"public.state.unknown": "不明",
|
|
6497
|
-
"public.overall.up": "すべてのシステムが正常に稼働しています",
|
|
6498
|
-
"public.overall.degraded": "一部のシステムで性能が低下しています",
|
|
6499
|
-
"public.overall.down": "一部のシステムが停止しています",
|
|
6500
|
-
"public.overall.unknown": "状態が不明です",
|
|
6501
|
-
"public.overall.unknownDetail": "一部のシステムで最近の監視結果が得られていません。",
|
|
6502
|
-
"public.overall.empty": "このページにはまだシステムが登録されていません",
|
|
6503
|
-
"public.overall.maintenance": "メンテナンスを実施しています。",
|
|
6504
|
-
"public.overall.stale": "この表示は最新ではない可能性があります",
|
|
6505
|
-
"public.overall.staleDetail": "ページを更新できませんでした。最後に確認できた状態:「{state}」({time})",
|
|
6506
|
-
"public.freshness.updated": "{time} 更新",
|
|
6507
|
-
"public.freshness.age": "最終更新 {age}",
|
|
6508
|
-
"public.freshness.failed": "更新できませんでした({reason})。",
|
|
6509
|
-
"public.freshness.retrying": "再試行しています…",
|
|
6510
|
-
"public.freshness.retryAt": "{time}に再試行します。",
|
|
6511
|
-
"public.freshness.retryNow": "今すぐ再試行",
|
|
6512
|
-
"public.freshness.incidentsOutdated": "障害告知とメンテナンスの情報を今は読み込めないため、古い可能性があります。各システムの状態は最新です。",
|
|
6513
|
-
"public.error.network": "サーバーに接続できません",
|
|
6514
|
-
"public.error.http": "サーバーエラー {status}",
|
|
6515
|
-
"public.error.unknown": "予期しないエラー",
|
|
6516
|
-
"public.unavailable.title": "現在、状態を表示できません",
|
|
6517
|
-
"public.unavailable.detail": "状態を読み込めませんでした({reason})。システムが稼働しているかどうかは分かりません。",
|
|
6518
|
-
"public.notFound.title": "見つかりません",
|
|
6519
|
-
"public.notFound.page": "このアドレスにステータスページはありません。",
|
|
6520
|
-
"public.notFound.incident": "このステータスページにその障害告知はありません。",
|
|
6521
|
-
"public.notFound.path": "このアドレスには何もありません。",
|
|
6522
|
-
"public.notFound.home": "ステータスページへ",
|
|
6523
|
-
"public.incidents.heading": "発生中の障害",
|
|
6524
|
-
"public.incident.affects": "影響: {components}",
|
|
6525
|
-
"public.incident.started": "{time} 発生",
|
|
6526
|
-
"public.incident.ongoingSince": "{time} から継続中",
|
|
6527
|
-
"public.incident.lasted": "{from} から {duration}",
|
|
6528
|
-
"public.incident.olderUpdates": "以前の更新は省略しています。すべての経過を見る",
|
|
6529
|
-
"public.incident.earlierUpdates": "以前の更新を表示",
|
|
6530
|
-
"public.incident.earlierFailed": "以前の更新を読み込めませんでした({reason})。",
|
|
6531
|
-
"public.incident.back": "現在の状態",
|
|
6532
|
-
"public.maintenance.activeHeading": "実施中のメンテナンス",
|
|
6533
|
-
"public.maintenance.upcomingHeading": "予定されているメンテナンス",
|
|
6534
|
-
"public.maintenance.until": "{to} まで実施中",
|
|
6535
|
-
"public.maintenance.window": "{from} 〜 {to}",
|
|
6536
|
-
"public.maintenance.components": "対象: {components}",
|
|
6537
|
-
"public.components.heading": "システム",
|
|
6538
|
-
"public.components.stale": "最後に確認できた状態を表示しています。",
|
|
6539
|
-
"public.components.historyFailed": "日ごとの履歴を読み込めませんでした。再試行しています。",
|
|
6540
|
-
"public.component.maintenance": "メンテナンス中",
|
|
6541
|
-
"public.component.uptime": "過去 {period}の稼働率 {uptime}",
|
|
6542
|
-
"public.component.coverage": "網羅率 {coverage}",
|
|
6543
|
-
"public.component.noUptime": "この期間の稼働率なし: メンテナンス以外の時間に結果がありません",
|
|
6544
|
-
"public.component.notMonitored": "監視なし: 状態は障害告知だけで決まります",
|
|
6545
|
-
"public.bars.label": "{component}: 過去 {period}、1日1本",
|
|
6546
|
-
"public.bars.today": "今日",
|
|
6547
|
-
"public.day.pending": "計算中",
|
|
6548
|
-
"public.day.unmonitored": "監視なし",
|
|
6549
|
-
"public.day.noData": "データなし",
|
|
6550
|
-
"public.day.uptime": "稼働率 {uptime}",
|
|
6551
|
-
"public.day.downtime": "停止 {duration}",
|
|
6552
|
-
"public.day.degraded": "一時的に性能低下",
|
|
6553
|
-
"public.day.coverage": "網羅率 {coverage}",
|
|
6554
|
-
"public.day.incidents": "障害告知: {titles}",
|
|
6555
|
-
"public.day.maintenance": "メンテナンス: {titles}",
|
|
6556
|
-
"public.legend.up": "正常",
|
|
6557
|
-
"public.legend.degraded": "性能低下",
|
|
6558
|
-
"public.legend.down": "停止",
|
|
6559
|
-
"public.legend.noData": "データなし",
|
|
6560
|
-
"public.legend.incident": "障害告知",
|
|
6561
|
-
"public.legend.maintenance": "メンテナンス",
|
|
6562
|
-
"public.legend.uptime": "稼働率は監視結果だけから計算し、メンテナンス中と結果のない時間は除きます。網羅率は、予定したチェックのうち結果が得られた割合です。",
|
|
6563
|
-
"public.history.heading": "過去の障害",
|
|
6564
|
-
"public.history.none": "過去の障害はありません。",
|
|
6565
|
-
"public.history.more": "さらに表示",
|
|
6566
|
-
"public.history.failed": "過去の障害を読み込めませんでした({reason})。",
|
|
6567
|
-
"public.stoppages.heading": "監視で検知した停止",
|
|
6568
|
-
"public.stoppages.intro": "障害告知の有無にかかわらず、監視で停止が確定した期間です。",
|
|
6569
|
-
"public.stoppages.none": "過去 {period}に検知した停止はありません。",
|
|
6570
|
-
"public.stoppages.period": "{from} から {duration}",
|
|
6571
|
-
"public.stoppages.ongoing": "{from} から継続中(現在 {duration})",
|
|
6572
|
-
"public.stoppages.all": "すべて表示({count} 件)",
|
|
6573
|
-
"public.stoppages.fewer": "折りたたむ",
|
|
6574
|
-
"public.stoppages.truncated": "この期間のより古い停止は表示していません。",
|
|
6575
|
-
"public.stoppages.failed": "停止の履歴を読み込めませんでした。再試行しています。",
|
|
6576
|
-
"public.component.uptimeSince": "{date} からの稼働率 {uptime}",
|
|
6577
|
-
"public.component.notEnoughData": "稼働率を出すにはデータが足りません(結果 {duration})",
|
|
6578
|
-
"public.component.notMonitoredYet": "まだ監視していません",
|
|
6579
|
-
"public.components.historyStale": "日ごとの履歴を更新できませんでした({reason})。{time} 時点の内容です。",
|
|
6580
|
-
"public.day.notYet": "まだ監視していません",
|
|
6581
|
-
"public.legend.notMonitored": "監視なし(または監視前)",
|
|
6582
|
-
"public.modern.report": "問題を報告",
|
|
6583
|
-
"public.modern.updated": "最終更新 {time}",
|
|
6584
|
-
"public.modern.theme": "表示テーマ",
|
|
6585
|
-
"public.modern.theme.light": "ライト",
|
|
6586
|
-
"public.modern.theme.dark": "ダーク",
|
|
6587
|
-
"public.modern.incident.meta": "{time} に発生 · 影響: {components}",
|
|
6588
|
-
"public.modern.incident.started": "{time} に発生",
|
|
6589
|
-
"public.modern.maintenance.badge": "メンテナンス中",
|
|
6590
|
-
"public.modern.maintenance.scheduled": "予定メンテナンス",
|
|
6591
|
-
"public.modern.maintenance.window": "{from} 〜 {to}(予定)",
|
|
6592
|
-
"public.modern.maintenance.progress": "{elapsed}経過 / 予定 {total}",
|
|
6593
|
-
"public.modern.components.label": "コンポーネントの稼働状況",
|
|
6594
|
-
"public.modern.group.count": "{count} コンポーネント",
|
|
6595
|
-
"public.modern.group.one": "1 コンポーネント",
|
|
6596
|
-
"public.modern.uptime": "{uptime} 稼働",
|
|
6597
|
-
"public.modern.uptime.noData": "データなし",
|
|
6598
|
-
"public.modern.uptime.notEnough": "データ不足",
|
|
6599
|
-
"public.modern.uptime.notMonitored": "監視なし",
|
|
6600
|
-
"public.modern.uptime.notYet": "監視前",
|
|
6601
|
-
"public.modern.day.noIssues": "障害の報告なし",
|
|
6602
|
-
"public.modern.day.degraded": "性能低下 {duration}",
|
|
6603
|
-
"public.modern.day.maintenance": "メンテナンス {duration}",
|
|
6604
|
-
"public.modern.day.timeline": "{timezone} の0時から24時まで",
|
|
6605
|
-
"public.modern.event.incident": "障害告知",
|
|
6606
|
-
"public.modern.event.maintenance": "メンテナンス",
|
|
6607
|
-
"public.modern.event.stoppage": "停止(監視で検知)",
|
|
6608
|
-
"public.modern.legend.maintenance": "メンテナンス",
|
|
6609
|
-
"public.modern.latency.toggle": "{component} の応答時間",
|
|
6610
|
-
"public.modern.latency.value": "{ms} ms",
|
|
6611
|
-
"public.modern.latency.latest": "現在",
|
|
6612
|
-
"public.modern.latency.average": "平均",
|
|
6613
|
-
"public.modern.latency.p95": "95パーセンタイル",
|
|
6614
|
-
"public.modern.latency.period": "表示期間",
|
|
6615
|
-
"public.modern.latency.day": "24時間",
|
|
6616
|
-
"public.modern.latency.week": "7日間",
|
|
6617
|
-
"public.modern.latency.month": "30日間",
|
|
6618
|
-
"public.modern.latency.now": "現在",
|
|
6619
|
-
"public.modern.latency.chart": "{component} の応答時間({period})。平均 {average}、95パーセンタイル {p95}",
|
|
6620
|
-
"public.modern.latency.none": "この期間の応答時間はまだありません。",
|
|
6621
|
-
"public.modern.latency.loading": "応答時間を読み込み中…",
|
|
6622
|
-
"public.modern.latency.failed": "応答時間を読み込めませんでした({reason})。",
|
|
6623
|
-
"public.modern.notices.heading": "最近のお知らせ(過去7日間)",
|
|
6624
|
-
"public.modern.notices.none": "過去7日間のお知らせはありません。",
|
|
6625
|
-
"public.modern.notices.history": "履歴を見る",
|
|
6626
|
-
"public.modern.notices.all": "お知らせの履歴をすべて表示",
|
|
6627
|
-
"public.modern.notices.resolved": "解決済み",
|
|
6628
|
-
"public.modern.notices.period": "{from} 〜 {to}",
|
|
6629
|
-
"public.modern.notices.show": "これまでの経過",
|
|
6630
|
-
"public.modern.notices.hide": "経過を閉じる",
|
|
6631
|
-
"public.modern.history.title": "お知らせの履歴"
|
|
6632
|
-
};
|
|
6633
|
-
/** The canonical form of a BCP 47 tag (`pt-br` → `pt-BR`), or `undefined` when it is not one. */
|
|
6634
|
-
function canonicalLocale(tag) {
|
|
6635
|
-
try {
|
|
6636
|
-
return Intl.getCanonicalLocales(tag)[0];
|
|
6637
|
-
} catch {
|
|
6638
|
-
return;
|
|
6639
|
-
}
|
|
6640
|
-
}
|
|
6641
|
-
/** The language of a translation file, from its name (`./locales/pt-BR.ts` → `pt-BR`). */
|
|
6642
|
-
function localeOfFile(path) {
|
|
6643
|
-
const tag = /\/([^/]+)\.ts$/.exec(path)?.[1];
|
|
6644
|
-
return tag === void 0 ? void 0 : canonicalLocale(tag);
|
|
6645
|
-
}
|
|
6646
|
-
/**
|
|
6647
|
-
* The language of `available` that best matches `requested` (a tag, or a list in order of
|
|
6648
|
-
* preference such as `navigator.languages`): an exact match, else the same language without
|
|
6649
|
-
* region or script (`ja-JP` → `ja`), else a regional variant of it (`pt` → `pt-BR`), else
|
|
6650
|
-
* English.
|
|
6651
|
-
*/
|
|
6652
|
-
function matchLocale(requested, available) {
|
|
6653
|
-
const tags = requested === null || requested === void 0 ? [] : typeof requested === "string" ? [requested] : requested;
|
|
6654
|
-
const sorted = [...available].sort();
|
|
6655
|
-
const byLowerCase = new Map(sorted.map((tag) => [tag.toLowerCase(), tag]));
|
|
6656
|
-
for (const tag of tags) {
|
|
6657
|
-
const wanted = canonicalLocale(tag)?.toLowerCase();
|
|
6658
|
-
if (wanted === void 0) continue;
|
|
6659
|
-
const exact = byLowerCase.get(wanted);
|
|
6660
|
-
if (exact !== void 0) return exact;
|
|
6661
|
-
const language = wanted.split("-")[0];
|
|
6662
|
-
const base = byLowerCase.get(language);
|
|
6663
|
-
if (base !== void 0) return base;
|
|
6664
|
-
const variant = sorted.find((candidate) => candidate.toLowerCase().startsWith(`${language}-`));
|
|
6665
|
-
if (variant !== void 0) return variant;
|
|
6666
|
-
}
|
|
6667
|
-
return "en";
|
|
6668
|
-
}
|
|
6669
|
-
/** Replaces each `{name}` with `params[name]`; placeholders without a value are left as they are. */
|
|
6670
|
-
function interpolate(template, params = {}) {
|
|
6671
|
-
return template.replace(/\{([^{}]+)\}/g, (placeholder, name) => Object.hasOwn(params, name) ? String(params[name]) : placeholder);
|
|
6672
|
-
}
|
|
6673
|
-
var reported = /* @__PURE__ */ new Set();
|
|
6674
|
-
/**
|
|
6675
|
-
* Messages from `messages`, falling back to `reference` (English) message by message. A key that
|
|
6676
|
-
* no message has (a state or stage newer than this code, sent by a newer API) shows as the key
|
|
6677
|
-
* itself, and is logged once, rather than failing the page.
|
|
6678
|
-
*/
|
|
6679
|
-
function makeTranslator(messages, reference) {
|
|
6680
|
-
return (key, params) => {
|
|
6681
|
-
const template = messages[key] ?? reference[key];
|
|
6682
|
-
if (typeof template === "string") return interpolate(template, params);
|
|
6683
|
-
if (!reported.has(key)) {
|
|
6684
|
-
reported.add(key);
|
|
6685
|
-
console.warn(`No message "${key}"`);
|
|
6686
|
-
}
|
|
6687
|
-
return key;
|
|
6688
|
-
};
|
|
6689
|
-
}
|
|
6690
|
-
/** A duration in at most two units, such as "1 hour, 5 minutes" or "45 seconds", in the language `tag`. */
|
|
6691
|
-
function durationText(ms, tag) {
|
|
6692
|
-
const seconds = Math.max(0, Math.round(ms / 1e3));
|
|
6693
|
-
const units = [
|
|
6694
|
-
["day", Math.floor(seconds / 86400)],
|
|
6695
|
-
["hour", Math.floor(seconds % 86400 / 3600)],
|
|
6696
|
-
["minute", Math.floor(seconds % 3600 / 60)],
|
|
6697
|
-
["second", seconds % 60]
|
|
6698
|
-
];
|
|
6699
|
-
const first = units.findIndex(([, value]) => value > 0);
|
|
6700
|
-
if (first === -1) return new Intl.NumberFormat(tag, {
|
|
6701
|
-
style: "unit",
|
|
6702
|
-
unit: "second",
|
|
6703
|
-
unitDisplay: "long"
|
|
6704
|
-
}).format(0);
|
|
6705
|
-
const parts = units.slice(first, first + 2).filter(([, value]) => value > 0).map(([unit, value]) => new Intl.NumberFormat(tag, {
|
|
6706
|
-
style: "unit",
|
|
6707
|
-
unit,
|
|
6708
|
-
unitDisplay: "long"
|
|
6709
|
-
}).format(value));
|
|
6710
|
-
return new Intl.ListFormat(tag, {
|
|
6711
|
-
style: "long",
|
|
6712
|
-
type: "unit"
|
|
6713
|
-
}).format(parts);
|
|
6714
|
-
}
|
|
6715
6670
|
/** Every bundled language, by its canonical tag (from the file name). */
|
|
6716
6671
|
var TRANSLATIONS = new Map(Object.entries(/* @__PURE__ */ Object.assign({
|
|
6717
6672
|
"./locales/en.ts": en_default,
|
|
6718
|
-
"./locales/ja.ts":
|
|
6673
|
+
"./locales/ja.ts": {
|
|
6674
|
+
"state.up": "正常",
|
|
6675
|
+
"state.degraded": "性能低下",
|
|
6676
|
+
"state.down": "停止",
|
|
6677
|
+
"state.unknown": "不明",
|
|
6678
|
+
"notification.down.title": "{monitor} が停止しています",
|
|
6679
|
+
"notification.down.text": "{monitor} は {time} から停止しています。",
|
|
6680
|
+
"notification.down.afterMaintenance": "メンテナンスが終了しましたが、{monitor} は停止したままです。{time} から停止しています。",
|
|
6681
|
+
"notification.recovered.title": "{monitor} が復旧しました",
|
|
6682
|
+
"notification.recovered.text": "{monitor} は {time} に「{state}」に戻りました。停止していた時間: {duration}",
|
|
6683
|
+
"notification.recovered.partial.title": "{monitor} が一部復旧しました",
|
|
6684
|
+
"notification.recovered.partial.text": "{monitor} は {time} から停止ではなく性能低下の状態です。停止していた時間: {duration}",
|
|
6685
|
+
"notification.degraded.title": "{monitor} の性能が低下しています",
|
|
6686
|
+
"notification.degraded.text": "{monitor} は {time} から性能が低下しています。",
|
|
6687
|
+
"notification.degraded_recovered.title": "{monitor} の性能低下が解消しました",
|
|
6688
|
+
"notification.degraded_recovered.text": "{monitor} は {time} に正常に戻りました。性能が低下していた時間: {duration}",
|
|
6689
|
+
"notification.unknown.title": "{monitor}: 最近の結果がありません",
|
|
6690
|
+
"notification.unknown.late": "{monitor} のチェック結果が {last} から届いていないため、{time} から状態が不明です。監視が動いているか、Worker のログと、Free プランでは Cloudflare の1日あたりの上限を確認してください。",
|
|
6691
|
+
"notification.unknown.unconfirmed": "{monitor} は {last} から結果が届いていますが、状態を確定できていないため、{time} から状態が不明です。チェックの成功と失敗が交互に起きている可能性があります。",
|
|
6692
|
+
"notification.unknown.unreachable": "{time} から {monitor} の状態を読み取れません。Durable Object が応答しません。Worker のログを確認してください。",
|
|
6693
|
+
"notification.lastCheck": "最後のチェック: {message}",
|
|
6694
|
+
"notification.test.title": "cf-workers-status-page からのテスト通知",
|
|
6695
|
+
"notification.test.text": "通知先「{target}」に送信できました。送信時刻: {time}",
|
|
6696
|
+
"notification.link.createIncident": "ページ {page} に障害告知を作成",
|
|
6697
|
+
"incident.auto.title": "{components} の障害",
|
|
6698
|
+
"incident.auto.investigating": "{time} から {components} が停止していることを検知しました。調査しています。",
|
|
6699
|
+
"incident.auto.update": "{time} から {components} も停止していることを検知しました。",
|
|
6700
|
+
"incident.auto.stopped": "{time} に {components} の監視が止まったため、この告知は自動で解決されました。",
|
|
6701
|
+
"incident.auto.resolved": "{time} に {components} が復旧しました。この告知は自動で解決されました。",
|
|
6702
|
+
"incident.auto.reopened": "{time} から {components} が再び停止していることを検知したため、この告知を再開しました。",
|
|
6703
|
+
"incident.auto.partial": "{time} から {components} の停止は解消しましたが、性能低下が続いています。",
|
|
6704
|
+
"ui.language": "言語",
|
|
6705
|
+
"ui.loading": "読み込み中…",
|
|
6706
|
+
"ui.skipToContent": "本文へ移動",
|
|
6707
|
+
"stage.investigating": "調査中",
|
|
6708
|
+
"stage.identified": "原因特定",
|
|
6709
|
+
"stage.monitoring": "経過観察",
|
|
6710
|
+
"stage.resolved": "解決",
|
|
6711
|
+
"impact.none": "影響なし",
|
|
6712
|
+
"impact.degraded": "性能低下",
|
|
6713
|
+
"impact.down": "停止",
|
|
6714
|
+
"public.defaultTitle": "ステータス",
|
|
6715
|
+
"public.header.website": "Web サイトを開く",
|
|
6716
|
+
"public.nav.label": "リンク",
|
|
6717
|
+
"public.nav.menu": "メニュー",
|
|
6718
|
+
"public.footer.timeZone": "時刻はお使いのタイムゾーン({timeZone})で表示しています。",
|
|
6719
|
+
"public.state.up": "正常",
|
|
6720
|
+
"public.state.degraded": "性能低下",
|
|
6721
|
+
"public.state.down": "停止",
|
|
6722
|
+
"public.state.unknown": "不明",
|
|
6723
|
+
"public.overall.up": "すべてのシステムが正常に稼働しています",
|
|
6724
|
+
"public.overall.degraded": "一部のシステムで性能が低下しています",
|
|
6725
|
+
"public.overall.down": "一部のシステムが停止しています",
|
|
6726
|
+
"public.overall.unknown": "状態が不明です",
|
|
6727
|
+
"public.overall.unknownDetail": "一部のシステムで最近の監視結果が得られていません。",
|
|
6728
|
+
"public.overall.empty": "このページにはまだシステムが登録されていません",
|
|
6729
|
+
"public.overall.maintenance": "メンテナンスを実施しています。",
|
|
6730
|
+
"public.overall.stale": "この表示は最新ではない可能性があります",
|
|
6731
|
+
"public.overall.staleDetail": "ページを更新できませんでした。最後に確認できた状態:「{state}」({time})",
|
|
6732
|
+
"public.freshness.updated": "{time} 更新",
|
|
6733
|
+
"public.freshness.age": "最終更新 {age}",
|
|
6734
|
+
"public.freshness.failed": "更新できませんでした({reason})。",
|
|
6735
|
+
"public.freshness.retrying": "再試行しています…",
|
|
6736
|
+
"public.freshness.retryAt": "{time}に再試行します。",
|
|
6737
|
+
"public.freshness.retryNow": "今すぐ再試行",
|
|
6738
|
+
"public.freshness.incidentsOutdated": "障害告知とメンテナンスの情報を今は読み込めないため、古い可能性があります。各システムの状態は最新です。",
|
|
6739
|
+
"public.error.network": "サーバーに接続できません",
|
|
6740
|
+
"public.error.http": "サーバーエラー {status}",
|
|
6741
|
+
"public.error.unknown": "予期しないエラー",
|
|
6742
|
+
"public.unavailable.title": "現在、状態を表示できません",
|
|
6743
|
+
"public.unavailable.detail": "状態を読み込めませんでした({reason})。システムが稼働しているかどうかは分かりません。",
|
|
6744
|
+
"public.notFound.title": "見つかりません",
|
|
6745
|
+
"public.notFound.page": "このアドレスにステータスページはありません。",
|
|
6746
|
+
"public.notFound.incident": "このステータスページにその障害告知はありません。",
|
|
6747
|
+
"public.notFound.path": "このアドレスには何もありません。",
|
|
6748
|
+
"public.notFound.home": "ステータスページへ",
|
|
6749
|
+
"public.incidents.heading": "発生中の障害",
|
|
6750
|
+
"public.incident.affects": "影響: {components}",
|
|
6751
|
+
"public.incident.started": "{time} 発生",
|
|
6752
|
+
"public.incident.ongoingSince": "{time} から継続中",
|
|
6753
|
+
"public.incident.lasted": "{from} から {duration}",
|
|
6754
|
+
"public.incident.olderUpdates": "以前の更新は省略しています。すべての経過を見る",
|
|
6755
|
+
"public.incident.earlierUpdates": "以前の更新を表示",
|
|
6756
|
+
"public.incident.earlierFailed": "以前の更新を読み込めませんでした({reason})。",
|
|
6757
|
+
"public.incident.back": "現在の状態",
|
|
6758
|
+
"public.maintenance.activeHeading": "実施中のメンテナンス",
|
|
6759
|
+
"public.maintenance.upcomingHeading": "予定されているメンテナンス",
|
|
6760
|
+
"public.maintenance.until": "{to} まで実施中",
|
|
6761
|
+
"public.maintenance.window": "{from} 〜 {to}",
|
|
6762
|
+
"public.maintenance.components": "対象: {components}",
|
|
6763
|
+
"public.components.heading": "システム",
|
|
6764
|
+
"public.components.stale": "最後に確認できた状態を表示しています。",
|
|
6765
|
+
"public.components.historyFailed": "日ごとの履歴を読み込めませんでした。再試行しています。",
|
|
6766
|
+
"public.component.maintenance": "メンテナンス中",
|
|
6767
|
+
"public.component.uptime": "過去 {period}の稼働率 {uptime}",
|
|
6768
|
+
"public.component.coverage": "網羅率 {coverage}",
|
|
6769
|
+
"public.component.noUptime": "この期間の稼働率なし: メンテナンス以外の時間に結果がありません",
|
|
6770
|
+
"public.component.notMonitored": "監視なし: 状態は障害告知だけで決まります",
|
|
6771
|
+
"public.bars.label": "{component}: 過去 {period}、1日1本",
|
|
6772
|
+
"public.bars.today": "今日",
|
|
6773
|
+
"public.day.pending": "計算中",
|
|
6774
|
+
"public.day.unmonitored": "監視なし",
|
|
6775
|
+
"public.day.noData": "データなし",
|
|
6776
|
+
"public.day.uptime": "稼働率 {uptime}",
|
|
6777
|
+
"public.day.downtime": "停止 {duration}",
|
|
6778
|
+
"public.day.degraded": "一時的に性能低下",
|
|
6779
|
+
"public.day.coverage": "網羅率 {coverage}",
|
|
6780
|
+
"public.day.incidents": "障害告知: {titles}",
|
|
6781
|
+
"public.day.maintenance": "メンテナンス: {titles}",
|
|
6782
|
+
"public.legend.up": "正常",
|
|
6783
|
+
"public.legend.degraded": "性能低下",
|
|
6784
|
+
"public.legend.down": "停止",
|
|
6785
|
+
"public.legend.noData": "データなし",
|
|
6786
|
+
"public.legend.incident": "障害告知",
|
|
6787
|
+
"public.legend.maintenance": "メンテナンス",
|
|
6788
|
+
"public.legend.uptime": "稼働率は監視結果だけから計算し、メンテナンス中と結果のない時間は除きます。網羅率は、予定したチェックのうち結果が得られた割合です。",
|
|
6789
|
+
"public.history.heading": "過去の障害",
|
|
6790
|
+
"public.history.none": "過去の障害はありません。",
|
|
6791
|
+
"public.history.more": "さらに表示",
|
|
6792
|
+
"public.history.failed": "過去の障害を読み込めませんでした({reason})。",
|
|
6793
|
+
"public.stoppages.heading": "監視で検知した停止",
|
|
6794
|
+
"public.stoppages.intro": "障害告知の有無にかかわらず、監視で停止が確定した期間です。",
|
|
6795
|
+
"public.stoppages.none": "過去 {period}に検知した停止はありません。",
|
|
6796
|
+
"public.stoppages.period": "{from} から {duration}",
|
|
6797
|
+
"public.stoppages.ongoing": "{from} から継続中(現在 {duration})",
|
|
6798
|
+
"public.stoppages.all": "すべて表示({count} 件)",
|
|
6799
|
+
"public.stoppages.fewer": "折りたたむ",
|
|
6800
|
+
"public.stoppages.truncated": "この期間のより古い停止は表示していません。",
|
|
6801
|
+
"public.stoppages.failed": "停止の履歴を読み込めませんでした。再試行しています。",
|
|
6802
|
+
"public.component.uptimeSince": "{date} からの稼働率 {uptime}",
|
|
6803
|
+
"public.component.notEnoughData": "稼働率を出すにはデータが足りません(結果 {duration})",
|
|
6804
|
+
"public.component.notMonitoredYet": "まだ監視していません",
|
|
6805
|
+
"public.components.historyStale": "日ごとの履歴を更新できませんでした({reason})。{time} 時点の内容です。",
|
|
6806
|
+
"public.day.notYet": "まだ監視していません",
|
|
6807
|
+
"public.legend.notMonitored": "監視なし(または監視前)",
|
|
6808
|
+
"public.modern.report": "問題を報告",
|
|
6809
|
+
"public.modern.updated": "最終更新 {time}",
|
|
6810
|
+
"public.modern.theme": "表示テーマ",
|
|
6811
|
+
"public.modern.theme.light": "ライト",
|
|
6812
|
+
"public.modern.theme.dark": "ダーク",
|
|
6813
|
+
"public.modern.incident.meta": "{time} に発生 · 影響: {components}",
|
|
6814
|
+
"public.modern.incident.started": "{time} に発生",
|
|
6815
|
+
"public.modern.maintenance.badge": "メンテナンス中",
|
|
6816
|
+
"public.modern.maintenance.scheduled": "予定メンテナンス",
|
|
6817
|
+
"public.modern.maintenance.window": "{from} 〜 {to}(予定)",
|
|
6818
|
+
"public.modern.maintenance.progress": "{elapsed}経過 / 予定 {total}",
|
|
6819
|
+
"public.modern.components.label": "コンポーネントの稼働状況",
|
|
6820
|
+
"public.modern.group.count": "{count} コンポーネント",
|
|
6821
|
+
"public.modern.group.one": "1 コンポーネント",
|
|
6822
|
+
"public.modern.uptime": "{uptime} 稼働",
|
|
6823
|
+
"public.modern.uptime.noData": "データなし",
|
|
6824
|
+
"public.modern.uptime.notEnough": "データ不足",
|
|
6825
|
+
"public.modern.uptime.notMonitored": "監視なし",
|
|
6826
|
+
"public.modern.uptime.notYet": "監視前",
|
|
6827
|
+
"public.modern.day.noIssues": "障害の報告なし",
|
|
6828
|
+
"public.modern.day.degraded": "性能低下 {duration}",
|
|
6829
|
+
"public.modern.day.maintenance": "メンテナンス {duration}",
|
|
6830
|
+
"public.modern.day.timeline": "{timezone} の0時から24時まで",
|
|
6831
|
+
"public.modern.event.incident": "障害告知",
|
|
6832
|
+
"public.modern.event.maintenance": "メンテナンス",
|
|
6833
|
+
"public.modern.event.stoppage": "停止(監視で検知)",
|
|
6834
|
+
"public.modern.legend.maintenance": "メンテナンス",
|
|
6835
|
+
"public.modern.latency.toggle": "{component} の応答時間",
|
|
6836
|
+
"public.modern.latency.value": "{ms} ms",
|
|
6837
|
+
"public.modern.latency.latest": "現在",
|
|
6838
|
+
"public.modern.latency.average": "平均",
|
|
6839
|
+
"public.modern.latency.p95": "95パーセンタイル",
|
|
6840
|
+
"public.modern.latency.period": "表示期間",
|
|
6841
|
+
"public.modern.latency.day": "24時間",
|
|
6842
|
+
"public.modern.latency.week": "7日間",
|
|
6843
|
+
"public.modern.latency.month": "30日間",
|
|
6844
|
+
"public.modern.latency.now": "現在",
|
|
6845
|
+
"public.modern.latency.chart": "{component} の応答時間({period})。平均 {average}、95パーセンタイル {p95}",
|
|
6846
|
+
"public.modern.latency.none": "この期間の応答時間はまだありません。",
|
|
6847
|
+
"public.modern.latency.loading": "応答時間を読み込み中…",
|
|
6848
|
+
"public.modern.latency.failed": "応答時間を読み込めませんでした({reason})。",
|
|
6849
|
+
"public.modern.notices.heading": "最近のお知らせ(過去7日間)",
|
|
6850
|
+
"public.modern.notices.none": "過去7日間のお知らせはありません。",
|
|
6851
|
+
"public.modern.notices.history": "履歴を見る",
|
|
6852
|
+
"public.modern.notices.all": "お知らせの履歴をすべて表示",
|
|
6853
|
+
"public.modern.notices.resolved": "解決済み",
|
|
6854
|
+
"public.modern.notices.period": "{from} 〜 {to}",
|
|
6855
|
+
"public.modern.notices.show": "これまでの経過",
|
|
6856
|
+
"public.modern.notices.hide": "経過を閉じる",
|
|
6857
|
+
"public.modern.history.title": "お知らせの履歴"
|
|
6858
|
+
}
|
|
6719
6859
|
})).flatMap(([path, messages]) => {
|
|
6720
6860
|
const tag = localeOfFile(path);
|
|
6721
6861
|
if (tag === void 0) {
|
|
@@ -8013,7 +8153,8 @@ async function pages(admin) {
|
|
|
8013
8153
|
id: component.id,
|
|
8014
8154
|
name: component.name,
|
|
8015
8155
|
monitors: component.monitors
|
|
8016
|
-
}))
|
|
8156
|
+
})),
|
|
8157
|
+
frame: page.frame
|
|
8017
8158
|
})),
|
|
8018
8159
|
uploads: uploadsBucket(admin.env) !== void 0
|
|
8019
8160
|
});
|
|
@@ -8050,7 +8191,7 @@ async function imageIssues(env, current, images) {
|
|
|
8050
8191
|
async function putPageAppearance(admin) {
|
|
8051
8192
|
const page = findPage(admin.params["pageId"] ?? "");
|
|
8052
8193
|
if (page === void 0) return notFound$2("page");
|
|
8053
|
-
const body = await readBody(admin.request, pageAppearanceSchema);
|
|
8194
|
+
const body = await readBody(admin.request, pageAppearanceSchema, FRAME_LIMITS.appearanceRequestBytes);
|
|
8054
8195
|
if (!body.ok) return body.response;
|
|
8055
8196
|
const { version, ...fields } = body.value;
|
|
8056
8197
|
const current = await getAppearance(admin.env.DB, page.id);
|