From fc806bcb866fef3e6c1b1ee88a56ee02e3903194 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sun, 29 Dec 2024 19:48:16 +0200

Subject: [PATCH 1/1] Updated with corrected PATH_INFO contents


booster.py | 39 +++++++++++++++++++--------------------

1 file changed, 19 insertions(+), 20 deletions(-)

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:

 MONTH_FORMAT = '/%Y/%m/'

 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)

             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'

         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':

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

             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 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 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 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:

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

                 sys.exit(0)

             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:

             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:

             # Try a monthly archive filter.

             try:

                 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:

                 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')

             tinylog.info = data_text.strip()

             tinylog.write()

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

         else:

             try:

             except:

                 entry_ts = None

             tinylog.add(entry_ts, data_text)

--

2.25.1

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

This content has been proxied by September (ba2dc).