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 8bb0d446 Default to showing transitive references separately
8bb0d446 is described below
commit 8bb0d446c3516f76d376f22504cbfabc909b7763
Author: Sebb <[email protected]>
AuthorDate: Sat Apr 20 15:05:13 2024 +0100
Default to showing transitive references separately
---
www/members/page-scanner.cgi | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/www/members/page-scanner.cgi b/www/members/page-scanner.cgi
index 0df899c8..6bda8d67 100755
--- a/www/members/page-scanner.cgi
+++ b/www/members/page-scanner.cgi
@@ -10,13 +10,14 @@ require_relative '../../tools/asf-site-check'
print "Content-type: text/plain; charset=UTF-8\r\n\r\n"
-# puts ENV['REQUEST_URI']
+DIVIDER=' <= '
+
qs = ENV['QUERY_STRING']
if qs =~ %r{^url=(https?://[^&]+)(?:&(.+))?}
url = $1
option = $2
# we only want full URLs
- option = 'all' unless option == 'showurl'
+ option = 'allref' unless %w{all showurl}.include? option
print "Checking the page #{url}\n\n"
puts "The following references were found to hosts other than apache.org and
apachecon.com"
puts "The first column shows if the host is recognised as being under ASF
control according to"
@@ -25,9 +26,31 @@ if qs =~ %r{^url=(https?://[^&]+)(?:&(.+))?}
cmd = ['node', '/srv/whimsy/tools/scan-page.js', url, option]
out, err, status = Open3.capture3(*cmd)
if status.success?
+ if out == ''
+ puts "No external references found"
+ else
+ puts "Top-level references:"
+ end
+ extras = Hash.new {|h,k| h[k] = Hash.new}
out.split("\n").each do |url|
- print ASFDOMAIN.asfurl?(url) ? 'OK ' : 'NO '
- puts url
+ p1, p2 = url.split(DIVIDER)
+ if p2
+ extras[p2][p1]=1
+ else
+ print ASFDOMAIN.asfurl?(url) ? 'OK ' : 'NO '
+ puts url
+ end
+ end
+ if extras.size > 0
+ puts ""
+ puts "Transitive references:"
+ extras.each do |k, v|
+ puts "Loaded by: "+k
+ v.each do |url,_|
+ print ASFDOMAIN.asfurl?(url) ? 'OK ' : 'NO '
+ puts url
+ end
+ end
end
else
puts err.scan(/^Error:.+/).first || err # Show only the Error line if
present