diff --git a/booster.py b/booster.py

index 8958c45..2c9568b 100755

--- a/booster.py

+++ b/booster.py

@@ -7,7 +7,7 @@

##

##==========================================================================##



-# Copyright (c) 2021-2025 Jaakko Keränen jaakko.keranen@iki.fi

+# Copyright (c) 2021-2024 Jaakko Keränen jaakko.keranen@iki.fi

#

Redistribution and use in source and binary forms, with or without

modification, are permitted provided that the following conditions are met:

@@ -69,10 +69,10 @@ 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'

+ TIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'

+ PATH_FORMAT = '/%Y/%m/%d/%H.%M.%S.%Z'

 MONTH_FORMAT = '/%Y/%m/'

- YEAR_FORMAT = '/%Y/'

+ YEAR_FORMAT = '/%Y/'



 def __init__(self, path, editable=False, base_url=''):

     self.path     = path

@@ -198,7 +198,6 @@ class Tinylog:

         # Skip entries if they don't pass the filter.

         if is_filtered:

             entry_date = datetime.datetime.fromtimestamp(ts)

- #print(entry_date, file=sys.stderr)

             if year_filter != entry_date.year or (month_filter and

                 month_filter != entry_date.month):

                 continue

@@ -206,6 +205,7 @@ class Tinylog:

         text = self.entries[ts]

         if not raw:

             output += f'\n## {time.strftime(Tinylog.TIME_FORMAT, time.localtime(ts))}\n'

+ if entry: output += '\n'

         output += text + '\n'

         if is_editable:

             tm = time.localtime(ts)

@@ -243,7 +243,8 @@ req_mime = os.getenv('CONTENT_TYPE')

req_token = os.getenv('TITAN_TOKEN')

req_query = os.getenv('QUERY_STRING')

req_edit = os.getenv('TITAN_EDIT')

-path = os.getenv('PATH_INFO')

+path = os.getenv('SCRIPT_NAME') + os.getenv('PATH_INFO')

+path_info = os.getenv('PATH_INFO')

data = sys.stdin.buffer.read() if req_protocol == 'TITAN' else None



is_authorized = req_identity[0] in AUTHORIZED or req_identity[1] in AUTHORIZED

@@ -292,11 +293,10 @@ for file_group in CONFIG['files']:

                       base_url=SITE_URL.replace('gemini://', '') + auth_prefix)



     if req_protocol == 'GEMINI':

- if path == '/':

+ if path_info == '/':

             report_error(31, 'gemini://' + tinylog.base_url)



- # TODO: Check author/avatar queries.

- if path == '/edit' and is_authorized:

+ if path_info == '/edit' and is_authorized:

             print('20 text/gemini;charset=utf-8\r')

             print('# Edit Tinylog\n')

             print(tinylog.title if tinylog.title else 'Untitled')

@@ -312,7 +312,7 @@ for file_group in CONFIG['files']:

             print(f'=> gemini://{tinylog.base_url}/avatar Edit avatar')

             sys.exit(0)



- if path == '/title' and is_authorized:

+ if path_info == '/title' and is_authorized:

             if not req_query:

                 report_error(10, 'Enter title:')

             elif req_query == '-':

@@ -323,7 +323,7 @@ for file_group in CONFIG['files']:

             tinylog.write()

             report_error(30, f'gemini://{tinylog.base_url}/edit')



- if path == '/author' and is_authorized:

+ if path_info == '/author' and is_authorized:

             if not req_query:

                 report_error(10, 'Enter author name:')

             elif req_query == '-':

@@ -334,7 +334,7 @@ for file_group in CONFIG['files']:

             tinylog.write()

             report_error(30, f'gemini://{tinylog.base_url}/edit')



- if path == '/avatar' and is_authorized:

+ if path_info == '/avatar' and is_authorized:

             if not req_query:

                 report_error(10, 'Enter avatar symbol:')

             elif req_query == '-':

@@ -346,11 +346,11 @@ for file_group in CONFIG['files']:

             report_error(30, f'gemini://{tinylog.base_url}/edit')



         if req_edit and is_authorized:

- if path == '/info':

+ if path_info == '/info':

                 print('20 text/gemini;charset=utf-8\r\n' + tinylog.info)

                 sys.exit(0)



- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))

+ entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))

             entry    = tinylog.entries[entry_ts]

             print('20 text/gemini;charset=utf-8\r\n' +

                 tinylog.render(entry=entry_ts, allow_edit=False, raw=True))

@@ -358,7 +358,7 @@ for file_group in CONFIG['files']:



         # Entry page.

         try:

- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))

+ entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))

             if entry_ts in tinylog.entries:

                 if req_query == 'delete':

                     report_error(10, 'Really DELETE entry?')

@@ -371,17 +371,16 @@ for file_group in CONFIG['files']:

                     print(tinylog.render(entry=entry_ts))

                 sys.exit(0)

         except Exception as er:

- #print(er, file=sys.stderr)

             # Try a monthly archive filter.

             try:

- filter = time.strptime(path, Tinylog.MONTH_FORMAT)

+ filter = time.strptime(path_info, Tinylog.MONTH_FORMAT)

                 print('20 text/gemini;charset=utf-8\r\n' + tinylog.render(count=MAX_COUNT, month_filter=filter.tm_mon, year_filter=filter.tm_year))

                 sys.exit(0)

             except Exception as er:

                 print(er, file=sys.stderr)



             try:

- filter = time.strptime(path, Tinylog.YEAR_FORMAT)

+ filter = time.strptime(path_info, Tinylog.YEAR_FORMAT)

                 print('20 text/gemini;charset=utf-8\r\n' + tinylog.render(count=MAX_COUNT, year_filter=filter.tm_year))

                 sys.exit(0)

             except Exception as er:

@@ -397,13 +396,13 @@ for file_group in CONFIG['files']:



         data_text = data.decode('utf-8')



- if path == '/info':

+ if path_info == '/info':

             tinylog.info = data_text.strip()

             tinylog.write()

             report_error(30, 'gemini://' + tinylog.base_url + '/edit')

         else:

             try:

- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))

+ entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))

             except:

                 entry_ts = None

             tinylog.add(entry_ts, data_text)

Proxy Information
Original URL
gemini://git.skyjake.fi/booster/main/pcdiff/fc806bcb866fef3e6c1b1ee88a56ee02e3903194
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
26.955475 milliseconds
Gemini-to-HTML Time
2.424637 milliseconds

This content has been proxied by September (ba2dc).