New Post + support for mastodon

This commit is contained in:
Don Harper 2022-12-20 15:56:31 -06:00
parent 71ecae9875
commit ab84019b99
11 changed files with 322 additions and 2 deletions

View file

@ -89,10 +89,11 @@ preserveTaxonomyNames = true
# this will also be in author bio if there is no writer.
[params.social]
email = "duck@duckland.org"
twitter = "https://twitter.com/duckunix"
#twitter = "https://twitter.com/duckunix"
linkedin = "https://www.linkedin.com/in/donaldharper/"
mastodon = "https://fosstodon/@duckunix"
#stackoverflow = "full profile url in stackoverflow"
instagram = "https://www.instagram.com/duckunix/"
#instagram = "https://www.instagram.com/duckunix/"
github = "https://github.com/duckunix"
rss = true
[params.writers]

View file

@ -0,0 +1,37 @@
---
date: "2022-06-18T04:00:00-07:00"
title: "Check-in 2022-Q4"
tags: ["family","sa", "photos"]
categories: ["Personal"]
image: "/photos/Christmas/2022/20221219211012886-0600.webp"
featured_image: "/photos/Christmas/2022/20221219211012886-0600.webp"
#series: [""]
summary: "Where did the year go?"
Victor_Hugo: "true"
Focus_Keyword: "close"
---
2022 is drawing to a close, and I have been bad about updating this blog. Maybe next year will be better for me. :)
# Technology
Since all the changes on [Twitter](https://twitter.com/duckunix), I am now active on [Fosstodon](https://fosstodom/@duckunix), which is a [Mastodon](https://joinmastodon.org/). I joined back in 2018, but I just started using it more. My #introduction toot:
{{<smoot "fosstodon.org" "100578860152016241">}}
On the home network front, I finally retired the big server as the drivers were failing. I decided to move the containers running there to my old desktop which was not doing anything. Some new disks, and life is better there.
One of the other things I have been looking into is [NixOS](https://nixos.org) which is a declarative Linux distribution. What does that mean? By describing the machine in a single file (or multiple for readability), you can have a easily reproducible install. After a little research and testing, I was able to install two separate machines which are identically configured expect for the host name. Pretty cool. And since installing a new program is done in this file, you always have a complete record of what is installed and you get OS versioning as an added feature. I am going to flip my main machine over during the holiday break.
# Photography
![2022 P52 Collage](/photos/Random/2022-P52.webp)
I am still doing my P52 project (posting a new photo every week) over on my [photo blog](https://www.donaldharper.com). I had gotten out of the habit of carrying my camera with me, so I am trying to get back into it. Sometimes, it is not with my main rig, but with smaller point-n-shoot cameras which I can keep in a pocket. I have also switched my phone case so taking pictures with my phone is easier.
# Job
Looking back, I realize that during this whole [plague thing](/tags/plague), I switched teams three times, finally going back to a position which I held last time I worked for my employer. I also have been working here for 6 years last month this time. Is this my final or dream job? I do not think so, but it is interesting and stable, so there is that.
# Family
Everybody is doing fine, and thankfully this year has been free of any major illness or injury, so that is a win in my book!

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View file

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>2022 - duckland.org&#39;s photo gallery</title>
<meta name="description" content="">
<meta name="author" content="Don Harper">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../../static/css/normalize.css">
<link rel="stylesheet" href="../../static/themes/classic/galleria.classic.css">
<link rel="stylesheet" href="../../static/css/style.css">
<style>
body::after{
position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
content:url(20221219211012886-0600.webp);
}</style>
</head>
<body>
<div class="container">
<header>
<h1><a href="../../">duckland.org&#39;s photo gallery</a></h1>
<nav id="menu">
<ul>
<li><a href="/photos/">Photos Home</a></li>
<li><a href="/">Home Page</a></li>
</ul>
</nav>
<div class="breadcrumb">
<h2>
<a href="../">Christmas</a> » <a href=".">2022</a></h2>
</div>
<hr>
</header>
<div id="main" role="main">
<div class="icons">
<a id="fullscreen"><img src="../../static/img/fullscreen.png"
title="Fullscreen" alt="Fullscreen (f)" /></a>
</div>
<div id="gallery"></div>
<script src="../../static/jquery-3.3.1.min.js"></script>
<script src="../../static/galleria.min.js"></script>
<script src="../../static/themes/classic/galleria.classic.min.js"></script>
<script src="../../static/plugins/history/galleria.history.min.js"></script>
<script>
var data = [
{
title: "20221219211012886-0600",
description: "",
thumb: "thumbnails/20221219211012886-0600.webp",
image: "20221219211012886-0600.webp"
},
]
Galleria.ready(function() {
/*
load thumbnails after gallery setup, and download has started
for the main images, but before the loading of map tiles starts
in the background. This ensures visible elements are prioritised
over non-visible elements
The choice to lazy load thumbnails in batches of 50 was not made
scientifically. Other numbers may yield better performance.
*/
this.lazyLoadChunks( 50 );
this.attachKeyboard({
right: this.next,
left: this.prev,
/* Toggle fullscreen display on press of 'f' key */
0x46: this.toggleFullscreen,
});
var gallery = this;
$('#fullscreen').click(function() {
gallery.toggleFullscreen();
});
$('.icons').appendTo(this.$('container'));
});
Galleria.configure({
imageCrop: false,
transition: "fade",
thumbnails: "lazy"
});
Galleria.run("#gallery", {dataSource: data});
</script>
</div>
<footer>
<p>
<span>&copy; Don Harper</span>
<span>Generated by <a href="https://github.com/saimn/sigal">sigal</a></span>
</p>
</footer> </div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -62,6 +62,10 @@
<img src="2019/thumbnails/20191214125859.webp" class="album_thumb" alt="2019" title="2019" /></a>
<span class="album_title">2019</span>
</li>
<li><a href="2022/">
<img src="2022/thumbnails/20221219211012886-0600.webp" class="album_thumb" alt="2022" title="2022" /></a>
<span class="album_title">2022</span>
</li>
</ul>
</div>
<div class="icons">

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View file

@ -166,6 +166,12 @@
thumb: "thumbnails/sunset-on-katori.webp",
image: "sunset-on-katori.webp"
},
{
title: "2022-P52",
description: "",
thumb: "thumbnails/2022-P52.webp",
image: "2022-P52.webp"
},
]
Galleria.ready(function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -22,6 +22,15 @@
<ul class="social-media-icons">
{{ with .Site.Params.social.mastodon }}
<li>
<a href="{{ . }}" data-animate-hover="pulse" class="mastodon" target="_blank">
<i class="fab fa-mastodon " title="mastodon"></i>
<span class="screen-reader-text">mastodon</span>
</a>
</li>
{{end}}
{{ with .Site.Params.social.facebook }}
<li>
<a href="{{ . }}" data-animate-hover="pulse" class="facebook" target="_blank">

View file

@ -0,0 +1,157 @@
{{ $masIns := .Get 0 }}
{{ $tootLink := "" }}
{{ $card := "" }}
{{ $handleInst := "" }}
{{ $mediaMD5 := "" }}
{{ $imageCount := 0 }}
{{ $votesCount := 0 }}
{{ $id := .Get 1 }}
{{ $urlToGet := print "https://" $masIns "/api/v1/statuses/" $id }}
{{ $json := getJSON $urlToGet }}
{{ $jsonHolder := $json }}{{/* Being safe */}}
{{ if isset $json "account" }}
{{ $tootLink = print "https://" $masIns "@" $json.account.acct "/status/" $id }}
{{ $handleInst = print "@" $json.account.acct "@" $masIns }}
{{ end }}
{{ if isset $json "content" }}
<blockquote class="tweet-card" cite="{{ $tootLink }}">
<div class="tweet-header">
<a class="tweet-profile twitterExt" href="https://{{ $masIns }}/@{{ $json.account.acct }}" rel="noopener">
<img
src="{{ $json.account.avatar }}"
alt="Mastodon avatar for {{ $handleInst }}"
loading="lazy"
/>
</a>
<div class="tweet-author">
<a class="tweet-author-name twitterExt" href="https://{{ $masIns }}/@{{ $json.account.acct }}" rel="noopener">{{ $json.account.display_name }}</a>
<a class="tweet-author-handle twitterExt" href="https://{{ $masIns }}/@{{ $json.account.acct }}" rel="noopener">{{ $handleInst }}</a>
</div>
</div>
<p class="tweet-body">
{{ $json.content | safeHTML }}
</p>
{{ with $json.media_attachments }}
{{ range $media_attachments := . }}
{{ if eq $media_attachments.type "image" }}
{{ $imageCount = (add ($imageCount) 1) }}
{{ end }}
{{ end }}
<div class="tweet-img-grid-{{ $imageCount }}">
{{ range $media_attachments := . }}
{{ if eq $media_attachments.type "image" }}
{{ $mediaMD5 = md5 $media_attachments.url }}
<style>
.img-{{ $mediaMD5 }} {
aspect-ratio: {{ $media_attachments.meta.original.width }} / {{ $media_attachments.meta.original.height }};
}
</style>
<img
src="{{ $media_attachments.url }}"
alt="Image {{ $media_attachments.id }} from toot {{ $id }} on {{ $masIns }}"
class="tweet-media-img img-{{ $mediaMD5 }}{{ if $json.sensitive }} tweet-sens-blur{{ end }}"
loading="lazy"
{{- if $json.sensitive }}onclick="this.classList.toggle('tweet-sens-blur-no')"{{- end }}
/>
{{- if $json.sensitive -}}
<div class="blur-text">
Sensitive content<br />
(flagged&nbsp;at&nbsp;origin)
</div>
{{- end -}}
{{ end }}
{{ end }}
</div>
{{/*
N.B.:
The above results in an empty, no-height div
when there's no image but there **is**
at least one item in `$media_attachments`.
Unfortunately, it seems to be the only way
to accomplish this. Not a good HTML practice,
but gets the job done.
*/}}
{{ range $media_attachments := . }}
{{ if eq $media_attachments.type "video" }}
{{ $mediaMD5 = md5 $media_attachments.url }}
<style>
.img-{{ $mediaMD5 }} {
aspect-ratio: {{ $media_attachments.meta.original.width }} / {{ $media_attachments.meta.original.height }};
}
</style>
<div class="ctr tweet-video-wrapper">
<video muted playsinline controls class="ctr tweet-media-img img-{{ $mediaMD5 }}{{ if $json.sensitive }} tweet-sens-blur{{ end }}"{{- if $json.sensitive }}onclick="this.classList.toggle('tweet-sens-blur-no')"{{- end }}>
<source src="{{ $media_attachments.url }}">
<p class="legal ctr">(Your browser doesn&rsquo;t support the <code>video</code> tag.)</p>
</video>
{{- if $json.sensitive -}}
<div class="blur-text">
Sensitive content<br />
(flagged&nbsp;at&nbsp;origin)
</div>
{{- end -}}
</div>
{{ end }}
{{ if eq $media_attachments.type "gifv" }}
{{ $mediaMD5 = md5 $media_attachments.url }}
<style>
.img-{{ $mediaMD5 }} {
aspect-ratio: {{ $media_attachments.meta.original.width }} / {{ $media_attachments.meta.original.height }};
}
</style>
<div class="ctr tweet-video-wrapper">
<video loop autoplay muted playsinline controls controlslist="nofullscreen" class="ctr tweet-media-img img-{{ $mediaMD5 }}{{ if $json.sensitive }} tweet-sens-blur{{ end }}" {{- if $json.sensitive }}onclick="this.classList.toggle('tweet-sens-blur-no')"{{- end }}>
<source src="{{ $media_attachments.url }}">
<p class="legal ctr">(Your browser doesn&rsquo;t support the <code>video</code> tag.)</p>
</video>
{{- if $json.sensitive -}}
<div class="blur-text">
Sensitive content<br />
(flagged&nbsp;at&nbsp;origin)
</div>
{{- end -}}
</div>
{{ end }}
{{ end }}
{{ end }}
{{ with $json.card }}
{{- $cardData := . -}}
{{- with $cardData.image -}}
<a href="{{ $cardData.url }}" rel="'noopener">
<div class="card">
<img src="{{ $cardData.image }}" alt="Card image from {{ $masIns }} toot {{ $id }}" loading="lazy" class="tweet-card-img" />
<p>
<span class="card-title">{{ $cardData.title }}</span><br />
{{ $cardData.description }}
</p>
</div>
</a>
{{- end -}}
{{ end }}
{{ with $json.poll }}
{{ $poll := . }}
{{ with $poll.options }}
{{ range $pollOptions := . }}
{{ $votesCount = add $votesCount $pollOptions.votes_count }}
{{ end }}
<div class="tweet-poll-wrapper">
{{ range $pollOptions := . }}
<div class="tweet-poll-count">
<strong>{{ (mul 100 (div $pollOptions.votes_count $votesCount)) | lang.FormatPercent 1 }}</strong>
</div>
<div class="tweet-poll-meter">
<meter id="vote-count" max="{{ $votesCount }}" value="{{ $pollOptions.votes_count }}"></meter>
</div>
<div class="tweet-poll-title">{{ $pollOptions.title }}</div>
{{ end }}
</div>
<p class="legal">{{ $votesCount }} votes</p>
{{ end }}
{{ end }}
<div class="tweet-footer">
<a href="https://{{ $masIns }}/@{{ $json.account.acct }}/{{ $json.id }}" class="tweet-date twitterExt" rel="noopener">{{ dateFormat "3:04 PM • January 2, 2006" $json.created_at }}</a>&nbsp;<span class="legal">(UTC)</span>
</div>
</blockquote>
{{ end }}