From 575812ed5f8dfd7295f4385fd257638f6ff79417 Mon Sep 17 00:00:00 2001 From: sukamat Date: Thu, 9 Jan 2025 13:09:02 -0800 Subject: [PATCH 1/2] MWPW-161920: Authenticated site support for preview - For preview/publish Helix API call, the auth token is passed in as the site is behind auth - mp4 reference check added --- tools/floodbox/bulk-action.js | 9 +++++---- tools/floodbox/floodgate/floodgate.js | 3 +++ tools/floodbox/graybox/graybox.js | 1 + tools/floodbox/references.js | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/floodbox/bulk-action.js b/tools/floodbox/bulk-action.js index 64bb78bcc2..56cae56292 100644 --- a/tools/floodbox/bulk-action.js +++ b/tools/floodbox/bulk-action.js @@ -5,11 +5,12 @@ const BATCH_SIZE = 25; const BATCH_DELAY = 2000; export class BulkAction { - constructor({ org, repo, callback }) { + constructor({ org, repo, accessToken, callback }) { this.org = org; this.repo = repo; this.callback = callback; - this.requestHandler = new RequestHandler(); + this.accessToken = accessToken; + this.requestHandler = new RequestHandler(accessToken); this.batchCount = 0; } @@ -52,9 +53,9 @@ export class BulkAction { } async function previewOrPublishPaths({ - org, repo, paths, action, callback, isDelete = false, + org, repo, paths, action, accessToken, callback, isDelete = false, }) { - const bulkAction = new BulkAction({ org, repo, callback }); + const bulkAction = new BulkAction({ org, repo, accessToken, callback }); // eslint-disable-next-line no-console console.log(`Action: ${action} :: isDelete: ${isDelete}`); await bulkAction.previewOrPublishPaths({ paths, action, isDelete }); diff --git a/tools/floodbox/floodgate/floodgate.js b/tools/floodbox/floodgate/floodgate.js index 02c13694c9..f4162a612c 100644 --- a/tools/floodbox/floodgate/floodgate.js +++ b/tools/floodbox/floodgate/floodgate.js @@ -171,6 +171,7 @@ export default class MiloFloodgate extends LitElement { repo: repoToPrevPub, paths, action: 'preview', + accessToken: this.token, callback: (status) => { // eslint-disable-next-line no-console console.log(`${status.statusCode} :: ${status.aemUrl}`); @@ -197,6 +198,7 @@ export default class MiloFloodgate extends LitElement { repo: repoToPrevPub, paths, action: 'live', + accessToken: this.token, callback: (status) => { // eslint-disable-next-line no-console console.log(`${status.statusCode} :: ${status.aemUrl}`); @@ -424,6 +426,7 @@ export default class MiloFloodgate extends LitElement { repo, paths, action: 'live', + accessToken: this.token, isDelete: true, callback: (status) => { // eslint-disable-next-line no-console diff --git a/tools/floodbox/graybox/graybox.js b/tools/floodbox/graybox/graybox.js index 8f1f027149..448b69a310 100644 --- a/tools/floodbox/graybox/graybox.js +++ b/tools/floodbox/graybox/graybox.js @@ -150,6 +150,7 @@ export default class MiloGraybox extends LitElement { repo: repoToPrevPub, paths, action: 'preview', + accessToken: this.token, callback: (status) => { // eslint-disable-next-line no-console console.log(`${status.statusCode} :: ${status.aemUrl}`); diff --git a/tools/floodbox/references.js b/tools/floodbox/references.js index d75fba935f..40134404dd 100644 --- a/tools/floodbox/references.js +++ b/tools/floodbox/references.js @@ -9,7 +9,7 @@ class References { this.htmlPaths = htmlPaths; // eslint-disable-next-line no-useless-escape - this.referencePattern = new RegExp(`https?:\/\/[^/]*--${repo}--${org}\\.[^/]*(?:page|live)(\/(?:fragments\/.*|.*\\.(?:pdf|svg|json)))`); + this.referencePattern = new RegExp(`https?:\/\/[^/]*--${repo}--${org}\\.[^/]*(?:page|live)(\/(?:fragments\/.*|.*\\.(?:pdf|svg|json|mp4)))`); this.requestHandler = new RequestHandler(accessToken); } From d4f58a0cc02eeaf4bb64429da5fd6bafb68f63c9 Mon Sep 17 00:00:00 2001 From: sukamat Date: Thu, 9 Jan 2025 13:21:28 -0800 Subject: [PATCH 2/2] removed mp4 check --- tools/floodbox/references.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/floodbox/references.js b/tools/floodbox/references.js index 40134404dd..d75fba935f 100644 --- a/tools/floodbox/references.js +++ b/tools/floodbox/references.js @@ -9,7 +9,7 @@ class References { this.htmlPaths = htmlPaths; // eslint-disable-next-line no-useless-escape - this.referencePattern = new RegExp(`https?:\/\/[^/]*--${repo}--${org}\\.[^/]*(?:page|live)(\/(?:fragments\/.*|.*\\.(?:pdf|svg|json|mp4)))`); + this.referencePattern = new RegExp(`https?:\/\/[^/]*--${repo}--${org}\\.[^/]*(?:page|live)(\/(?:fragments\/.*|.*\\.(?:pdf|svg|json)))`); this.requestHandler = new RequestHandler(accessToken); }