You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2022/05/04 10:29:15 UTC

[whimsy] branch master updated: Only scan ASF pages; option to show url

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new e95e29e7 Only scan ASF pages; option to show url
e95e29e7 is described below

commit e95e29e7757be4440bc92148f420a8ad8bfe1a8d
Author: Sebb <se...@apache.org>
AuthorDate: Wed May 4 11:29:10 2022 +0100

    Only scan ASF pages; option to show url
---
 tools/scan-page.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/scan-page.js b/tools/scan-page.js
index 55b06cdc..714b6a5d 100755
--- a/tools/scan-page.js
+++ b/tools/scan-page.js
@@ -7,11 +7,16 @@ module.paths.push('/usr/lib/node_modules')
 const puppeteer = require('puppeteer');
 
 const target = process.argv[2] || 'http://apache.org/';
+const inithost = new URL(target).host;
+
 const option = process.argv[3] || '';
 
 function isASFhost(host) {
     return host == '' || host == 'apache.org' || host.endsWith('.apache.org') || host.endsWith('.apachecon.com');
 }
+if (!isASFhost(inithost)) {
+    throw new Error("Only ASF hosts are supported - saw " + inithost);
+}
 
 (async () => {
   const browser = await puppeteer.launch();
@@ -33,7 +38,11 @@ function isASFhost(host) {
                 console.log(url);
                 interceptedRequest.continue();
             } else {
-                console.log(host);
+                if (option == 'showurl') {
+                  console.log(url);
+                } else {
+                  console.log(host);
+                }
                 interceptedRequest.abort();
             }
         } else {