From 471cb8d2146d81a99eb09aef68f925c8b481a94c Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Fri, 3 Nov 2017 22:54:36 +0000 Subject: [PATCH] re-adding brid.gy flickr link to photos, refined payment urls to monzo and paypal --- nasg.py | 17 +++++-- shared.py | 20 ++++++++- templates/Singular.html | 24 +++++++--- templates/block_footer.html | 4 +- templates/style-dark.css | 26 +++++++---- templates/symbols.svg | 90 ++++++++++++++----------------------- 6 files changed, 105 insertions(+), 76 deletions(-) diff --git a/nasg.py b/nasg.py index 79600e6..c7e2443 100644 --- a/nasg.py +++ b/nasg.py @@ -564,6 +564,13 @@ class Singular(object): def shortslug(self): return shared.baseN(self.pubtime) + @property + def syndicate(self): + urls = [] + if self.photo and self.photo.is_photo: + urls.append("https://brid.gy/publish/flickr") + return urls + @property def tmplvars(self): # very simple caching because we might use this 4 times: @@ -585,6 +592,7 @@ class Singular(object): 'summary': self.summary, 'replies': self.replies, 'reactions': self.reactions, + 'syndicate': self.syndicate } return self._tmplvars @@ -605,7 +613,8 @@ class Singular(object): with open(o, 'wt') as out: logging.debug('writing file %s' % (o)) out.write(r) - os.utime(o, (self.mtime, self.mtime)) + # use the comment time, not the source file time for this + os.utime(o, (self.stime, self.stime)) def __repr__(self): return "%s/%s" % (self.category, self.fname) @@ -894,10 +903,10 @@ class WebImage(object): if self.meta.get('FileType', 'jpeg').lower() == 'jpeg': thumb.compression_quality = 94 thumb.unsharp_mask( - radius=2, + radius=1, sigma=0.5, amount=0.7, - threshold=0 + threshold=0.5 ) thumb.format = 'pjpeg' @@ -1291,7 +1300,7 @@ def build(): task = loop.create_task(magic.render()) tasks.append(task) - # TODO: send webmentions to any url + # TODO: send webmentions # do all the things! w = asyncio.wait(tasks) diff --git a/shared.py b/shared.py index 8b116ba..6960c13 100644 --- a/shared.py +++ b/shared.py @@ -318,12 +318,22 @@ class TokenDB(object): class SearchDB(object): tmplfile = 'Search.html' + #snowball = '/usr/local/lib/fts5stemmer.so' def __init__(self): self.db = sqlite3.connect( "%s" % config.get('var', 'searchdb') ) + #if os.path.exists(self.snowball): + #self.db.enable_load_extension(True) + #self.db.execute(" load_extension('%s');" % self.snowball) + #self.db.enable_load_extension(False) + + + self.db.execute('PRAGMA auto_vacuum=INCREMENTAL;') + self.db.execute('PRAGMA journal_mode = WAL;') + cursor = self.db.cursor() cursor.execute('''CREATE VIRTUAL TABLE IF NOT EXISTS data USING FTS5( id, @@ -331,7 +341,8 @@ class SearchDB(object): mtime, url, category, - title + title, + tokenize = 'porter' )''') self.db.commit() @@ -541,6 +552,13 @@ def __setup_sitevars(): for o in config.options(sub): SiteVars[section][sub].update({o: config.get(sub, o)}) + # add payment + section = 'payment' + SiteVars.update({section: {}}) + for o in config.options(section): + SiteVars[section].update({o: config.get(section, o)}) + + # push the whole thing into cache return SiteVars diff --git a/templates/Singular.html b/templates/Singular.html index 33ac519..ae77b51 100644 --- a/templates/Singular.html +++ b/templates/Singular.html @@ -18,6 +18,9 @@ {% if 'article' == post.category and post.age >= 2 %}

WARNING: this entry was published at {{ post.pubdate }}.
It might be outdated.

{% endif %} + {% for url in post.syndicate %} + + {% endfor %} {% if post.summary %} @@ -63,20 +66,31 @@ diff --git a/templates/block_footer.html b/templates/block_footer.html index e1ea2ec..8c00cf2 100644 --- a/templates/block_footer.html +++ b/templates/block_footer.html @@ -12,11 +12,13 @@ {{ site.author.email }} +{% if site.author.gpg %}
GPG/PGP public key
- {{ site.author.gpg }} + GPG key
+{% endif %} {% for silo, url in site.author.socials.items() %}
{{ silo }}
diff --git a/templates/style-dark.css b/templates/style-dark.css index bb28ab3..9419103 100644 --- a/templates/style-dark.css +++ b/templates/style-dark.css @@ -41,6 +41,7 @@ html, body { html { position: relative; + background-color: #333336; } a { @@ -309,11 +310,11 @@ code.sourceCode span.va { color: turquoise; } .content-footer { margin-top: 2rem; padding: 0.3rem 0; - opacity: 0.8; text-align: center; } .content-footer * { + opacity: 0.9; display: inline-block; vertical-align: top; } @@ -334,6 +335,7 @@ code.sourceCode span.va { color: turquoise; } } .content-footer dl dd { + display:inline-block; } @@ -571,31 +573,39 @@ figcaption { text-align: center; } -.donation p { - color: #ccc; -} - .donation ul { list-style-type: none; - padding: 0 0 1rem 0; } .donation li { display: inline; } + .donation li a { display: inline-block; border: 1px dashed #933; - padding: 0.6rem; + padding: 0.3rem; background-color: #111; - width: 5rem; + width: 7rem; } +.donation li .method { + display: block; + font-size: 0.7rem; +} + + .donation li a:hover { border: 1px solid #933; color: #fff; } +/* +.donation li a { + display: block; +} + +*/ /* above is mobile first; this is the desktop */ @media all and (min-width: 50rem) { diff --git a/templates/symbols.svg b/templates/symbols.svg index 37ae83e..19d541f 100644 --- a/templates/symbols.svg +++ b/templates/symbols.svg @@ -1,88 +1,64 @@ - - + + + - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -