ultimate-jekyll-manager 0.0.280 → 0.0.282

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.
@@ -26,6 +26,10 @@ export default function (Manager, options) {
26
26
  unauthenticated
27
27
  });
28
28
 
29
+ // LEGACY: Handle desktop app auth params (e.g. ?destination=appscheme://page&source=app)
30
+ // TODO: Remove this call AND the _legacyTranslateAppAuth function when legacy desktop app support is no longer needed
31
+ _legacyTranslateAppAuth();
32
+
29
33
  // Track if we just signed out to avoid redirect loops
30
34
  let justSignedOut = false;
31
35
 
@@ -243,3 +247,36 @@ async function sendUserSignupMetadata(user, webManager) {
243
247
  // Don't throw - we don't want to block the signup flow
244
248
  }
245
249
  }
250
+
251
+ // LEGACY: Translate desktop app auth params to UJM format
252
+ // Legacy apps send: ?destination=appscheme://page&source=app&signout=true&cb=timestamp
253
+ // UJM expects: ?authReturnUrl=...&authSignout=true
254
+ // TODO: Remove this function AND its call above when legacy desktop app support is no longer needed
255
+ function _legacyTranslateAppAuth() {
256
+ const url = new URL(window.location.href);
257
+ const destination = url.searchParams.get('destination');
258
+ const source = url.searchParams.get('source');
259
+
260
+ if (source !== 'app' || !destination) {
261
+ return;
262
+ }
263
+
264
+ // Chain through /token page to generate a custom token before redirecting to the app
265
+ const tokenPageUrl = new URL('/token', window.location.origin);
266
+ tokenPageUrl.searchParams.set('authReturnUrl', destination);
267
+ url.searchParams.set('authReturnUrl', tokenPageUrl.toString());
268
+
269
+ // Translate signout param
270
+ if (url.searchParams.get('signout') === 'true') {
271
+ url.searchParams.set('authSignout', 'true');
272
+ }
273
+
274
+ // Clean up legacy params and update URL
275
+ url.searchParams.delete('destination');
276
+ url.searchParams.delete('source');
277
+ url.searchParams.delete('signout');
278
+ url.searchParams.delete('cb');
279
+ window.history.replaceState({}, '', url.toString());
280
+
281
+ console.log('[Auth] Translated legacy app params:', url.toString());
282
+ }
@@ -184,7 +184,7 @@ function showRequestStatus(request) {
184
184
 
185
185
  const createdDate = new Date(request.metadata.created.timestamp).toLocaleDateString();
186
186
 
187
- if (request.status === 'complete') {
187
+ if (request.status === 'completed') {
188
188
  $statusTitle.textContent = 'Your data is ready';
189
189
  $statusMessage.textContent = `Your data request from ${createdDate} has been processed. Click below to download your data package. This download will expire 30 days after your data became available.`;
190
190
  $download.classList.remove('d-none');
@@ -47,11 +47,24 @@ export default function (Manager) {
47
47
 
48
48
  // Handle redirect or URL update
49
49
  if (authReturnUrl) {
50
- // Redirect to return URL with token (for electron/deep links)
50
+ // Redirect to return URL with token
51
51
  updateStatus('Redirecting...');
52
52
  const returnUrl = new URL(authReturnUrl);
53
53
  returnUrl.searchParams.set('authToken', token);
54
- window.location.href = returnUrl.toString();
54
+
55
+ // LEGACY: Reformat token for desktop app deep links
56
+ // TODO: Remove this block when legacy desktop app support is no longer needed
57
+ _legacyTranslateTokenRedirect(returnUrl, token);
58
+
59
+ const redirectUrl = returnUrl.toString();
60
+ console.log('[Token] Redirecting to:', redirectUrl);
61
+
62
+ // Show retry button after a delay in case the redirect was cancelled (e.g. custom protocol dialog)
63
+ setTimeout(() => {
64
+ updateStatus('If you were not redirected, <a href="' + redirectUrl + '">click here to try again</a>.');
65
+ }, 3000);
66
+
67
+ window.location.href = redirectUrl;
55
68
  } else {
56
69
  // Add token to current URL (for browser extensions)
57
70
  // Extension background will detect this and close the tab
@@ -104,4 +117,14 @@ export default function (Manager) {
104
117
  $status.classList.add('d-none');
105
118
  }
106
119
  }
120
+
121
+ // LEGACY: Reformat token for desktop app deep links
122
+ // Legacy desktop apps expect ?payload={"token":"X"} instead of ?authToken=X for custom protocol URLs
123
+ // TODO: Remove this function AND its call above when legacy desktop app support is no longer needed
124
+ function _legacyTranslateTokenRedirect(returnUrl, token) {
125
+ if (returnUrl.protocol !== 'http:' && returnUrl.protocol !== 'https:') {
126
+ returnUrl.searchParams.delete('authToken');
127
+ returnUrl.searchParams.set('payload', JSON.stringify({ token: token }));
128
+ }
129
+ }
107
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.280",
3
+ "version": "0.0.282",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {