diff --git a/README.md b/README.md index 253d5b1..c92d584 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@ types adc, dweb, ed2k, feed, ftp, gemini, geo, gopher, http, ipfs, irc, magnet, mailto, monero, mms, news, sip, udp, xmpp and any scheme and type that you desire. +## Screenshots + +[browse view](screenshot/browse.png) +[tags view](screenshot/tag.png) + ## Technicalities Blasta is a federated bookmarking system which is based on XMPP and stores @@ -45,7 +50,6 @@ The connection to the Blasta system is made with XMPP accounts. ## Future features - ActivityPub; -- Atom Syndication Format; - Federation; - Filters; - Pin; diff --git a/blasta.py b/blasta.py index 012f700..710c9d0 100644 --- a/blasta.py +++ b/blasta.py @@ -261,15 +261,12 @@ class HttpInstance: def __init__(self, accounts, sessions): self.app = FastAPI() - #templates = Jinja2Templates(directory='xhtml/template') - templates = Jinja2Templates(directory='xhtml') + templates = Jinja2Templates(directory='template') self.app.mount('/data', StaticFiles(directory='data'), name='data') self.app.mount('/export', StaticFiles(directory='export'), name='export') self.app.mount('/graphic', StaticFiles(directory='graphic'), name='graphic') self.app.mount('/stylesheet', StaticFiles(directory='stylesheet'), name='stylesheet') - #self.app.mount('/policy', StaticFiles(directory='xhtml/policy'), name='policy') - #self.app.mount('/xhtml', StaticFiles(directory='xhtml'), name='xhtml') filename_configuration = 'configuration.toml' data = Data.open_file_toml(filename_configuration) @@ -721,13 +718,14 @@ class HttpInstance: related_tags = None tags_dict = None param_filetype = request.query_params.get('filetype', '') or None + param_mode = request.query_params.get('mode', '') or None param_page = request.query_params.get('page', '') or None param_protocol = request.query_params.get('protocol', '') or None param_query = request.query_params.get('q', '') or None if param_query: param_query = param_query.strip() param_tags = request.query_params.get('tags', '') or None param_tld = request.query_params.get('tld', '') or None - if param_page: + if param_page and param_mode != 'feed': try: page = int(param_page) page_next = page + 1 @@ -979,7 +977,6 @@ class HttpInstance: message = 'Blasta system message ยป Please connect with your XMPP account to view this directory.' path = 'error' return result_post(request, jabber_id, description, message, path) - template_file = 'browse.xhtml' template_dict = { 'request': request, 'description': description, @@ -999,8 +996,14 @@ class HttpInstance: 'start': start, 'syndicate': jid, 'tags' : tags_dict or related_tags or ''} - response = templates.TemplateResponse(template_file, template_dict) - response.headers["Content-Type"] = "application/xhtml+xml" + if param_mode == 'feed': + template_file = 'browse.atom' + response = templates.TemplateResponse(template_file, template_dict) + response.headers["Content-Type"] = "application/xml" + else: + template_file = 'browse.xhtml' + response = templates.TemplateResponse(template_file, template_dict) + response.headers["Content-Type"] = "application/xhtml+xml" return response @self.app.get('/blasta.svg') @@ -1031,14 +1034,15 @@ class HttpInstance: async def root_main_get(request: Request, response : Response, page_type=None): jabber_id = Utilities.is_jid_matches_to_session(accounts, sessions, request) node_id = path = syndicate = page_type + param_filetype = request.query_params.get('filetype', '') or None + param_mode = request.query_params.get('mode', '') or None + param_page = request.query_params.get('page', '') or None + param_protocol = request.query_params.get('protocol', '') or None param_query = request.query_params.get('q', '') or None if param_query: param_query = param_query.strip() - param_page = request.query_params.get('page', '') or None param_tags = request.query_params.get('tags', '') or None param_tld = request.query_params.get('tld', '') or None - param_filetype = request.query_params.get('filetype', '') or None - param_protocol = request.query_params.get('protocol', '') or None - if param_page: + if param_page and param_mode != 'feed': try: page = int(param_page) page_next = page + 1 @@ -1154,8 +1158,14 @@ class HttpInstance: 'pubsub_jid' : jabber_id_pubsub, 'syndicate' : syndicate, 'tags' : tags_dict} - response = templates.TemplateResponse(template_file, template_dict) - response.headers["Content-Type"] = "application/xhtml+xml" + if param_mode == 'feed': + template_file = 'browse.atom' + response = templates.TemplateResponse(template_file, template_dict) + response.headers["Content-Type"] = "application/xml" + else: + template_file = 'browse.xhtml' + response = templates.TemplateResponse(template_file, template_dict) + response.headers["Content-Type"] = "application/xhtml+xml" return response """ diff --git a/graphic/blasta_syndicate.svg b/graphic/blasta_syndicate.svg new file mode 100644 index 0000000..aa48a61 --- /dev/null +++ b/graphic/blasta_syndicate.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/screenshot/browse.png b/screenshot/browse.png new file mode 100644 index 0000000..482cacd Binary files /dev/null and b/screenshot/browse.png differ diff --git a/screenshot/tag.png b/screenshot/tag.png new file mode 100644 index 0000000..b480ff0 Binary files /dev/null and b/screenshot/tag.png differ diff --git a/stylesheet/stylesheet.xsl b/stylesheet/stylesheet.xsl new file mode 100644 index 0000000..2b04756 --- /dev/null +++ b/stylesheet/stylesheet.xsl @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:value-of select='atom:title'/> + + + + + + + +
+

+ +   + +

+ +
    + +
  • + + + #blasta- + + + + + + + + *** No Title *** + + + +
  • +
    +
+
+
+
+ +
+
+
+

+ + This is an automated Blasta Syndication Feed + +

+ +

+ Congratulations! You have reached to the final + frontier that the XML technology has to offer + to-date, and as of yet! +

+

+ This is an automated Blasta Syndication Feed + which you can utilize to gracefully receive + autmatic Blasta updates. +

+

+ Click + here for a selection of software and pick + the ones that would fit to you best! +

+ +
+
+ + + +
+
+ +

+ + + + + + + + + + + + + blasta- + + + + + + + + *** No Title *** + + + +

+ + +

+ +

+ + +
+ + + + ?tags= + + + +   + +
+ + + + + updated + + + + + + published + + + + +

+
+
+
+ +
+ + + + + mailto: + + + + Send an Email to + + + + + + + + + + + + + + + + + + By + + + +
+
+
+
+ + +
No entry ID
+
+
+
+
+ +
+
+

+ + No content + +

+

This entry is empty

+
Please check that the mother PubSub node is populated with content.
+
+
+
+
+
+
+

+ + About Blasta Feeds + +

+ +

+ This is a concise introduction to the syndication + technology. Please, read it. +

+

+ This an Atom document which can also be viewed + with a Syndication Feed Reader (also referred to + as News Reader or RSS Reader) which provides + automated news updates and notifications on + desktop and mobile. + Click + here for a selection of software and pick + the ones that would fit to you best! +

+

+ This ASF (Atom Syndication Format) document is + conveyed as an XHTML document. This document was + produced by an XSLT stylesheet. +

+

+ XSLT is a powerful technology which transforms + XML documents into HTML, JSON, PDF, Text, XHTML, + and (modified) XML documents; + Learn + more about The Extensible Stylesheet + Language Family (XSL). +

+ +
+
+
+
+ + + +
+
diff --git a/xhtml/about.xhtml b/template/about.xhtml similarity index 100% rename from xhtml/about.xhtml rename to template/about.xhtml diff --git a/xhtml/ask.xhtml b/template/ask.xhtml similarity index 100% rename from xhtml/ask.xhtml rename to template/ask.xhtml diff --git a/xhtml/atomsub.xhtml b/template/atomsub.xhtml similarity index 100% rename from xhtml/atomsub.xhtml rename to template/atomsub.xhtml diff --git a/template/browse.atom b/template/browse.atom new file mode 100644 index 0000000..0088a67 --- /dev/null +++ b/template/browse.atom @@ -0,0 +1,49 @@ + + + + Blasta + /graphic/blasta.svg + + + + /graphic/blasta.svg + {{description}} + Blasta / {{path}} + {{entries[0]['updated']}} + {% if entries %} + {% for entry in entries %} + + + {{entry['name']}} + /jid/{{entry['jid']}} + xmpp:{{entry['jid']}} + {{entry['jid']}} + + {{entry['url_hash']}} + + + + {{entry['published']}} + {{entry['summary']}} + {{entry['title']}} + {{entry['updated']}} + {% if entry['tags'] | length > 0 %} + {% for tag in entry['tags'] %} + + {% endfor %} + {% endif %} + + {% endfor %} + {% endif %} + diff --git a/xhtml/browse.xhtml b/template/browse.xhtml similarity index 94% rename from xhtml/browse.xhtml rename to template/browse.xhtml index 649634d..2509124 100644 --- a/xhtml/browse.xhtml +++ b/template/browse.xhtml @@ -11,8 +11,8 @@ + title="Follow updates on /{% if jid %}jid/{% endif %}{{syndicate}}{% if param_tags %} for Tag: #{{param_tags}}{% endif %}{% if param_url %} for URL: {{param_url}}{% endif %}{% if param_hash %} for hash: {{param_hash}}{% endif %}" + href="/{% if jid %}jid/{% endif %}{{syndicate}}?mode=feed{% if param_tags %}&tags={{param_tags}}{% endif %}{% if param_url %}&url={{param_url}}{% endif %}{% if param_hash %}&hash={{param_hash}}{% endif %}" /> @@ -227,7 +227,7 @@ ​  and โš› - + RSS diff --git a/xhtml/connect.xhtml b/template/connect.xhtml similarity index 100% rename from xhtml/connect.xhtml rename to template/connect.xhtml diff --git a/xhtml/contact.xhtml b/template/contact.xhtml similarity index 100% rename from xhtml/contact.xhtml rename to template/contact.xhtml diff --git a/xhtml/edit.xhtml b/template/edit.xhtml similarity index 100% rename from xhtml/edit.xhtml rename to template/edit.xhtml diff --git a/xhtml/feeds.xhtml b/template/feeds.xhtml similarity index 100% rename from xhtml/feeds.xhtml rename to template/feeds.xhtml diff --git a/xhtml/help.xhtml b/template/help.xhtml similarity index 100% rename from xhtml/help.xhtml rename to template/help.xhtml diff --git a/xhtml/ideas.xhtml b/template/ideas.xhtml similarity index 100% rename from xhtml/ideas.xhtml rename to template/ideas.xhtml diff --git a/xhtml/libervia.xhtml b/template/libervia.xhtml similarity index 100% rename from xhtml/libervia.xhtml rename to template/libervia.xhtml diff --git a/xhtml/movim.xhtml b/template/movim.xhtml similarity index 100% rename from xhtml/movim.xhtml rename to template/movim.xhtml diff --git a/xhtml/now.xhtml b/template/now.xhtml similarity index 100% rename from xhtml/now.xhtml rename to template/now.xhtml diff --git a/xhtml/philosophy.xhtml b/template/philosophy.xhtml similarity index 100% rename from xhtml/philosophy.xhtml rename to template/philosophy.xhtml diff --git a/xhtml/profile.xhtml b/template/profile.xhtml similarity index 100% rename from xhtml/profile.xhtml rename to template/profile.xhtml diff --git a/xhtml/projects.xhtml b/template/projects.xhtml similarity index 100% rename from xhtml/projects.xhtml rename to template/projects.xhtml diff --git a/xhtml/pubsub.xhtml b/template/pubsub.xhtml similarity index 100% rename from xhtml/pubsub.xhtml rename to template/pubsub.xhtml diff --git a/xhtml/questions.xhtml b/template/questions.xhtml similarity index 100% rename from xhtml/questions.xhtml rename to template/questions.xhtml diff --git a/xhtml/register.xhtml b/template/register.xhtml similarity index 100% rename from xhtml/register.xhtml rename to template/register.xhtml diff --git a/xhtml/result.xhtml b/template/result.xhtml similarity index 100% rename from xhtml/result.xhtml rename to template/result.xhtml diff --git a/xhtml/search.xhtml b/template/search.xhtml similarity index 100% rename from xhtml/search.xhtml rename to template/search.xhtml diff --git a/xhtml/software.xhtml b/template/software.xhtml similarity index 100% rename from xhtml/software.xhtml rename to template/software.xhtml diff --git a/xhtml/syndication.xhtml b/template/syndication.xhtml similarity index 100% rename from xhtml/syndication.xhtml rename to template/syndication.xhtml diff --git a/xhtml/tag.xhtml b/template/tag.xhtml similarity index 100% rename from xhtml/tag.xhtml rename to template/tag.xhtml diff --git a/xhtml/thanks.xhtml b/template/thanks.xhtml similarity index 100% rename from xhtml/thanks.xhtml rename to template/thanks.xhtml diff --git a/xhtml/utilities.xhtml b/template/utilities.xhtml similarity index 100% rename from xhtml/utilities.xhtml rename to template/utilities.xhtml diff --git a/xhtml/xmpp.xhtml b/template/xmpp.xhtml similarity index 100% rename from xhtml/xmpp.xhtml rename to template/xmpp.xhtml