cleanup commit before trying something radically oldschool
This commit is contained in:
parent
f07e5bf522
commit
0b1d7cef68
6 changed files with 40 additions and 64 deletions
|
@ -7,4 +7,3 @@ webmentionio = {
|
|||
telegraph = {
|
||||
'token': 'https://telegraph.p3k.io/ -> select site under avatar -> settings gear icon -> API key'
|
||||
}
|
||||
|
||||
|
|
47
nasg.py
47
nasg.py
|
@ -931,30 +931,22 @@ class Singular(MarkdownDoc):
|
|||
def oembed_json(self):
|
||||
r = {
|
||||
"version": "1.0",
|
||||
"url": self.url,
|
||||
"provider_name": settings.site.name,
|
||||
"provider_url": settings.site.url,
|
||||
"author_name": settings.author.name,
|
||||
"author_url": settings.author.url,
|
||||
"title": self.title,
|
||||
"type": "link",
|
||||
"html": self.html_content,
|
||||
"type": "link"
|
||||
}
|
||||
img = None
|
||||
if self.is_photo:
|
||||
img = self.photo
|
||||
elif not self.is_photo and len(self.images):
|
||||
img = list(self.images.values())[0]
|
||||
if img:
|
||||
r.update({
|
||||
"type": "rich",
|
||||
"thumbnail_url": img.jsonld.thumbnail.url,
|
||||
"thumbnail_width": img.jsonld.thumbnail.width,
|
||||
"thumbnail_height": img.jsonld.thumbnail.height
|
||||
"type": "photo",
|
||||
"url": self.photo.jsonld.thumbnail.url,
|
||||
"width": self.photo.jsonld.thumbnail.width,
|
||||
"height": self.photo.jsonld.thumbnail.height
|
||||
})
|
||||
return r
|
||||
|
||||
|
||||
async def copyfiles(self):
|
||||
exclude = [
|
||||
'.md',
|
||||
|
@ -1027,14 +1019,14 @@ class Singular(MarkdownDoc):
|
|||
)
|
||||
del(j)
|
||||
# oembed
|
||||
writepath(
|
||||
os.path.join(self.renderdir, settings.filenames.oembed_json),
|
||||
json.dumps(self.oembed_json, indent=4, ensure_ascii=False)
|
||||
)
|
||||
writepath(
|
||||
os.path.join(self.renderdir, settings.filenames.oembed_xml),
|
||||
self.oembed_xml
|
||||
)
|
||||
# writepath(
|
||||
# os.path.join(self.renderdir, settings.filenames.oembed_json),
|
||||
# json.dumps(self.oembed_json, indent=4, ensure_ascii=False)
|
||||
# )
|
||||
# writepath(
|
||||
# os.path.join(self.renderdir, settings.filenames.oembed_xml),
|
||||
# self.oembed_xml
|
||||
# )
|
||||
|
||||
class Home(Singular):
|
||||
def __init__(self, fpath):
|
||||
|
@ -1682,8 +1674,7 @@ class WebhookPHP(PHPFile):
|
|||
async def _render(self):
|
||||
r = J2.get_template(self.templatefile).render({
|
||||
'author': settings.author,
|
||||
'webmentionio': keys.webmentionio,
|
||||
'zapier': keys.zapier,
|
||||
'webmentionio': keys.webmentionio
|
||||
})
|
||||
writepath(self.renderfile, r)
|
||||
|
||||
|
@ -2264,7 +2255,7 @@ def dat():
|
|||
if not os.path.isdir(p):
|
||||
os.makedirs(p)
|
||||
p = os.path.join(settings.paths.build, '.well-known', 'dat')
|
||||
if not os.path.exists(p):
|
||||
if not os.path.exists(p) or settings.args.get('force'):
|
||||
writepath(p, "%s\nTTL=3600" % (url))
|
||||
|
||||
|
||||
|
@ -2273,7 +2264,7 @@ def make():
|
|||
last = 0
|
||||
|
||||
# this needs to be before collecting the 'content' itself
|
||||
if not settings.args.get('nosync'):
|
||||
if not settings.args.get('offline') and not settings.args.get('noservices'):
|
||||
incoming = WebmentionIO()
|
||||
incoming.run()
|
||||
|
||||
|
@ -2373,12 +2364,12 @@ def make():
|
|||
cp(e, t)
|
||||
|
||||
# dat data
|
||||
dat()
|
||||
#dat()
|
||||
|
||||
end = int(round(time.time() * 1000))
|
||||
logger.info('process took %d ms' % (end - start))
|
||||
|
||||
if not settings.args.get('nosync'):
|
||||
if not settings.args.get('offline'):
|
||||
# upload site
|
||||
try:
|
||||
logger.info('starting syncing')
|
||||
|
@ -2393,7 +2384,7 @@ def make():
|
|||
except Exception as e:
|
||||
logger.error('syncing failed: %s', e)
|
||||
|
||||
if not settings.args.get('nosync'):
|
||||
if not settings.args.get('offline') and not settings.args.get('noservices'):
|
||||
logger.info('sending webmentions')
|
||||
for wm in send:
|
||||
queue.put(wm.send())
|
||||
|
|
24
settings.py
24
settings.py
|
@ -49,7 +49,6 @@ site = struct({
|
|||
"image": "https://petermolnar.net/favicon.ico",
|
||||
"license": "https://spdx.org/licenses/%s.html" % (licence['_default']),
|
||||
"sameAs": [
|
||||
"dat://7efecc3c33baf69d6fecf801e15ede92b369f4944f766489b156263119220939"
|
||||
],
|
||||
"author": {
|
||||
"@context": "http://schema.org",
|
||||
|
@ -109,14 +108,6 @@ site = struct({
|
|||
"name": "paypal",
|
||||
"url": "https://paypal.me/petermolnar/",
|
||||
"recipient": author
|
||||
},
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "DonateAction",
|
||||
"description": "Cash App",
|
||||
"name": "cash",
|
||||
"url": "https://cash.app/%C2%A3pmlnr",
|
||||
"recipient": author
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@ -181,6 +172,12 @@ filenames = struct({
|
|||
'oembed_json': 'oembed.json'
|
||||
})
|
||||
|
||||
datignore = [
|
||||
'.git',
|
||||
'.dat',
|
||||
'**.php'
|
||||
]
|
||||
|
||||
photo = struct({
|
||||
're_author': re.compile(r'(?:P[eé]ter Moln[aá]r)|(?:Moln[aá]r P[eé]ter)|(?:petermolnar\.(?:eu|net))'),
|
||||
'default': 720,
|
||||
|
@ -209,12 +206,13 @@ if not os.path.isdir(tmpdir):
|
|||
|
||||
_parser = argparse.ArgumentParser(description='Parameters for NASG')
|
||||
_booleanparams = {
|
||||
'regenerate': 'force downsizing images',
|
||||
'force': 'force rendering HTML',
|
||||
'nosync': 'skip sync to live server',
|
||||
'regenerate': 'force (re)downsizing images',
|
||||
'force': 'force (re)rendering HTML',
|
||||
'debug': 'set logging to debug level',
|
||||
'quiet': 'show only errors',
|
||||
'noping': 'don\'t send webmentions but save a dummy that it was done'
|
||||
'offline': 'offline mode - no syncing, no querying services, etc.',
|
||||
'noping': 'make dummy webmention entries and don\'t really send them',
|
||||
'noservices': 'skip querying any service but do sync the website'
|
||||
}
|
||||
|
||||
for k, v in _booleanparams.items():
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<link rel="canonical" href="{{ post.url }}" />
|
||||
<link rel="alternate" type="application/ld+json" href="{{ post.url }}{{ fnames.json }}" />
|
||||
<link rel="alternate" type="text/plain" href="{{ post.url }}{{ fnames.txt }}" />
|
||||
<link rel="alternate" type="application/oembed+json" href="{{ post.url }}{{ fnames.oembed_json }}">
|
||||
<link rel="alternate" type="text/oembed+xml" href="{{ post.url }}{{ fnames.oembed_xml }}">
|
||||
<meta property="og:title" content="{{ post.headline }}" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="{{ post.url }}" />
|
||||
|
@ -18,13 +16,6 @@
|
|||
<meta property="article:published_time" content="{{ post.datePublished }}" />
|
||||
<meta property="article:modified_time" content="{{ post.dateModified }}" />
|
||||
<meta property="article:author" content="{{ post.author.name }} ({{ post.author.email}})" />
|
||||
<!--
|
||||
<meta name="DC.Format" content="text/html" />
|
||||
<meta name="DC.Language" content="{{ post.inLanguage }}" />
|
||||
<meta name="DC.Publisher" content="{{ post.Publisher.name }}" />
|
||||
<meta name="DC.Title" content="{{ post.headline }}" />
|
||||
<meta name="DC.Rights" content="{{ post.headline }}" />
|
||||
-->
|
||||
{% if post.image is iterable %}
|
||||
<meta property="og:image" content="{{ post.image[0].url }}" />
|
||||
<meta property="og:image:type" content="{{ post.image[0].encodingFormat }}" />
|
||||
|
@ -33,6 +24,15 @@
|
|||
{% else %}
|
||||
<meta property="og:image" content="{{ post.image }}" />
|
||||
{% endif %}
|
||||
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
|
||||
<meta name="DC.Format" content="text/html" />
|
||||
<meta name="DC.Language" content="{{ post.inLanguage }}" />
|
||||
<meta name="DC.Publisher" content="{{ post.Publisher.name }}" />
|
||||
<meta name="DC.Title" content="{{ post.headline }}" />
|
||||
<meta name="DC.Rights" content="{{ post.licence }}" />
|
||||
<meta NAME="DC.Creator" content="{{ post.author.name }}" />
|
||||
<meta NAME="DC.Date" content="{{ post.datePublished }}" />
|
||||
<meta NAME="DC.Description" content="{{ post.description|striptags|e }}" />
|
||||
|
||||
{% if post['@type'] == 'TechArticle' %}
|
||||
<style media="all">
|
||||
|
|
|
@ -41,15 +41,6 @@ From: %s
|
|||
header('HTTP/1.1 202 Accepted');
|
||||
exit(0);
|
||||
}
|
||||
elseif(isset($payload['secret']) && $payload['secret'] == '{{ zapier.secret }}' ) {
|
||||
$logfile = sprintf('%s/zapier.log', $_SERVER['HOME']);
|
||||
$msg = sprintf("%s %s %s\n", $payload['source'], $payload['network'], $payload['url']);
|
||||
file_put_contents($logfile, $msg, FILE_APPEND | LOCK_EX);
|
||||
_syslog('[webhook] accepted from zapier');
|
||||
header('HTTP/1.1 202 Accepted');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
_syslog('[webhook] bad request:' . $raw);
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<symbol id="icon-github" viewBox="0 0 16 16">
|
||||
<path d="M8 0.198c-4.42 0-8 3.582-8 8 0 3.535 2.292 6.533 5.47 7.59 0.4 0.075 0.547-0.172 0.547-0.385 0-0.19-0.007-0.693-0.010-1.36-2.225 0.483-2.695-1.073-2.695-1.073-0.364-0.923-0.89-1.17-0.89-1.17-0.725-0.496 0.056-0.486 0.056-0.486 0.803 0.056 1.225 0.824 1.225 0.824 0.713 1.223 1.873 0.87 2.33 0.665 0.072-0.517 0.278-0.87 0.507-1.070-1.777-0.2-3.644-0.888-3.644-3.953 0-0.873 0.31-1.587 0.823-2.147-0.090-0.202-0.36-1.015 0.070-2.117 0 0 0.67-0.215 2.2 0.82 0.64-0.178 1.32-0.266 2-0.27 0.68 0.004 1.36 0.092 2 0.27 1.52-1.035 2.19-0.82 2.19-0.82 0.43 1.102 0.16 1.915 0.080 2.117 0.51 0.56 0.82 1.273 0.82 2.147 0 3.073-1.87 3.75-3.65 3.947 0.28 0.24 0.54 0.731 0.54 1.48 0 1.071-0.010 1.931-0.010 2.191 0 0.21 0.14 0.46 0.55 0.38 3.201-1.049 5.491-4.049 5.491-7.579 0-4.418-3.582-8-8-8z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-cash" viewBox="0 0 16 16">
|
||||
<path d="M15.727 2.313c-0.351-0.948-1.086-1.682-2.010-2.026l-0.024-0.008c-0.873-0.28-1.667-0.28-3.28-0.28h-4.84c-1.6 0-2.407 0-3.267 0.267-0.949 0.353-1.683 1.090-2.026 2.016l-0.008 0.024c-0.273 0.867-0.273 1.667-0.273 3.267v4.847c0 1.607 0 2.4 0.267 3.267 0.351 0.948 1.086 1.682 2.010 2.026l0.023 0.008c0.867 0.273 1.667 0.273 3.267 0.273h4.853c1.607 0 2.407 0 3.267-0.267 0.952-0.351 1.689-1.088 2.032-2.016l0.008-0.024c0.273-0.867 0.273-1.667 0.273-3.267v-4.833c0-1.607 0-2.407-0.273-3.273zM11.613 5.4l-0.62 0.62c-0.059 0.055-0.139 0.089-0.227 0.089-0.084 0-0.161-0.031-0.22-0.083l0 0c-0.575-0.488-1.326-0.786-2.146-0.787h-0c-0.647 0-1.293 0.213-1.293 0.807 0 0.6 0.693 0.8 1.493 1.1 1.4 0.467 2.56 1.053 2.56 2.427 0 1.493-1.16 2.52-3.053 2.633l-0.173 0.8c-0.032 0.15-0.163 0.26-0.32 0.26-0 0-0 0-0 0h-1.193l-0.060-0.007c-0.15-0.035-0.26-0.167-0.26-0.325 0-0.024 0.003-0.048 0.007-0.070l-0 0.002 0.187-0.847c-0.75-0.192-1.397-0.556-1.922-1.049l0.002 0.002v-0.007c-0.058-0.058-0.094-0.138-0.094-0.227s0.036-0.169 0.094-0.227l0-0 0.667-0.647c0.058-0.055 0.137-0.088 0.223-0.088s0.165 0.034 0.224 0.088l-0-0c0.607 0.573 1.42 0.893 2.26 0.88 0.867 0 1.447-0.367 1.447-0.947s-0.587-0.733-1.693-1.147c-1.173-0.42-2.287-1.013-2.287-2.4 0-1.613 1.34-2.4 2.927-2.473l0.167-0.82c0.032-0.146 0.16-0.253 0.313-0.253 0.002 0 0.005 0 0.007 0h1.186l0.067 0.007c0.173 0.040 0.287 0.207 0.247 0.38l-0.18 0.913c0.6 0.2 1.167 0.513 1.653 0.927l0.013 0.013c0.127 0.133 0.127 0.333 0 0.453z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-paypal" viewBox="0 0 16 16">
|
||||
<path d="M4.605 16h-2.069c-0.443 0-0.724-0.353-0.624-0.787l0.099-0.449h1.381c0.444 0 0.891-0.355 0.988-0.788l0.709-3.061c0.1-0.432 0.544-0.787 0.987-0.787h0.589c2.526 0 4.489-0.519 5.893-1.56s2.107-2.4 2.107-4.090c0-0.75-0.13-1.37-0.392-1.859 0-0.011-0.011-0.021-0.011-0.031l0.090 0.050c0.5 0.31 0.88 0.709 1.141 1.209 0.269 0.5 0.399 1.12 0.399 1.861 0 1.69-0.699 3.049-2.109 4.090-1.4 1.030-3.37 1.549-5.889 1.549h-0.6c-0.44 0-0.889 0.35-0.989 0.791l-0.71 3.070c-0.099 0.43-0.54 0.78-0.98 0.78l-0.008 0.012zM2.821 14.203h-2.070c-0.442 0-0.723-0.353-0.624-0.787l2.915-12.629c0.101-0.435 0.543-0.788 0.987-0.788h4.31c0.93 0 1.739 0.065 2.432 0.193 0.69 0.126 1.28 0.346 1.789 0.66 0.491 0.31 0.881 0.715 1.131 1.212 0.259 0.499 0.389 1.12 0.389 1.865 0 1.69-0.701 3.049-2.109 4.079-1.4 1.041-3.371 1.551-5.891 1.551h-0.589c-0.44 0-0.885 0.349-0.985 0.779l-0.707 3.059c-0.099 0.431-0.545 0.781-0.99 0.781l0.011 0.024zM7.785 2.624h-0.676c-0.444 0-0.888 0.353-0.987 0.785l-0.62 2.68c-0.1 0.432 0.18 0.786 0.62 0.786h0.511c1.109 0 1.98-0.229 2.6-0.681 0.619-0.457 0.93-1.103 0.93-1.941 0-0.553-0.201-0.963-0.6-1.227-0.4-0.269-1-0.403-1.791-0.403l0.013 0.001z"></path>
|
||||
</symbol>
|
||||
|
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 22 KiB |
Loading…
Reference in a new issue