diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2022-10-26 10:08:24 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2022-10-26 10:08:24 -0700 |
commit | 24bc899cff33f8e59c1aad9d0b586bb4c79dce27 (patch) | |
tree | 8db6706318352a1cb842aa35c321e06b660cd6d4 /_plugins | |
parent | glep.css: Use same font in Contents heading as in h2 (diff) | |
download | www-24bc899cff33f8e59c1aad9d0b586bb4c79dce27.tar.gz www-24bc899cff33f8e59c1aad9d0b586bb4c79dce27.tar.bz2 www-24bc899cff33f8e59c1aad9d0b586bb4c79dce27.zip |
_plugins/wkd: hacky advanced generator
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to '_plugins')
-rw-r--r-- | _plugins/wkd.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/_plugins/wkd.rb b/_plugins/wkd.rb index 6d75380..968db03 100644 --- a/_plugins/wkd.rb +++ b/_plugins/wkd.rb @@ -22,7 +22,7 @@ module Gentoo '--with-colon', ].freeze - def generate_each_nick(site, keyring, nick, fps) + def generate_each_nick(site, keyring, nick, fps, email_domain) # Do not run if we have no fingerprints to do # otherwise GPG will print 'gpg: WARNING: nothing exported' return if fps.empty? @@ -31,6 +31,7 @@ module Gentoo keydata = p.read next if keydata.empty? site.pages << WKDFile.new(site, nick, keydata) + site.pages << WKDFile.new(site, nick, keydata, email_domain) end end @@ -59,7 +60,9 @@ module Gentoo begin fps = details['gpgfp'].map { |fp| fp.gsub(/\s+/, '').upcase } # Run only on the intersection of fingerprints we want and fingerprints we have - generate_each_nick(site, keyring, nick, (keyring_fps & fps)) + # TODO: extract the domain here to use for WKD Advanced, for future + # cases where we have @FOO.gentoo.org emails. + generate_each_nick(site, keyring, nick, (keyring_fps & fps), 'gentoo.org') rescue # fail them silently end @@ -73,10 +76,14 @@ module Gentoo end class WKDFile < Jekyll::Page - def initialize(site, nick, keydata) + def initialize(site, nick, keydata, email_domain=nil) @site = site @base = @site.source - @dir = WKDGenerator::WKD_DIR + 'hu/' + # IF email_domain is empty, then you get WKD direct + dir_parts = [WKDGenerator::WKD_DIR, 'hu'] + dir_parts << email_domain if !email_domain.nil? && email_domain != '' + dir_parts << '' # extra trailing empty element to get trailing slash + @dir = File.join(dir_parts) @name = Base32.encode(Digest::SHA1.digest(nick.downcase)) process(@name) |