geminispace.info

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/geminispace.info.git
Log | Files | Refs | README | LICENSE

commit 0b45da52c1fc5ee927f2ea9e90570a8bd38fe3fc
parent 34be029c6522ba5692722618af7efebe1420b355
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Sun,  2 Aug 2020 05:45:28 -0400

[serve] Add Known Feeds page

Diffstat:
Mserve/models.py | 11+++++++++++
Mserve/templates/index.gmi | 1+
Aserve/templates/known_feeds.gmi | 12++++++++++++
Mserve/templates/known_hosts.gmi | 2+-
Mserve/templates/news.gmi | 5++++-
Mserve/views.py | 8++++++++
6 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/serve/models.py b/serve/models.py @@ -151,6 +151,17 @@ ORDER BY t.updated_at DESC, t.id ASC, tp.address ASC""") return link_text + def get_feeds(self): + feeds_query = Page.raw("""SELECT DISTINCT p.* +FROM page AS p +JOIN indexable_crawl AS c +ON c.page_id == p.id +WHERE p.url LIKE '%atom.xml' +""") + return feeds_query.execute() + + + def get_search_suggestions(self, query): suggestions = [] corrector = self.searcher.corrector("content") diff --git a/serve/templates/index.gmi b/serve/templates/index.gmi @@ -3,6 +3,7 @@ => /about About GUS => /statistics GUS Statistics => /known-hosts Known Gemini Hosts +=> /known-feeds Known Gemini Feeds => /news GUS News => gemini://gemini.circumlunar.space Gemini Project information diff --git a/serve/templates/known_feeds.gmi b/serve/templates/known_feeds.gmi @@ -0,0 +1,12 @@ +{% include 'fragments/header.gmi' %} + + +## Known Gemini Feeds + +Below are the public feeds of which GUS is aware. This list is auto-generated from the index, so if your feed is not showing up here, please use the link at the bottom of this page to submit a crawl request for your feed URL. + +{% for feed in known_feeds %} +{{ "=> {} {}".format(feed.fetchable_url, feed.url) }} +{% endfor %} + +{% include 'fragments/footer.gmi' %} diff --git a/serve/templates/known_hosts.gmi b/serve/templates/known_hosts.gmi @@ -3,7 +3,7 @@ ## Known Gemini Hosts -Below are the hosts, or servers, in Geminispace, of which GUS is aware. Note that this list is auto-generated from the index, so if your host is not showing up here, it also won't have its content represented in GUS search results! If your server is missing, try the link at the bottom of this page to request an immediate crawl of a Gemini URL, after which your server should start showing up. +Below are the hosts, or servers, in Geminispace, of which GUS is aware. Note that this list is auto-generated from the index, so if your host is not showing up here, it also won't have its content represented in GUS search results! If your server is missing, please use the link at the bottom of this page to submit a crawl request of your Gemini URL, after which your server should start showing up. {% for host in known_hosts %} {{ "=> gemini://{} {}".format(host, host) }} diff --git a/serve/templates/news.gmi b/serve/templates/news.gmi @@ -3,6 +3,9 @@ ## News +### 2020-08-02 +Add known feeds feature at gus.guru/known-feeds + ### 2020-07-23 Added distinction between internal and external backlinks. See gus.guru/about for full documentation. @@ -13,7 +16,7 @@ Updated certificate for gus.guru. I finally got around to reading some of the he Added more prominent header link to backlink queries. ### 2020-07-05 -Added historical statistics page, viewable at gemini://gus.guru/statistics/historical/overall +Added historical statistics page, viewable at gus.guru/statistics/historical/overall ### 2020-07-03 Added support for viewing backlinks to pages. You can find this functionality on search result pages when in verbose mode. If GUS knows of pages linking to a given result (a.k.a., a "backlink"), it will add an option to view those backlinks. This comes on the heels of some interesting discussion regarding tracking replies in Geminispace, and could open the door to some novel functionality built on top of this feature - e.g. the ability to "subscribe" to updates to your own posts, and if a new backlink is discovered, it could notify you somehow. Alternatively, since the URL structure to reach a given page's backlinks page is predictable, one could also simply place a link on content pages to their corresponding GUS backlinks page, which readers could navigate to after reading, to find related content to read. As always, documentation for this new feature can be found on the about page. A number of small changes to verbose mode also went out with this release - in particular, there is now a button on search result pages to toggle verbose mode, so you don't need to muck around with the URL manually to toggle it, and verbose mode is now sticky between search result pages when using the previous/first/next page links at the bottom. diff --git a/serve/views.py b/serve/views.py @@ -74,6 +74,14 @@ def known_hosts(request): return Response(Status.SUCCESS, "text/gemini", body) +@app.route("/known-feeds", strict_trailing_slash=False) +def known_feeds(request): + body = render_template("known_feeds.gmi", + known_feeds=gus.get_feeds(), + index_modification_time=gus.statistics["index_modification_time"]) + return Response(Status.SUCCESS, "text/gemini", body) + + @app.route("", strict_trailing_slash=False) def index(request): body = render_template("index.gmi",