mirror of
https://github.com/nikdoof/ohayodash.git
synced 2025-12-16 01:12:20 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
4c6234e2db
|
|||
|
99a7dfde6e
|
|||
|
17dadcc39e
|
|||
|
4f0d4e0313
|
|||
|
30543409e0
|
@@ -18,6 +18,8 @@ image:
|
||||
env:
|
||||
# -- Set the container timezone
|
||||
TZ: UTC
|
||||
# -- Python date format string to use for rendering the date/time
|
||||
DATE_FORMAT: "%Y-%m-%d %H:%M"
|
||||
|
||||
# -- Configures service settings for the chart.
|
||||
# @default -- See values.yaml
|
||||
|
||||
@@ -5,7 +5,7 @@ import zoneinfo
|
||||
|
||||
import kubernetes
|
||||
import yaml
|
||||
from flask import Blueprint, render_template
|
||||
from flask import Blueprint, render_template, jsonify
|
||||
|
||||
ANNOTATION_BASE = 'ohayodash.github.io'
|
||||
|
||||
@@ -77,7 +77,7 @@ def get_bookmarks() -> list:
|
||||
return bookmarks
|
||||
|
||||
|
||||
def get_greeting():
|
||||
def get_greeting() -> tuple:
|
||||
"""Generate the greeting string based on the defined timezone."""
|
||||
try:
|
||||
tz = zoneinfo.ZoneInfo(os.environ.get('TZ', 'UTC'))
|
||||
@@ -88,10 +88,15 @@ def get_greeting():
|
||||
current_time = datetime.datetime.now(tz)
|
||||
|
||||
if 0 < current_time.hour < 12:
|
||||
return 'おはようございます!'
|
||||
return 'おはようございます!', "Thats 'Good morning' in Japanese"
|
||||
elif current_time.hour >= 19:
|
||||
return 'こんばんは'
|
||||
return 'こんにちは'
|
||||
return 'こんばんは', "Thats 'Good evening' in Japanese"
|
||||
return 'こんにちは', "Thats 'Good day' in Japanese"
|
||||
|
||||
|
||||
@base.app_template_filter()
|
||||
def format_datetime(value, format='medium'):
|
||||
return value.strftime(os.environ.get('DATE_FORMAT', '%Y-%m-%d %H:%M')) # noqa: WPS323
|
||||
|
||||
|
||||
@base.route('/')
|
||||
@@ -102,3 +107,13 @@ def index():
|
||||
applications=get_k8s_applications(),
|
||||
bookmarks=get_bookmarks(),
|
||||
)
|
||||
|
||||
|
||||
@base.route('/api/applications')
|
||||
def applications():
|
||||
return jsonify(get_k8s_applications())
|
||||
|
||||
|
||||
@base.route('/api/bookmarks')
|
||||
def bookmarks():
|
||||
return jsonify(get_bookmarks())
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
</section>
|
||||
|
||||
<section id="header">
|
||||
<h1>{{ greeting | default("Welcome")}}</h1>
|
||||
<h2>{{ now }}</h2>
|
||||
<h1><span title="{{ greeting[1] }}">{{ greeting[0] | default("Welcome")}}</span></h1>
|
||||
<h2>{{ now | format_datetime }}</h2>
|
||||
</section>
|
||||
|
||||
{% if applications %}
|
||||
@@ -63,7 +63,7 @@
|
||||
{% for app in applications %}
|
||||
<div class="apps_item">
|
||||
<div class="apps_icon">
|
||||
<span class="iconify icon" data-icon="mdi-{{ app.icon | default("application") }}"></span>
|
||||
<a href="{{ app.url }}"><span class="iconify icon" data-icon="mdi-{{ app.icon | default("application") }}"></span></a>
|
||||
</div>
|
||||
<div class="apps_text">
|
||||
<a href="{{ app.url }}">{{ app.name }}</a>
|
||||
|
||||
Reference in New Issue
Block a user