home-hosted 0.9.0 → 0.9.1

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/cli.js CHANGED
@@ -724,7 +724,7 @@ function duplicateWebhookIds(targets) {
724
724
  }
725
725
  return [...duplicates];
726
726
  }
727
- var bindSchema, workspaceIdSchema, workspaceSchema, workspaceCreateSchema, workspaceRenameSchema, portSchema, onPortConflictSchema, onPortConflictDefaultSchema, restartSchema, httpCheckSchema, resourcesSchema, healthSchema, stopSchema, bootstrapSchema, bootstrapOrNullSchema, labelOrNullSchema, logBufferLinesSchema, serverSchema, authSchema, notificationPolicyShape, notificationDefaultsSchema, useOwnSettingsSchema, telegramDestinationSchema, webhookTargetSchema, notificationTargetSchema, destinationListSchema, notificationsSchema, logsSchema, tlsSchema, hostSchema, ddnsRecordTypeSchema, ddnsAccountSchema, ddnsDomainSchema, ddnsIpv4Schema, ddnsIpv6Schema, ddnsConfigSchema, ddnsRecordStateSchema, ddnsRecordViewSchema, ddnsStatusSchema, ddnsProviderFieldSchema, ddnsProviderInfoSchema, ddnsViewSchema, ddnsCredentialsSchema, backupScheduleSchema, backupsSchema, controlSchema, defaultsSchema, restartPatchSchema, httpCheckPatchSchema, resourcesPatchSchema, healthPatchSchema, stopPatchSchema, authPatchSchema, notificationPolicyPatchShape, destinationPatchSchema, notificationsPatchSchema, hostPatchSchema, backupSchedulePatchSchema, backupsPatchSchema, logsPatchSchema, tlsPatchSchema, controlPatchSchema, defaultsPatchSchema, editableFields, serverPatchSchema, serverCreateSchema, nannySpecSchema, nannyExitSchema, nannyStateSchema, entryStateSchema, settingsPatchSchema, workspaceSettingsPatchSchema, authStatusSchema, tlsStatusSchema, proxyEngineSchema, proxyTargetSchema, proxyTlsModeSchema, proxyRouteSchema, proxyCertificateSchema, proxyCertificateStateSchema, proxyDns01Schema, proxyConfigSchema, proxyEngineSourceSchema, proxyEngineStatusSchema, proxyEngineInfoSchema, proxyRouteStatusSchema, proxyRouteViewSchema, proxyRunStateSchema, proxyStatusSchema, proxyCertificateViewSchema, proxyDnsAccountViewSchema, proxyViewSchema, proxyRoutePatchSchema, proxyPatchSchema, proxyCertificateUploadSchema, proxyEngineInstallSchema, notificationPolicyStatusShape, destinationStatusSchema, telegramChatsSchema, notificationViewSchema, sessionViewSchema, loginSchema, passwordValueSchema, passwordSchema, serverStatusSchema, healthStateSchema, portStateSchema, logStreamSchema, logLineSchema, historyActorSchema, historyEventSchema, serverHistorySchema, processResourcesSchema, hostDiskSchema, hostViewSchema, backupFileSchema, backupEntrySchema, backupsViewSchema, restoreItemSchema, restoreSkipSchema, restorePlanSchema, backupCreateSchema, restoreRequestSchema, serverViewSchema, healthResponseSchema, controlViewSchema, uiMetaSchema, uiStatusSchema, workspaceViewSchema, appStateSchema, logQuerySchema, freePortResultSchema, logHistoryQuerySchema, logFileInfoSchema, logServerViewSchema, logServersViewSchema, notificationActionSchema, destinationIdParamSchema, destinationTestSchema, telegramTokenSchema, apiErrorSchema, tlsUploadSchema, settingsViewSchema, settingsSavedSchema, workspaceSettingsViewSchema, workspaceSettingsSavedSchema;
727
+ var bindSchema, workspaceIdSchema, workspaceSchema, workspaceCreateSchema, workspaceRenameSchema, portSchema, onPortConflictSchema, onPortConflictDefaultSchema, restartSchema, httpCheckSchema, resourcesSchema, healthSchema, stopSchema, bootstrapSchema, bootstrapOrNullSchema, labelOrNullSchema, logBufferLinesSchema, serverSchema, authSchema, notificationPolicyShape, notificationDefaultsSchema, notificationDefaultsViewSchema, useOwnSettingsSchema, telegramDestinationSchema, webhookTargetSchema, notificationTargetSchema, destinationListSchema, notificationsSchema, logsSchema, tlsSchema, hostSchema, ddnsRecordTypeSchema, ddnsAccountSchema, ddnsDomainSchema, ddnsIpv4Schema, ddnsIpv6Schema, ddnsConfigSchema, ddnsRecordStateSchema, ddnsRecordViewSchema, ddnsStatusSchema, ddnsProviderFieldSchema, ddnsProviderInfoSchema, ddnsViewSchema, ddnsCredentialsSchema, backupScheduleSchema, backupsSchema, controlSchema, defaultsSchema, restartPatchSchema, httpCheckPatchSchema, resourcesPatchSchema, healthPatchSchema, stopPatchSchema, authPatchSchema, notificationPolicyPatchShape, destinationPatchSchema, notificationsPatchSchema, hostPatchSchema, backupSchedulePatchSchema, backupsPatchSchema, logsPatchSchema, tlsPatchSchema, controlPatchSchema, defaultsPatchSchema, editableFields, serverPatchSchema, serverCreateSchema, nannySpecSchema, nannyExitSchema, nannyStateSchema, entryStateSchema, settingsPatchSchema, workspaceSettingsPatchSchema, authStatusSchema, tlsStatusSchema, proxyEngineSchema, proxyTargetSchema, proxyTlsModeSchema, proxyRouteSchema, proxyCertificateSchema, proxyCertificateStateSchema, proxyDns01Schema, proxyConfigSchema, proxyEngineSourceSchema, proxyEngineStatusSchema, proxyEngineInfoSchema, proxyRouteStatusSchema, proxyRouteViewSchema, proxyRunStateSchema, proxyStatusSchema, proxyCertificateViewSchema, proxyDnsAccountViewSchema, proxyViewSchema, proxyRoutePatchSchema, proxyPatchSchema, proxyCertificateUploadSchema, proxyEngineInstallSchema, notificationPolicyStatusShape, destinationStatusSchema, telegramChatsSchema, notificationViewSchema, sessionViewSchema, loginSchema, passwordValueSchema, passwordSchema, serverStatusSchema, healthStateSchema, portStateSchema, logStreamSchema, logLineSchema, historyActorSchema, historyEventSchema, serverHistorySchema, processResourcesSchema, hostDiskSchema, hostViewSchema, backupFileSchema, backupEntrySchema, backupsViewSchema, restoreItemSchema, restoreSkipSchema, restorePlanSchema, backupCreateSchema, restoreRequestSchema, serverViewSchema, healthResponseSchema, controlViewSchema, uiMetaSchema, uiStatusSchema, workspaceViewSchema, appStateSchema, logQuerySchema, freePortResultSchema, logHistoryQuerySchema, logFileInfoSchema, logServerViewSchema, logServersViewSchema, notificationActionSchema, destinationIdParamSchema, destinationTestSchema, telegramTokenSchema, apiErrorSchema, tlsUploadSchema, settingsViewSchema, settingsSavedSchema, workspaceSettingsViewSchema, workspaceSettingsSavedSchema;
728
728
  var init_contracts = __esmMin((() => {
729
729
  bindSchema = type("\"local\" | \"lan\" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/");
730
730
  workspaceIdSchema = type("/^[a-z0-9][a-z0-9_-]*$/");
@@ -863,6 +863,7 @@ maxRssBytes: "number.integer >= 0 = 0" }).onUndeclaredKey("reject");
863
863
  cooldownMs: "number >= 0 = 120000"
864
864
  };
865
865
  notificationDefaultsSchema = type({ ...notificationPolicyShape }).onUndeclaredKey("reject");
866
+ notificationDefaultsViewSchema = type({ ...notificationPolicyShape });
866
867
  useOwnSettingsSchema = "boolean = true";
867
868
  telegramDestinationSchema = type({
868
869
  kind: "\"telegram\"",
@@ -1490,23 +1491,23 @@ maxRssBytes: "number.integer >= 0 = 0" }).onUndeclaredKey("reject");
1490
1491
  cooldownMs: "number"
1491
1492
  };
1492
1493
  destinationStatusSchema = type({
1493
- id: "string",
1494
- kind: "\"telegram\" | \"webhook\"",
1495
- enabled: "boolean",
1496
- useOwnSettings: "boolean",
1494
+ "id": "string",
1495
+ "kind": "\"telegram\" | \"webhook\"",
1496
+ "enabled": "boolean",
1497
+ "useOwnSettings": "boolean",
1497
1498
  ...notificationPolicyStatusShape,
1498
1499
  /** Telegram only, null on a webhook. */
1499
- chatId: "string | null",
1500
+ "chatId": "string | null",
1500
1501
  /** Telegram only: whether a bot token is stored for this destination. */
1501
- tokenSet: "boolean",
1502
+ "tokenSet": "boolean",
1502
1503
  /** Webhook only, null on a Telegram destination. */
1503
- url: "string | null",
1504
- method: "\"POST\" | \"PUT\" | null",
1505
- format: "\"json\" | \"text\" | null",
1506
- headers: "string | null",
1507
- /** Last delivery outcome, for the page. */
1508
- lastResult: "string | null",
1509
- lastResultAt: "number | null"
1504
+ "url": "string | null",
1505
+ "method": "\"POST\" | \"PUT\" | null",
1506
+ "format": "\"json\" | \"text\" | null",
1507
+ "headers": "string | null",
1508
+ /** Last delivery outcome, for the page. Optional: a newer panel may not have sent one yet. */
1509
+ "lastResult?": "string | null",
1510
+ "lastResultAt?": "number | null"
1510
1511
  });
1511
1512
  telegramChatsSchema = type({ chats: type({
1512
1513
  id: "string | number",
@@ -1514,7 +1515,7 @@ maxRssBytes: "number.integer >= 0 = 0" }).onUndeclaredKey("reject");
1514
1515
  }).array() });
1515
1516
  notificationViewSchema = type({
1516
1517
  /** The general block: what a destination inherits unless it overrides it. Optional for an older panel. */
1517
- "defaults?": notificationDefaultsSchema,
1518
+ "defaults?": notificationDefaultsViewSchema,
1518
1519
  /** Every destination, in config order. Optional for an older panel. */
1519
1520
  "destinations?": destinationStatusSchema.array()
1520
1521
  });
@@ -2106,7 +2107,7 @@ function isPlainDdns(value) {
2106
2107
  */
2107
2108
  function readTelegramTokens(value) {
2108
2109
  if (!isRecord(value)) return {};
2109
- if (typeof value.botToken === "string") return value.botToken.trim().length > 0 ? { [LEGACY_TELEGRAM_ID$1]: value.botToken.trim() } : {};
2110
+ if (typeof value.botToken === "string") return value.botToken.trim().length > 0 ? { [LEGACY_TELEGRAM_ID]: value.botToken.trim() } : {};
2110
2111
  const tokens = {};
2111
2112
  for (const [id, token] of Object.entries(value)) if (typeof token === "string" && token.trim().length > 0) tokens[id] = token.trim();
2112
2113
  return tokens;
@@ -2193,7 +2194,7 @@ function openDdns(accountId, sealed, key) {
2193
2194
  return null;
2194
2195
  }
2195
2196
  }
2196
- var COST, KEYLEN, SALT_BYTES, LEGACY_TELEGRAM_ID$1, DDNS_KEYLEN, DDNS_IV_BYTES, DDNS_AAD_PREFIX, DDNS_SEALED_ALGO, API_TOKEN_BYTES, API_TOKEN_HINT_CHARS, SecretsStore;
2197
+ var COST, KEYLEN, SALT_BYTES, LEGACY_TELEGRAM_ID, DDNS_KEYLEN, DDNS_IV_BYTES, DDNS_AAD_PREFIX, DDNS_SEALED_ALGO, API_TOKEN_BYTES, API_TOKEN_HINT_CHARS, SecretsStore;
2197
2198
  var init_secrets = __esmMin((() => {
2198
2199
  init_atomic();
2199
2200
  init_logger();
@@ -2206,7 +2207,7 @@ var init_secrets = __esmMin((() => {
2206
2207
  };
2207
2208
  KEYLEN = 64;
2208
2209
  SALT_BYTES = 16;
2209
- LEGACY_TELEGRAM_ID$1 = "telegram";
2210
+ LEGACY_TELEGRAM_ID = "telegram";
2210
2211
  DDNS_KEYLEN = 32;
2211
2212
  DDNS_IV_BYTES = 12;
2212
2213
  DDNS_AAD_PREFIX = "hh-ddns-v1:";
@@ -3886,6 +3887,13 @@ var init_control = __esmMin((() => {
3886
3887
  //#endregion
3887
3888
  //#region src/config/migrations.ts
3888
3889
  /**
3890
+ * The id the pre-list Telegram destination takes.
3891
+ *
3892
+ * **The one definition**, imported from the secrets reader, because that is where the bot token for
3893
+ * it already sits: the two have to agree on the id or the upgrade loses a working Telegram. They
3894
+ * were two literals with a comment claiming they were shared, and drifting one was undetected.
3895
+ */
3896
+ /**
3889
3897
  * Schema 1 → 2: `notifications.{telegram, webhooks}` → `notifications.{defaults, destinations}`.
3890
3898
  *
3891
3899
  * The old singleton becomes one `telegram` destination, and each webhook keeps its id, so a
@@ -3971,9 +3979,9 @@ function applyConfigMigrations(config, from, options = {}) {
3971
3979
  applied: plan.steps
3972
3980
  };
3973
3981
  }
3974
- var LEGACY_TELEGRAM_ID, configMigrations;
3982
+ var configMigrations;
3975
3983
  var init_migrations = __esmMin((() => {
3976
- LEGACY_TELEGRAM_ID = "telegram";
3984
+ init_secrets();
3977
3985
  configMigrations = [{
3978
3986
  to: 2,
3979
3987
  describe: "notifications: fold the Telegram singleton and the webhook list into one `destinations` list, with a shared `defaults` block",
@@ -17015,7 +17023,27 @@ function stateSignature(state) {
17015
17023
  workspace.ddns.ipv6,
17016
17024
  ...workspace.ddns.records.map((record) => `${record.host}:${record.type}:${record.state}:${record.ip}`)
17017
17025
  ].join(":"),
17018
- ...(workspace.notifications.destinations ?? []).map((destination) => `${destination.id}:${destination.kind}:${destination.enabled}:${destination.tokenSet}:${destination.lastResult ?? ""}`),
17026
+ ...(workspace.notifications.destinations ?? []).map((destination) => [
17027
+ destination.id,
17028
+ destination.kind,
17029
+ destination.enabled,
17030
+ destination.useOwnSettings,
17031
+ destination.chatId ?? "",
17032
+ destination.tokenSet,
17033
+ destination.url ?? "",
17034
+ destination.method ?? "",
17035
+ destination.format ?? "",
17036
+ destination.headers ?? "",
17037
+ destination.onCrash,
17038
+ destination.onUnhealthy,
17039
+ destination.onForcedRestart,
17040
+ destination.onRecovered,
17041
+ destination.onHost,
17042
+ destination.onDdns ?? "",
17043
+ destination.cooldownMs,
17044
+ destination.lastResult ?? "",
17045
+ destination.lastResultAt ?? ""
17046
+ ].join(":")),
17019
17047
  ...workspace.servers.map((server) => [
17020
17048
  server.id,
17021
17049
  server.status,