saltfish 0.2.23 → 0.2.25

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.
@@ -2066,7 +2066,7 @@ class PlayerInitializationService {
2066
2066
  return false;
2067
2067
  }
2068
2068
  const currentTime = Date.now();
2069
- const MAX_AGE_MS = 1e4;
2069
+ const MAX_AGE_MS = 4e3;
2070
2070
  const inProgressEntry = Object.entries(watchedPlaylists).find(([playlistId, status]) => {
2071
2071
  if ((status == null ? void 0 : status.status) !== "in_progress") {
2072
2072
  return false;
@@ -8404,6 +8404,16 @@ class TriggerManager {
8404
8404
  const hasWatched = watchedPlaylists && watchedPlaylists[playlistId];
8405
8405
  return !hasWatched;
8406
8406
  }
8407
+ /**
8408
+ * Normalizes a URL by removing trailing slash (unless it's the root path)
8409
+ * @param url - The URL to normalize
8410
+ */
8411
+ normalizeUrl(url) {
8412
+ if (url.endsWith("/") && url.lastIndexOf("/") > url.indexOf("://") + 2) {
8413
+ return url.slice(0, -1);
8414
+ }
8415
+ return url;
8416
+ }
8407
8417
  /**
8408
8418
  * Evaluates the URL condition for a playlist
8409
8419
  * @param triggers - The trigger configuration containing URL pattern and match type
@@ -8413,7 +8423,7 @@ class TriggerManager {
8413
8423
  if (!pattern) {
8414
8424
  return true;
8415
8425
  }
8416
- const currentUrl = window.location.href.split("#")[0];
8426
+ const currentUrl = this.normalizeUrl(window.location.href.split("#")[0]);
8417
8427
  const currentPath = window.location.pathname;
8418
8428
  if (triggers.urlMatchType === "regex") {
8419
8429
  try {
@@ -8430,6 +8440,9 @@ class TriggerManager {
8430
8440
  pattern = "*" + pattern + "*";
8431
8441
  }
8432
8442
  const hasWildcards = pattern.includes("*");
8443
+ if (!hasWildcards && (!triggers.urlMatchType || triggers.urlMatchType === "exact" || triggers.urlMatchType === "contains")) {
8444
+ pattern = this.normalizeUrl(pattern);
8445
+ }
8433
8446
  const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8434
8447
  let regexPattern = escapedPattern.replace(/\\\*/g, ".*");
8435
8448
  if (!hasWildcards) {