pub / newsplanet

Planet-Style Newsfeed generated with perlanet
git clone https://https://src.jayvii.de/pub/newsplanet.git
Home | Log | Files | Exports | Refs | README | RSS

commit 42dc8109b57fb9a62b0bc4db74bcedfc61e2a17b
parent 984b2ec0aad892b85fac82601d99411aa29b023e
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun,  2 Jun 2024 17:42:41 +0200

List feeds that are being polled

Diffstat:
Mrun.sh | 13+++++++++++--
Mtemplate.html | 20+++++++++++++-------
2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/run.sh b/run.sh @@ -1,10 +1,19 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # Generate site perlanet config.yaml # Insert Update time -sed -e "s/<!--UPDATED-->/$(date +%c)/" -i index.html +DATE=`date +%c` +sed -E -e "s/<!--UPDATED-->/$DATE/" -i index.html + +# Insert feeds list +FEEDS=` + grep -E '^\s*web:' config.yaml | \ + awk '{ print "<a href=\""$NF"\">"$NF"</a><br>" }' | \ + sed -e 's/\//\\\\\//g' -ze's/\n//g' +` +sed -E -e "s/<!--FEEDS-->/$FEEDS/" -i index.html # remove images and iframes from article previews sed -E -e 's/<img[^>]*>//g' -e 's/<iframe[^>]*>//g' -i index.html diff --git a/template.html b/template.html @@ -31,10 +31,6 @@ <script> // Toggle Theme function function toggleTheme(set_mode = null) { - // Get current dark-mode status if not given explicitely - if (set_mode === null) { - set_mode = 1 - sessionStorage.getItem("dark-mode"); - } // Set Mode and mark in session storage if (set_mode === 0) { document.querySelector("body").classList = ["list"]; @@ -42,15 +38,16 @@ document.querySelector("body").classList = ["list dark"]; } sessionStorage.setItem("dark-mode", set_mode); + document.cookie="dark-mode=" + set_mode + ";SameSite=Strict"; } // On Load: set dark mode if necessary function initialTheme() { if ( // Case 1: Dark Mode is preferred and has not been toggled before (window.matchMedia('(prefers-color-scheme: dark)').matches && - sessionStorage.getItem("dark-mode") === null) || + document.cookie == "") || // Case 2: Dark Mode has been choosen before - sessionStorage.getItem("dark-mode") == 1 + document.cookie == "dark-mode=1" ) { toggleTheme(set_mode = 1); } else { @@ -87,8 +84,17 @@ </h1> <!-- This is updated by find-and-replace --> - <p style="margin-bottom:2em;"><!--UPDATED--></p> + <p><!--UPDATED--></p> + + <!-- This is updated by find-and-replace--> + <hr> + <details> + <summary class="button">Feeds</summary> + <!--FEEDS--> + </details> + <hr style="marhin-bottom:2em;"> + <!-- Content Entries --> [% FOREACH entry IN feed.entries %] <article class='post-entry'> <h2><a href="[% entry.link | url | html %]" class="hyperlink">[% entry.title | html %]</a></h2>