Bubble [main]

Added ASCII icons user setting

=> af5966cedf4822f11846c6088bb941b6ed7fae37

diff --git a/50_bubble.py b/50_bubble.py
index 815cfef..78ce645 100644
--- a/50_bubble.py
+++ b/50_bubble.py
@@ -92,6 +92,13 @@ Bubble is open source:
             self.c_user = None   # User associated with the context subspace, if any
             self.token = None
 
+        def set_user(self, user):
+            self.user = user
+            if user:
+                if user.flags & User.ASCII_ICONS_FLAG:
+                    self.CHECKS = [ '[_]', '[x]' ]
+                    # TODO: Add more of these.
+
         def is_editable(self, post: Post):
             return self.user.role == User.ADMIN or post.user == self.user.id
 
@@ -315,7 +322,7 @@ Bubble is open source:
 
         if req.identity:
             # Find the user account.
-            session.user = db.get_user(identity=req.identity)
+            session.set_user(db.get_user(identity=req.identity))
             if session.user is None:
                 if req.path == self.path + 'register':
                     if not session.bubble.user_register:
diff --git a/model.py b/model.py
index 70a2afd..8f2ece0 100644
--- a/model.py
+++ b/model.py
@@ -152,6 +152,7 @@ class User:
 
     # Flags:
     HOME_FOLLOWED_FEED_FLAG = 0x1
+    ASCII_ICONS_FLAG = 0x2
 
     def __init__(self, id, name, info, url, avatar, role, flags, notif, email, email_inter, \
                  password, ts_password, ts_created, ts_active, sort_post, sort_cmt):
diff --git a/settings.py b/settings.py
index bba523d..ba87bd4 100644
--- a/settings.py
+++ b/settings.py
@@ -192,6 +192,10 @@ def make_settings_page(session):
                                     User.SORT_COMMENT_NEWEST))
         return 30, '/settings'
 
+    elif req.path == session.path + 'settings/ascii':
+        db.update_user(session.user, flags=(session.user.flags ^ User.ASCII_ICONS_FLAG))
+        return 30, '/settings'
+
     elif req.path == session.path + 'settings/notif':
         notif = session.user.notif
 
@@ -395,11 +399,13 @@ def make_settings_page(session):
         SORT_POST = { 'r': '🕑 Most recent', 'h': '🔥 Hotness' }
         SORT_COMMENT = { 'o': '⬇ Oldest first', 'n': '⬆ Newest first' }
         HOME_FEED = [ 'All Posts', 'Followed' ]
+        ICON_MODE = [ 'Unicode/Emoji' , 'ASCII' ]
         user_space = db.get_subspace(owner=session.user.id)
 
         page += f'=> /settings/homefeed Home feed: {HOME_FEED[nonzero(session.user.flags & User.HOME_FOLLOWED_FEED_FLAG)]}\n'
         page += f'=> /settings/sort-feed Sort posts: {SORT_POST[session.user.sort_post]}\n'
         page += f'=> /settings/sort-cmt Sort comments: {SORT_COMMENT[session.user.sort_cmt]}\n'
+        page += f'=> /settings/ascii Display icons as: {ICON_MODE[nonzero(session.user.flags & User.ASCII_ICONS_FLAG)]}\n'
 
         page += f'\n=> /settings/omit-all {session.CHECKS[nonzero(user_space.flags & Subspace.OMIT_FROM_ALL_FLAG)]} ' + \
                 f'Omit u/{session.user.name} from All Posts\n'
Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/cdiff/af5966cedf4822f11846c6088bb941b6ed7fae37
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
45.106518 milliseconds
Gemini-to-HTML Time
0.364056 milliseconds

This content has been proxied by September (ba2dc).