=> fc806bcb866fef3e6c1b1ee88a56ee02e3903194
[1mdiff --git a/booster.py b/booster.py[m [1mindex 8958c45..2c9568b 100755[m [1m--- a/booster.py[m [1m+++ b/booster.py[m [36m@@ -7,7 +7,7 @@[m ## ##[m ##==========================================================================##[m [m [31m-# Copyright (c) 2021-2025 Jaakko Keränen[m [32m+[m[32m# Copyright (c) 2021-2024 Jaakko Keränen [m #[m # Redistribution and use in source and binary forms, with or without[m # modification, are permitted provided that the following conditions are met:[m [36m@@ -69,10 +69,10 @@[m [mdef report_error(code, msg):[m [m [m class Tinylog:[m [31m- TIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'[m [31m- PATH_FORMAT = '/%Y/%m/%d/%H.%M.%S.%Z'[m [32m+[m[32m TIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'[m [32m+[m[32m PATH_FORMAT = '/%Y/%m/%d/%H.%M.%S.%Z'[m MONTH_FORMAT = '/%Y/%m/'[m [31m- YEAR_FORMAT = '/%Y/'[m [32m+[m[32m YEAR_FORMAT = '/%Y/'[m [m def __init__(self, path, editable=False, base_url=''):[m self.path = path[m [36m@@ -198,7 +198,6 @@[m [mclass Tinylog:[m # Skip entries if they don't pass the filter.[m if is_filtered:[m entry_date = datetime.datetime.fromtimestamp(ts)[m [31m- #print(entry_date, file=sys.stderr)[m if year_filter != entry_date.year or (month_filter and[m month_filter != entry_date.month):[m continue[m [36m@@ -206,6 +205,7 @@[m [mclass Tinylog:[m text = self.entries[ts][m if not raw:[m output += f'\n## {time.strftime(Tinylog.TIME_FORMAT, time.localtime(ts))}\n'[m [32m+[m[32m if entry: output += '\n'[m output += text + '\n'[m if is_editable:[m tm = time.localtime(ts)[m [36m@@ -243,7 +243,8 @@[m [mreq_mime = os.getenv('CONTENT_TYPE')[m req_token = os.getenv('TITAN_TOKEN')[m req_query = os.getenv('QUERY_STRING')[m req_edit = os.getenv('TITAN_EDIT')[m [31m-path = os.getenv('PATH_INFO')[m [32m+[m[32mpath = os.getenv('SCRIPT_NAME') + os.getenv('PATH_INFO')[m [32m+[m[32mpath_info = os.getenv('PATH_INFO')[m data = sys.stdin.buffer.read() if req_protocol == 'TITAN' else None[m [m is_authorized = req_identity[0] in AUTHORIZED or req_identity[1] in AUTHORIZED[m [36m@@ -292,11 +293,10 @@[m [mfor file_group in CONFIG['files']:[m base_url=SITE_URL.replace('gemini://', '') + auth_prefix)[m [m if req_protocol == 'GEMINI':[m [31m- if path == '/':[m [32m+[m[32m if path_info == '/':[m report_error(31, 'gemini://' + tinylog.base_url)[m [m [31m- # TODO: Check author/avatar queries.[m [31m- if path == '/edit' and is_authorized:[m [32m+[m[32m if path_info == '/edit' and is_authorized:[m print('20 text/gemini;charset=utf-8\r')[m print('# Edit Tinylog\n')[m print(tinylog.title if tinylog.title else 'Untitled')[m [36m@@ -312,7 +312,7 @@[m [mfor file_group in CONFIG['files']:[m print(f'=> gemini://{tinylog.base_url}/avatar Edit avatar')[m sys.exit(0)[m [m [31m- if path == '/title' and is_authorized:[m [32m+[m[32m if path_info == '/title' and is_authorized:[m if not req_query:[m report_error(10, 'Enter title:')[m elif req_query == '-':[m [36m@@ -323,7 +323,7 @@[m [mfor file_group in CONFIG['files']:[m tinylog.write()[m report_error(30, f'gemini://{tinylog.base_url}/edit')[m [m [31m- if path == '/author' and is_authorized:[m [32m+[m[32m if path_info == '/author' and is_authorized:[m if not req_query:[m report_error(10, 'Enter author name:')[m elif req_query == '-':[m [36m@@ -334,7 +334,7 @@[m [mfor file_group in CONFIG['files']:[m tinylog.write()[m report_error(30, f'gemini://{tinylog.base_url}/edit')[m [m [31m- if path == '/avatar' and is_authorized:[m [32m+[m[32m if path_info == '/avatar' and is_authorized:[m if not req_query:[m report_error(10, 'Enter avatar symbol:')[m elif req_query == '-':[m [36m@@ -346,11 +346,11 @@[m [mfor file_group in CONFIG['files']:[m report_error(30, f'gemini://{tinylog.base_url}/edit')[m [m if req_edit and is_authorized:[m [31m- if path == '/info':[m [32m+[m[32m if path_info == '/info':[m print('20 text/gemini;charset=utf-8\r\n' + tinylog.info)[m sys.exit(0)[m [m [31m- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))[m [32m+[m[32m entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))[m entry = tinylog.entries[entry_ts][m print('20 text/gemini;charset=utf-8\r\n' +[m tinylog.render(entry=entry_ts, allow_edit=False, raw=True))[m [36m@@ -358,7 +358,7 @@[m [mfor file_group in CONFIG['files']:[m [m # Entry page.[m try:[m [31m- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))[m [32m+[m[32m entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))[m if entry_ts in tinylog.entries:[m if req_query == 'delete':[m report_error(10, 'Really DELETE entry?')[m [36m@@ -371,17 +371,16 @@[m [mfor file_group in CONFIG['files']:[m print(tinylog.render(entry=entry_ts))[m sys.exit(0)[m except Exception as er:[m [31m- #print(er, file=sys.stderr)[m # Try a monthly archive filter.[m try:[m [31m- filter = time.strptime(path, Tinylog.MONTH_FORMAT)[m [32m+[m[32m filter = time.strptime(path_info, Tinylog.MONTH_FORMAT)[m print('20 text/gemini;charset=utf-8\r\n' + tinylog.render(count=MAX_COUNT, month_filter=filter.tm_mon, year_filter=filter.tm_year))[m sys.exit(0)[m except Exception as er:[m print(er, file=sys.stderr)[m [m try:[m [31m- filter = time.strptime(path, Tinylog.YEAR_FORMAT)[m [32m+[m[32m filter = time.strptime(path_info, Tinylog.YEAR_FORMAT)[m print('20 text/gemini;charset=utf-8\r\n' + tinylog.render(count=MAX_COUNT, year_filter=filter.tm_year))[m sys.exit(0)[m except Exception as er:[m [36m@@ -397,13 +396,13 @@[m [mfor file_group in CONFIG['files']:[m [m data_text = data.decode('utf-8')[m [m [31m- if path == '/info':[m [32m+[m[32m if path_info == '/info':[m tinylog.info = data_text.strip()[m tinylog.write()[m report_error(30, 'gemini://' + tinylog.base_url + '/edit')[m else:[m try:[m [31m- entry_ts = time.mktime(time.strptime(path, Tinylog.PATH_FORMAT))[m [32m+[m[32m entry_ts = time.mktime(time.strptime(path_info, Tinylog.PATH_FORMAT))[m except:[m entry_ts = None[m tinylog.add(entry_ts, data_text)[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).