aboutsummaryrefslogtreecommitdiff
path: root/src/templates.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates.py')
-rw-r--r--src/templates.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/templates.py b/src/templates.py
index 1308fc0..c605e57 100644
--- a/src/templates.py
+++ b/src/templates.py
@@ -1,4 +1,5 @@
import html
+import datetime
page: str = '''
<!doctype html>
@@ -79,13 +80,14 @@ index: str = f'''
'''
def download(href: str, filename: str, expires: str) -> str:
+ expires_in = datetime.datetime.strptime(expires, '%Y-%m-%d %H:%M:%S') - datetime.datetime.now()
return f'''
{page}
<div>
<a class="g-Link" href="{html.escape(href)}">{html.escape(filename)}</a>
<div>
- Expires: {html.escape(expires)}
+ Expires in {expires_in}
</div>
</div>
'''
@@ -93,5 +95,5 @@ def download(href: str, filename: str, expires: str) -> str:
not_found: str = f'''
{page}
- Sorry, the file you are looking for can not be found. It may have already expired.
+ Oops, not found!
'''