From 08bf2c08a0ee2ea13c3843d367f9805004c722bc Mon Sep 17 00:00:00 2001
From: octospacc
Date: Wed, 15 Feb 2023 17:54:25 +0100
Subject: [PATCH] Upd. ShioriFeed
---
ShioriFeed.py | 316 +++++++++++++++++++++++++++-----------------------
1 file changed, 173 insertions(+), 143 deletions(-)
diff --git a/ShioriFeed.py b/ShioriFeed.py
index 75a6c08..6049b65 100755
--- a/ShioriFeed.py
+++ b/ShioriFeed.py
@@ -1,38 +1,41 @@
#!/usr/bin/env python3
# *----------------------------------------------------------------------* #
-# | [ ShioriFeed 🔖 ] | #
+# | [ ShioriFeed 🔖 (OctoSpacc) ] | #
# | Simple service for getting an Atom/RSS feed from your Shiori profile | #
-# | v. 2023-02-13-r3, OctoSpacc | #
+# *----------------------------------------------------------------------* #
+Version = '2023-02-15'
# *----------------------------------------------------------------------* #
-# *---------------------------------* #
-# | Configuration | #
-# *---------------------------------* #
+# *-------------------------------------------* #
+# | Configuration | #
+# *-------------------------------------------* #
Host = ('localhost', 8176)
Debug = False
-# *---------------------------------* #
+UserAgent = f'ShioriFeed v{Version} at {Host[0]}'
+# *-------------------------------------------* #
# External Requirements: urllib3
# TODO:
+# - Cheking if Content mode content is actually present, otherwise fall back to Archive mode or original link (using API data is unreliable it seems)
# - Atom feed
# - Actually valid RSS
-# - Include content of links into XML
-# - Include other XML metadata (author)
+# - XML stylesheet
+# - Filtering (tags, etc.)
# - Write privacy policy
# - Fix the URL copy thing
+# - Minification
# *-------------------------------------------------------------------------* #
import traceback
import json
-from base64 import urlsafe_b64decode as b64decode, urlsafe_b64encode as b64encode
+from base64 import urlsafe_b64decode as b64UrlDecode, urlsafe_b64encode as b64UrlEncode, standard_b64encode as b64Encode
from html import escape as HtmlEscape
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
from urllib.request import urlopen, Request
-from urllib.error import HTTPError, URLError
import threading
HomeTemplate = '''\
@@ -52,17 +55,26 @@ HomeTemplate = '''\
- ShioriFeed 🔖
-
- Enter the details of your account on a
- Shiori
- server to get an Atom/RSS feed link.
-
-
- Note: still a work-in-progress!
-
-
-
-
-
-
-
+
+
ShioriFeed 🔖
+
+ Enter the details of your account on a
+ Shiori
+ server to get an Atom/RSS feed link.
+
+
+ Note: still a work-in-progress!
+
+
+
+
+
+
+
+
- v. 2023-02-13-r3
+
+
+
+ Privacy Policy
+ (applies to ShioriFeed.Octt.eu.org)
+
+
+ I still have to write this... tough luck.
+ I'm not yet actively inviting anyone to use this instance right now,
+ if you're worried about your security then just host the software yourself.
+
+
+
+
+ v. {{Version}}
Source Code
@@ -186,42 +214,50 @@ HomeTemplate = '''\