Bubble [main]

Support for multiple Antenna URLs for sharing posts

=> 75455d4370a08b0cba83345272d5e73340a71bd8

diff --git a/50_bubble.py b/50_bubble.py
index b2dc785..e5d0d1c 100644
--- a/50_bubble.py
+++ b/50_bubble.py
@@ -2,6 +2,7 @@
 
 import os
 import re
+import shlex
 import sys
 import urllib.parse as urlparse
 
@@ -41,7 +42,10 @@ class Bubble:
         self.rate_register = max(1, cfg.getint('rate.register', 20)) # per hour, any remote
         self.rate_post = max(1, cfg.getint('rate.post', 10)) # per hour, per remote
         self.admin_certpass = cfg.get('admin.certpass', '')
-        self.antenna_url = cfg.get('antenna.url', 'gemini://warmedal.se/~antenna/submit')
+        self.antenna_urls = cfg.get('antenna.url', 'gemini://warmedal.se/~antenna/submit').split()
+        self.antenna_labels = shlex.split(cfg.get('antenna.label', '"📡 Antenna"'))
+        if len(self.antenna_urls) != len(self.antenna_labels):
+            raise Exception("Config error: Antenna URLs and labels mismatched")
         self.version = __version__
 
         # TODO: Could just check capsule Config's titan.upload_limit?
@@ -52,6 +56,12 @@ class Bubble:
         db.create_tables(self.admin_certpass)
         db.close()
 
+    def antenna_links(self, kind, feed_url):
+        links = []
+        for i, url in enumerate(self.antenna_urls):
+            links.append(f'=> {url}?{urlparse.quote(feed_url)} Submit {kind} to {self.antenna_labels[i]}\n')
+        return links
+
     def is_feedback_enabled(self):
         return len(self.user_reactions) or self.thanks_enabled or self.likes_enabled
 
diff --git a/example.ini b/example.ini
index 9d66b8c..ea1a3a0 100644
--- a/example.ini
+++ b/example.ini
@@ -59,4 +59,5 @@ admin.certpass = password
 repo.cachedir = /home/username/.bubble-cache/
 
 ; URL for broadcasting Gemini feed entries.
-; antenna.url = gemini://warmedal.se/~antenna/submit
+antenna.url = gemini://warmedal.se/~antenna/submit gemini://gemini.smallweb.space/antenna/submit
+antenna.label = "📡 Antenna" "DSN Antenna"
diff --git a/feeds.py b/feeds.py
index 26b8033..a08d3e3 100644
--- a/feeds.py
+++ b/feeds.py
@@ -257,9 +257,9 @@ def make_post_page_or_configure_feed(session):
                     actions.append(f'=> /mute/post/{post.id} 🔇 Mute {kind}\n')
 
             if session.is_antenna_enabled() and session.user.id == post.user and post.sub_owner == post.user:
-                antenna_feed = f"gemini://{session.bubble.hostname}{session.path}u/{session.user.name}/{post.id}/antenna"
                 actions.append('\n')
-                actions.append(f'=> {session.bubble.antenna_url}?{urlparse.quote(antenna_feed)} Submit post to 📡 Antenna\n')
+                antenna_feed = f"gemini://{session.bubble.hostname}{session.path}u/{session.user.name}/{post.id}/antenna"
+                actions += session.bubble.antenna_links('post', antenna_feed)
 
             if session.is_deletable(post) and not session.is_editable(post):
                 actions.append('\n')
@@ -856,7 +856,9 @@ def make_feed_page(session):
 
                 if session.is_antenna_enabled() and c_user and user.id == c_user.id:
                     antenna_feed = f"{session.server_root()}{session.path}u/{user.name}/antenna"
-                    page += f'=> {session.bubble.antenna_url}?{urlparse.quote(antenna_feed)} Submit feed to 📡 Antenna\n'
+                    #page += f'=> {session.bubble.antenna_url}?{urlparse.quote(antenna_feed)} Submit feed to 📡 Antenna\n'
+                    for link in session.bubble.antenna_links('feed', antenna_feed):
+                        page += link
 
                 # Following and muting.
                 if c_user and user.id != c_user.id:
Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/cdiff/75455d4370a08b0cba83345272d5e73340a71bd8
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
37.324393 milliseconds
Gemini-to-HTML Time
0.375452 milliseconds

This content has been proxied by September (ba2dc).