feat: add build env and date to web ui footer
This commit is contained in:
parent
d16e407269
commit
0d64c65aa5
|
|
@ -1307,6 +1307,7 @@
|
|||
<footer
|
||||
class="my-5 py-5 text-body-secondary text-center text-small"
|
||||
>
|
||||
<p class="mb-4 small">%BUILD_INFO%</p>
|
||||
<p class="mb-1 small">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import gzip
|
||||
import os
|
||||
import datetime
|
||||
Import("env")
|
||||
|
||||
files = [
|
||||
'data_embed/index.html',
|
||||
|
|
@ -8,13 +11,19 @@ files = [
|
|||
'data_embed/bootstrap.css',
|
||||
]
|
||||
|
||||
|
||||
for src in files:
|
||||
out = src + ".gz"
|
||||
|
||||
|
||||
with open(src, 'rb') as f:
|
||||
content = f.read()
|
||||
|
||||
if src == 'data_embed/index.html':
|
||||
env_vars = env["BOARD"] + "<br>" + ','.join(env["BUILD_FLAGS"]).replace('-Werror -Wall,', '').replace(',-DELEGANTOTA_USE_ASYNC_WEBSERVER=1', '')
|
||||
current_date = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S') + " UTC"
|
||||
build_info = f'{env_vars}<br>Build date: {current_date}'.encode()
|
||||
|
||||
content = content.replace(b'%BUILD_INFO%', build_info)
|
||||
|
||||
with open(out, 'wb') as f:
|
||||
f.write(gzip.compress(content, compresslevel=9))
|
||||
Loading…
Reference in New Issue