@mushi-mushi/core 1.19.1 → 1.19.2

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
@@ -115,8 +115,9 @@ function createApiClient(options) {
115
115
  const errorBody = await response.json().catch(() => ({}));
116
116
  if ((response.status === 401 || response.status === 403) && !_credWarningEmitted) {
117
117
  _credWarningEmitted = true;
118
+ const where = baseUrl === DEFAULT_API_ENDPOINT ? "Get the correct values at: https://kensaur.us/mushi-mushi/admin/projects" : "Get the correct values from your Mushi console's Projects page.";
118
119
  console.error(
119
- `[Mushi] Credentials rejected (HTTP ${response.status}). Check your Project ID and API key scope (must be "report:write"). Get the correct values at: https://kensaur.us/mushi-mushi/admin/projects`
120
+ `[Mushi] Credentials rejected (HTTP ${response.status}). Check your Project ID and API key scope (must be "report:write"). ` + where
120
121
  );
121
122
  }
122
123
  if (response.status >= 500 && retries > 0) {
@@ -1996,10 +1997,20 @@ function readPageFaviconHref() {
1996
1997
  ];
1997
1998
  for (const sel of selectors) {
1998
1999
  const link = document.querySelector(sel);
1999
- if (link?.href) return link.href;
2000
+ const href = link?.href;
2001
+ if (href && isSafeFaviconHref(href)) return href;
2000
2002
  }
2001
2003
  return null;
2002
2004
  }
2005
+ function isSafeFaviconHref(href) {
2006
+ try {
2007
+ const base = typeof location !== "undefined" ? location.href : void 0;
2008
+ const protocol = new URL(href, base).protocol;
2009
+ return protocol === "http:" || protocol === "https:";
2010
+ } catch {
2011
+ return false;
2012
+ }
2013
+ }
2003
2014
 
2004
2015
  exports.DEFAULT_API_ENDPOINT = DEFAULT_API_ENDPOINT;
2005
2016
  exports.MAX_REPORT_PAYLOAD_BYTES = MAX_REPORT_PAYLOAD_BYTES;