Compare commits
No commits in common. "c53825fed13cf4fbd31c1b7ed7001399fc07da94" and "608e85bc931cda759cdfe76548079793304948ee" have entirely different histories.
c53825fed1
...
608e85bc93
2 changed files with 7 additions and 10 deletions
|
@ -21,7 +21,10 @@ def index() -> str:
|
||||||
def linkify(s):
|
def linkify(s):
|
||||||
return ".".join(titleify(s).split(".")[:-1])
|
return ".".join(titleify(s).split(".")[:-1])
|
||||||
|
|
||||||
posts.append((linkify(p), titleify(p), get_post_cdate(p)))
|
def datify(s):
|
||||||
|
return s[:-14] + " " + s[-4:]
|
||||||
|
|
||||||
|
posts.append((linkify(p), titleify(p), datify(get_post_cdate(p))))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
|
|
|
@ -51,17 +51,11 @@ def get_post(filename: str) -> File | None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
with open(filename, "r") as reader:
|
with open(filename, "r") as reader:
|
||||||
return File(reader.read(), get_post_cdatetime(filename))
|
return File(reader.read(), get_post_cdate(filename))
|
||||||
|
|
||||||
|
|
||||||
def get_post_cdatetime(filename: str) -> str:
|
|
||||||
return ctime(os_path.getmtime(filename))
|
|
||||||
|
|
||||||
|
|
||||||
def get_post_cdate(filename: str) -> str:
|
def get_post_cdate(filename: str) -> str:
|
||||||
dt = datetime.fromtimestamp(os_path.getmtime(filename))
|
return ctime(os_path.getmtime(filename))
|
||||||
|
|
||||||
return dt.strftime("%a %b %d %Y")
|
|
||||||
|
|
||||||
|
|
||||||
def delete_post(filename: str) -> bool:
|
def delete_post(filename: str) -> bool:
|
||||||
|
@ -99,7 +93,7 @@ def exist_post(file_id: int) -> float | None:
|
||||||
|
|
||||||
def time_now() -> float:
|
def time_now() -> float:
|
||||||
"""get current time based on timezone"""
|
"""get current time based on timezone"""
|
||||||
now = datetime.now(datetime.timezone.utc)
|
now = datetime.utcnow()
|
||||||
return (
|
return (
|
||||||
now.timestamp()
|
now.timestamp()
|
||||||
+ timezone(session[Config._session_timezone]).utcoffset(now).total_seconds()
|
+ timezone(session[Config._session_timezone]).utcoffset(now).total_seconds()
|
||||||
|
|
Loading…
Reference in a new issue