saltfish 0.3.23 → 0.3.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.
@@ -1801,7 +1801,7 @@ class ShareLinkService {
1801
1801
  detectShareIdFromUrl() {
1802
1802
  try {
1803
1803
  const url = window.location.href;
1804
- const regex = /saltfish-share-id=([^&]*)/;
1804
+ const regex = /saltfish-share-id=([^&#]*)/;
1805
1805
  const match = url.match(regex);
1806
1806
  if (match && match[1]) {
1807
1807
  const shareId = match[1];
@@ -1854,7 +1854,7 @@ class ShareLinkService {
1854
1854
  }
1855
1855
  /**
1856
1856
  * Main orchestration method: detects share link and fetches flow data
1857
- * @returns The flowId to auto-start, or null if no valid share link found
1857
+ * @returns The share data to auto-start, or null if no valid share link found
1858
1858
  */
1859
1859
  async shouldAutoStartSharePlaylist() {
1860
1860
  try {
@@ -1863,8 +1863,11 @@ class ShareLinkService {
1863
1863
  return null;
1864
1864
  }
1865
1865
  const shareData = await this.fetchShareData(shareId);
1866
- log("[ShareLinkService] Share link will auto-start playlist:", shareData.flowId);
1867
- return shareData.flowId;
1866
+ log("[ShareLinkService] Share link will auto-start playlist:", {
1867
+ flowId: shareData.flowId,
1868
+ isGlobal: shareData.isGlobal
1869
+ });
1870
+ return shareData;
1868
1871
  } catch (error2) {
1869
1872
  return null;
1870
1873
  }
@@ -2038,15 +2041,17 @@ class PlayerInitializationService {
2038
2041
  }
2039
2042
  const resumedPlaylist = await this.checkAndResumeInProgressPlaylist(data.watchedPlaylists || {});
2040
2043
  if (!resumedPlaylist) {
2041
- const shareFlowId = await this.shareLinkService.shouldAutoStartSharePlaylist();
2042
- if (shareFlowId) {
2043
- log("[PlayerInitializationService.fetchUserData] Share link detected, auto-starting playlist:", shareFlowId);
2044
- await this.playlistOrchestrator.startPlaylist(shareFlowId, {
2044
+ const shareData = await this.shareLinkService.shouldAutoStartSharePlaylist();
2045
+ if (shareData) {
2046
+ log("[PlayerInitializationService.fetchUserData] Share link detected, auto-starting playlist:", shareData.flowId);
2047
+ await this.playlistOrchestrator.startPlaylist(shareData.flowId, {
2045
2048
  once: false,
2046
2049
  // Always allow playback via share link
2047
2050
  position: "bottom-right",
2048
- _startedFromShareLink: true
2051
+ _startedFromShareLink: true,
2049
2052
  // Bypass backend validation
2053
+ _isGlobalShare: shareData.isGlobal
2054
+ // Pass global flag for validation
2050
2055
  });
2051
2056
  log("[PlayerInitializationService.fetchUserData] Skipped trigger monitoring due to share link auto-start");
2052
2057
  } else {
@@ -2123,15 +2128,17 @@ class PlayerInitializationService {
2123
2128
  const watchedPlaylists = anonymousUserData.watchedPlaylists || {};
2124
2129
  const resumedPlaylist = await this.checkAndResumeInProgressPlaylist(watchedPlaylists);
2125
2130
  if (!resumedPlaylist) {
2126
- const shareFlowId = await this.shareLinkService.shouldAutoStartSharePlaylist();
2127
- if (shareFlowId) {
2128
- log("[PlayerInitializationService.loadAnonymousUserData] Share link detected, auto-starting playlist:", shareFlowId);
2129
- await this.playlistOrchestrator.startPlaylist(shareFlowId, {
2131
+ const shareData = await this.shareLinkService.shouldAutoStartSharePlaylist();
2132
+ if (shareData) {
2133
+ log("[PlayerInitializationService.loadAnonymousUserData] Share link detected, auto-starting playlist:", shareData.flowId);
2134
+ await this.playlistOrchestrator.startPlaylist(shareData.flowId, {
2130
2135
  once: false,
2131
2136
  // Always allow playback via share link
2132
2137
  position: "bottom-right",
2133
- _startedFromShareLink: true
2138
+ _startedFromShareLink: true,
2134
2139
  // Bypass backend validation
2140
+ _isGlobalShare: shareData.isGlobal
2141
+ // Pass global flag for validation
2135
2142
  });
2136
2143
  log("[PlayerInitializationService.loadAnonymousUserData] Skipped trigger monitoring due to share link auto-start");
2137
2144
  } else {
@@ -2414,8 +2421,8 @@ class PlaylistValidator {
2414
2421
  updatedOptions: options
2415
2422
  };
2416
2423
  }
2417
- if ((options == null ? void 0 : options._startedFromShareLink) === true) {
2418
- log(`[PlaylistValidator] Share link detected. Allowing direct access to playlist '${playlistId}'`);
2424
+ if ((options == null ? void 0 : options._startedFromShareLink) === true && (options == null ? void 0 : options._isGlobalShare) === true) {
2425
+ log(`[PlaylistValidator] Global share link detected. Allowing direct access to playlist '${playlistId}'`);
2419
2426
  const manifestPath = `https://storage.saltfish.ai/flows2/drafts/${playlistId}.json`;
2420
2427
  return {
2421
2428
  isValid: true,
@@ -2423,6 +2430,9 @@ class PlaylistValidator {
2423
2430
  updatedOptions: options
2424
2431
  };
2425
2432
  }
2433
+ if ((options == null ? void 0 : options._startedFromShareLink) === true && (options == null ? void 0 : options._isGlobalShare) === false) {
2434
+ log(`[PlaylistValidator] Non-global share link detected. Validating against backend playlists for '${playlistId}'`);
2435
+ }
2426
2436
  const backendPlaylists = store.backendPlaylists;
2427
2437
  if (!backendPlaylists || backendPlaylists.length === 0) {
2428
2438
  ErrorHandler.handlePlaylistError(
@@ -3071,7 +3081,7 @@ class StateMachineActionHandler {
3071
3081
  }
3072
3082
  return matches;
3073
3083
  };
3074
- const maxRetries = 3;
3084
+ const maxRetries = 20;
3075
3085
  const retryDelay = 100;
3076
3086
  for (let attempt = 0; attempt < maxRetries; attempt++) {
3077
3087
  if (checkUrl()) {
@@ -11598,7 +11608,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
11598
11608
  __proto__: null,
11599
11609
  SaltfishPlayer
11600
11610
  }, Symbol.toStringTag, { value: "Module" }));
11601
- const version = "0.3.23";
11611
+ const version = "0.3.25";
11602
11612
  const packageJson = {
11603
11613
  version
11604
11614
  };