@mushi-mushi/core 1.40.0 → 1.40.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/index.d.cts CHANGED
@@ -1371,10 +1371,16 @@ interface ProjectFaviconSource {
1371
1371
  project_slug: string;
1372
1372
  /** Operator override — wins over inferred domain when set. */
1373
1373
  icon_url?: string | null;
1374
- /** e.g. https://kensaur.us — from SDK heartbeat or API key last_seen_origin */
1374
+ /** e.g. https://app.example.com — from SDK heartbeat or API key last_seen_origin */
1375
1375
  sdk_origin?: string | null;
1376
1376
  /** Connected GitHub/GitLab repo — used when SDK has not heartbeated yet. */
1377
1377
  repo_url?: string | null;
1378
+ /**
1379
+ * Hosts that serve many apps under paths (the caller's own hosting origin),
1380
+ * so their root favicon belongs to the parent site, not this app. Data from
1381
+ * the caller's config, never a list of tenants here.
1382
+ */
1383
+ shared_hosts?: readonly string[] | null;
1378
1384
  }
1379
1385
  declare function isUntrustedFaviconUrl(url: string): boolean;
1380
1386
  /** Per-domain favicon URLs — first-party assets only (no CDN globes). */
package/dist/index.d.ts CHANGED
@@ -1371,10 +1371,16 @@ interface ProjectFaviconSource {
1371
1371
  project_slug: string;
1372
1372
  /** Operator override — wins over inferred domain when set. */
1373
1373
  icon_url?: string | null;
1374
- /** e.g. https://kensaur.us — from SDK heartbeat or API key last_seen_origin */
1374
+ /** e.g. https://app.example.com — from SDK heartbeat or API key last_seen_origin */
1375
1375
  sdk_origin?: string | null;
1376
1376
  /** Connected GitHub/GitLab repo — used when SDK has not heartbeated yet. */
1377
1377
  repo_url?: string | null;
1378
+ /**
1379
+ * Hosts that serve many apps under paths (the caller's own hosting origin),
1380
+ * so their root favicon belongs to the parent site, not this app. Data from
1381
+ * the caller's config, never a list of tenants here.
1382
+ */
1383
+ shared_hosts?: readonly string[] | null;
1378
1384
  }
1379
1385
  declare function isUntrustedFaviconUrl(url: string): boolean;
1380
1386
  /** Per-domain favicon URLs — first-party assets only (no CDN globes). */
package/dist/index.js CHANGED
@@ -3154,28 +3154,6 @@ function parseIdentityToken(token) {
3154
3154
  }
3155
3155
 
3156
3156
  // src/favicon.ts
3157
- var MULTI_TENANT_PARENT_HOSTS = /* @__PURE__ */ new Set(["kensaur.us", "www.kensaur.us"]);
3158
- var SLUG_DOMAIN_HINTS = {
3159
- "glot-it": "glot.it",
3160
- glotit: "glot.it",
3161
- "solo-boss-cloud": "solo-boss.kensaur.us",
3162
- "mushi-mushi": "kensaur.us",
3163
- "how-to-talk-to-girls": "talk.kensaur.us",
3164
- htttg: "talk.kensaur.us",
3165
- tsumagoi: "tsumagoi.kensaur.us"
3166
- };
3167
- var SLUG_ICON_URL_HINTS = {
3168
- "mushi-mushi": "https://kensaur.us/mushi-mushi/admin/favicon.svg",
3169
- "solo-boss-cloud": "https://solo-boss.kensaur.us/favicon.svg",
3170
- "glot-it": "https://kensaur.us/glot-it/apple-touch-icon.png",
3171
- glotit: "https://kensaur.us/glot-it/apple-touch-icon.png",
3172
- "the-wanting-mind": "https://kensaur.us/the-wanting-mind/pwa-512x512.png",
3173
- "how-to-talk-to-girls": "https://talk.kensaur.us/pwa-192.png",
3174
- htttg: "https://talk.kensaur.us/pwa-192.png",
3175
- tsumagoi: "https://tsumagoi.kensaur.us/apple-touch-icon.png",
3176
- "help-her-take-photo": "https://kensaur.us/help-her-take-photo/assets/apple-touch-icon.png",
3177
- "yen-yen": "https://kensaur.us/yen-yen/icon.svg"
3178
- };
3179
3157
  var UNTRUSTED_FAVICON_HOSTS = [
3180
3158
  "www.google.com",
3181
3159
  "icons.duckduckgo.com",
@@ -3205,9 +3183,9 @@ function resolveProjectFaviconDomains(source) {
3205
3183
  out.push(n);
3206
3184
  };
3207
3185
  add(githubRepoDomainHint(source.repo_url));
3208
- add(SLUG_DOMAIN_HINTS[source.project_slug.toLowerCase()]);
3209
- const fromOrigin = source.sdk_origin ? originToDomain(source.sdk_origin) : null;
3210
- if (fromOrigin && !MULTI_TENANT_PARENT_HOSTS.has(fromOrigin)) {
3186
+ const fromOrigin = source.sdk_origin && !mountedUnderPath(source.sdk_origin) ? originToDomain(source.sdk_origin) : null;
3187
+ const shared = new Set((source.shared_hosts ?? []).map((h) => h.trim().toLowerCase()).filter(Boolean));
3188
+ if (fromOrigin && !shared.has(fromOrigin) && !shared.has(fromOrigin.replace(/^www\./, ""))) {
3211
3189
  add(fromOrigin);
3212
3190
  }
3213
3191
  return out;
@@ -3221,8 +3199,6 @@ function projectFaviconUrlCandidates(source, size = 32) {
3221
3199
  seen.add(url);
3222
3200
  urls.push(url);
3223
3201
  };
3224
- const slugHint = SLUG_ICON_URL_HINTS[source.project_slug.toLowerCase()];
3225
- if (slugHint) push(slugHint);
3226
3202
  for (const domain of resolveProjectFaviconDomains(source)) {
3227
3203
  for (const url of faviconUrlCandidates(domain, size)) {
3228
3204
  push(url);
@@ -3230,6 +3206,14 @@ function projectFaviconUrlCandidates(source, size = 32) {
3230
3206
  }
3231
3207
  return urls;
3232
3208
  }
3209
+ function mountedUnderPath(origin) {
3210
+ try {
3211
+ const url = new URL(origin.includes("://") ? origin : `https://${origin}`);
3212
+ return url.pathname.replace(/\/+$/, "") !== "";
3213
+ } catch {
3214
+ return false;
3215
+ }
3216
+ }
3233
3217
  function originToDomain(origin) {
3234
3218
  const trimmed = origin.trim();
3235
3219
  if (!trimmed) return null;