Gemlog Booster [main]

Added editable license metadata field

=> aecfd2afe9622f5256f67a54105830ba5440fbc8

diff --git a/booster.py b/booster.py
index 81eccc1..3af9b7e 100755
--- a/booster.py
+++ b/booster.py
@@ -70,7 +70,7 @@ def report_error(code, msg):
 
 class Tinylog:
     TIME_FORMAT  = '%Y-%m-%d %H:%M:%S %Z'
-    PATH_FORMAT  = '/%Y/%m/%d/%H.%M.%S.%Z'
+    PATH_FORMAT  = '/%Y/%m/%d/%H.%M.%S.%Z'   # directly linking to an entry
     MONTH_FORMAT = '/%Y/%m/'
     YEAR_FORMAT  = '/%Y/'
 
@@ -80,6 +80,7 @@ class Tinylog:
         self.info     = ''
         self.author   = ''
         self.avatar   = ''
+        self.license  = ''
         self.entries  = {}   # timestamp -> text
         self.editable = editable
         self.base_url = base_url
@@ -104,6 +105,8 @@ class Tinylog:
                         self.avatar = line[7:].strip()
                     elif line.startswith('author:'):
                         self.author = line[7:].strip()
+                    elif line.startswith('license:'):
+                        self.license = line[8:].strip()
                     else:
                         self.info += line
                 else:
@@ -186,10 +189,12 @@ class Tinylog:
                         label = time.strftime('%B %Y' if is_recent else '%Y', tm)
                         output += f'=> gemini://{self.base_url}{cur_month} Archived: {label}\n'
 
-                if self.author or self.avatar:
-                    #if self.info: output += '\n'
+                if self.author:
                     output += f'author: {self.author}\n'
+                if self.avatar:
                     output += f'avatar: {self.avatar}\n'
+                if self.license:
+                    output += f'license: {self.license}\n'
                 if is_editable:
                     output += f'=> gemini://{self.base_url}/edit Edit metadata\n'
                     output += f'\n=> titan://{self.base_url} New post\n'
@@ -312,6 +317,9 @@ for file_group in CONFIG['files']:
                 print()
                 print(tinylog.avatar)
                 print(f'=> gemini://{tinylog.base_url}/avatar Edit avatar')
+                print()
+                print(tinylog.license)
+                print(f'=> gemini://{tinylog.base_url}/license Edit license')
                 sys.exit(0)
 
             if path_info == '/title' and is_authorized:
@@ -347,6 +355,17 @@ for file_group in CONFIG['files']:
                 tinylog.write()
                 report_error(30, f'gemini://{tinylog.base_url}/edit')
 
+            if path_info == '/license' and is_authorized:
+                if not req_query:
+                    report_error(10, 'Enter license:')
+                elif req_query == '-':
+                    req_query = ''
+                else:
+                    req_query = req_query.strip()
+                tinylog.license = req_query
+                tinylog.write()
+                report_error(30, f'gemini://{tinylog.base_url}/edit')
+
             if req_edit and is_authorized:
                 if path_info == '/info':
                     print('20 text/gemini;charset=utf-8\r\n' + tinylog.info)
Proxy Information
Original URL
gemini://git.skyjake.fi/booster/main/cdiff/aecfd2afe9622f5256f67a54105830ba5440fbc8
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
26.162206 milliseconds
Gemini-to-HTML Time
0.274293 milliseconds

This content has been proxied by September (3851b).