Compare commits

..

2 commits

Author SHA1 Message Date
c53825fed1
correct padding
All checks were successful
Publish latest version / build (push) Successful in 30s
2024-11-17 15:04:38 +01:00
68c2886ac0
fix deprecation notice 2024-11-17 15:04:31 +01:00
2 changed files with 10 additions and 7 deletions

View file

@ -21,10 +21,7 @@ def index() -> str:
def linkify(s):
return ".".join(titleify(s).split(".")[:-1])
def datify(s):
return s[:-14] + " " + s[-4:]
posts.append((linkify(p), titleify(p), datify(get_post_cdate(p))))
posts.append((linkify(p), titleify(p), get_post_cdate(p)))
return render_template(
"index.html",

View file

@ -51,11 +51,17 @@ def get_post(filename: str) -> File | None:
return None
else:
with open(filename, "r") as reader:
return File(reader.read(), get_post_cdate(filename))
return File(reader.read(), get_post_cdatetime(filename))
def get_post_cdatetime(filename: str) -> str:
return ctime(os_path.getmtime(filename))
def get_post_cdate(filename: str) -> str:
return ctime(os_path.getmtime(filename))
dt = datetime.fromtimestamp(os_path.getmtime(filename))
return dt.strftime("%a %b %d %Y")
def delete_post(filename: str) -> bool:
@ -93,7 +99,7 @@ def exist_post(file_id: int) -> float | None:
def time_now() -> float:
"""get current time based on timezone"""
now = datetime.utcnow()
now = datetime.now(datetime.timezone.utc)
return (
now.timestamp()
+ timezone(session[Config._session_timezone]).utcoffset(now).total_seconds()