@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.cjs CHANGED
@@ -3156,28 +3156,6 @@ function parseIdentityToken(token) {
3156
3156
  }
3157
3157
 
3158
3158
  // src/favicon.ts
3159
- var MULTI_TENANT_PARENT_HOSTS = /* @__PURE__ */ new Set(["kensaur.us", "www.kensaur.us"]);
3160
- var SLUG_DOMAIN_HINTS = {
3161
- "glot-it": "glot.it",
3162
- glotit: "glot.it",
3163
- "solo-boss-cloud": "solo-boss.kensaur.us",
3164
- "mushi-mushi": "kensaur.us",
3165
- "how-to-talk-to-girls": "talk.kensaur.us",
3166
- htttg: "talk.kensaur.us",
3167
- tsumagoi: "tsumagoi.kensaur.us"
3168
- };
3169
- var SLUG_ICON_URL_HINTS = {
3170
- "mushi-mushi": "https://kensaur.us/mushi-mushi/admin/favicon.svg",
3171
- "solo-boss-cloud": "https://solo-boss.kensaur.us/favicon.svg",
3172
- "glot-it": "https://kensaur.us/glot-it/apple-touch-icon.png",
3173
- glotit: "https://kensaur.us/glot-it/apple-touch-icon.png",
3174
- "the-wanting-mind": "https://kensaur.us/the-wanting-mind/pwa-512x512.png",
3175
- "how-to-talk-to-girls": "https://talk.kensaur.us/pwa-192.png",
3176
- htttg: "https://talk.kensaur.us/pwa-192.png",
3177
- tsumagoi: "https://tsumagoi.kensaur.us/apple-touch-icon.png",
3178
- "help-her-take-photo": "https://kensaur.us/help-her-take-photo/assets/apple-touch-icon.png",
3179
- "yen-yen": "https://kensaur.us/yen-yen/icon.svg"
3180
- };
3181
3159
  var UNTRUSTED_FAVICON_HOSTS = [
3182
3160
  "www.google.com",
3183
3161
  "icons.duckduckgo.com",
@@ -3207,9 +3185,9 @@ function resolveProjectFaviconDomains(source) {
3207
3185
  out.push(n);
3208
3186
  };
3209
3187
  add(githubRepoDomainHint(source.repo_url));
3210
- add(SLUG_DOMAIN_HINTS[source.project_slug.toLowerCase()]);
3211
- const fromOrigin = source.sdk_origin ? originToDomain(source.sdk_origin) : null;
3212
- if (fromOrigin && !MULTI_TENANT_PARENT_HOSTS.has(fromOrigin)) {
3188
+ const fromOrigin = source.sdk_origin && !mountedUnderPath(source.sdk_origin) ? originToDomain(source.sdk_origin) : null;
3189
+ const shared = new Set((source.shared_hosts ?? []).map((h) => h.trim().toLowerCase()).filter(Boolean));
3190
+ if (fromOrigin && !shared.has(fromOrigin) && !shared.has(fromOrigin.replace(/^www\./, ""))) {
3213
3191
  add(fromOrigin);
3214
3192
  }
3215
3193
  return out;
@@ -3223,8 +3201,6 @@ function projectFaviconUrlCandidates(source, size = 32) {
3223
3201
  seen.add(url);
3224
3202
  urls.push(url);
3225
3203
  };
3226
- const slugHint = SLUG_ICON_URL_HINTS[source.project_slug.toLowerCase()];
3227
- if (slugHint) push(slugHint);
3228
3204
  for (const domain of resolveProjectFaviconDomains(source)) {
3229
3205
  for (const url of faviconUrlCandidates(domain, size)) {
3230
3206
  push(url);
@@ -3232,6 +3208,14 @@ function projectFaviconUrlCandidates(source, size = 32) {
3232
3208
  }
3233
3209
  return urls;
3234
3210
  }
3211
+ function mountedUnderPath(origin) {
3212
+ try {
3213
+ const url = new URL(origin.includes("://") ? origin : `https://${origin}`);
3214
+ return url.pathname.replace(/\/+$/, "") !== "";
3215
+ } catch {
3216
+ return false;
3217
+ }
3218
+ }
3235
3219
  function originToDomain(origin) {
3236
3220
  const trimmed = origin.trim();
3237
3221
  if (!trimmed) return null;