commit 1c72453c0e5094f70f0452d9c78604e88cb6b08f
parent d5cdd0cf135dc45af6afb1c9e056f9cdd30e77c3
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Mon, 20 Oct 2025 14:51:18 +0200
feat: add some descriptions for the preview
Diffstat:
4 files changed, 97 insertions(+), 33 deletions(-)
diff --git a/lib/gen_html_feeds.php b/lib/gen_html_feeds.php
@@ -2,7 +2,7 @@
function gen_html_feeds($config) {
?>
-<form id="sources-selection" method="post" target="_blank">
+<form id="sources-selection" method="post">
<!-- Submit button -->
<div class="submit-container">
diff --git a/lib/gen_html_preview.php b/lib/gen_html_preview.php
@@ -8,10 +8,7 @@ function gen_preview($config) {
);
$sources = array();
foreach ($input_keys as $key) {
- array_push(
- $sources,
- $config["sources"][$_POST[$key]]
- );
+ $sources[$_POST[$key]] = $config["sources"][$_POST[$key]];
}
@@ -45,40 +42,110 @@ function gen_preview($config) {
<!-- Header / Navigation -->
<?php gen_html_navigation(); ?>
- <!-- Feed Preview -->
+ <!-- Explaination -->
+ <h3>Feed Vorabansicht</h3>
+ <p>Folgende Nachrichtenquellen wurden ausgewählt:</p>
+ <ul>
<?php
- foreach ($feed as $item) {
+ foreach ($sources as $source) {
+ $title = $config["publisher"][$source["publisher"][0]]["name"] . ": " .
+ $source["title"];
?>
- <section>
- <!-- Headline -->
- <h3>
+ <li>
<a
- href="<?php echo $item["link"]; ?>"
+ href="<?php echo $source["web"]; ?>"
target="_blank"
rel="nofollow noindex ugc"
>
- <?php echo $item["title"]; ?>
+ <?php echo $title; ?>
</a>
- </h3>
- <!-- Information -->
- <em><?php echo $item["publ"]; ?></em>
- <br>
- <em><?php echo $item["date"]; ?></em>
- <!-- Content -->
- <p><?php echo $item["desc"]; ?></p>
- <!-- Categories -->
- <?php
- foreach ($item["cats"] as $cat) {
- ?>
- <mark><?php echo $config["topics"][$cat]["name"]; ?></mark>
- <?php
- }
- ?>
- </section>
+ </li>
+<?php
+ }
+?>
+ </ul>
+ <p>
+ Die neusten verfügbaren Nachrichten dieser Quellen werden unten
+ angezeigt. Die Nachrichtenquellen können hier direkt als OPML-Datei
+ exportiert und in einen RSS-Reader importiert werden.
+ </p>
+ <form id="sources-selection" method="post" target="_blank">
+ <button
+ type="submit"
+ name="action"
+ value="gen_opml"
+ title="Erzeugt die OPML-Datei, die in den RSS-Reader importiert werden kann"
+ >
+ Feed erzeugen
+ </button>
+ <button onlick="history.back();">
+ Zurück zur Übersicht
+ </button>
+
+<?php
+ $cnt = 0;
+ foreach ($sources as $id => $source) {
+?>
+
+ <input
+ type="hidden"
+ name="<?php echo "source-" . $cnt; ?>"
+ value="<?php echo $id; ?>"
+ >
+
+<?php
+ }
+?>
+
+ </form>
+
+
+ <!-- Feed Preview -->
+ <div id="sources">
+ <h3>Nachrichten</h3>
+ <p>
+ Das ist die Vorabansicht der ausgewählten Nachrichtenquellen. So
+ oder so ähnlich würde der Feed aussehen, wenn er in einen RSS-Reader
+ importiert wird.
+ </p>
+
+<?php
+ foreach ($feed as $item) {
+?>
+ <section>
+ <!-- Headline -->
+ <h3>
+ <a
+ href="<?php echo $item["link"]; ?>"
+ target="_blank"
+ rel="nofollow noindex ugc"
+ >
+ <?php echo $item["title"]; ?>
+ </a>
+ </h3>
+ <!-- Information -->
+ <em><?php echo $item["publ"]; ?></em>
+ <br>
+ <em><?php echo $item["date"]; ?></em>
+ <!-- Content -->
+ <p><?php echo $item["desc"]; ?></p>
+ <!-- Categories -->
+ <?php
+ foreach ($item["cats"] as $cat) {
+ ?>
+ <mark><?php echo $config["topics"][$cat]["name"]; ?></mark>
+ <?php
+ }
+ ?>
+ </section>
<?php
}
?>
+ </div><!-- sources -->
+
+ <!-- FAQs / About-Section -->
+ <?php gen_html_faqs($config); ?>
<!-- Footer -->
<?php gen_html_footer(); ?>
diff --git a/lib/gen_opml.php b/lib/gen_opml.php
@@ -9,10 +9,7 @@ function gen_opml($config) {
);
$sources = array();
foreach ($input_keys as $key) {
- array_push(
- $sources,
- $config["sources"][$_POST[$key]]
- );
+ $sources[$_POST[$key]] = $config["sources"][$_POST[$key]];
}
$exp_hash = md5(serialize($sources));
diff --git a/news-sources.json b/news-sources.json
@@ -1,5 +1,5 @@
{
- "version": "1.3.0",
+ "version": "1.3.1",
"sources": {
"drr": {
"title": "Alle Artikel",