mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
BE: handle missing buildtimestamp.txt
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -773,8 +773,16 @@ def checkNewVersion():
|
|||||||
|
|
||||||
newVersion = False
|
newVersion = False
|
||||||
|
|
||||||
with open(applicationPath + '/front/buildtimestamp.txt', 'r') as f:
|
build_timestamp_path = os.path.join(applicationPath, 'front/buildtimestamp.txt')
|
||||||
buildTimestamp = int(f.read().strip())
|
|
||||||
|
# Ensure file exists, initialize if missing
|
||||||
|
if not os.path.exists(build_timestamp_path):
|
||||||
|
with open(build_timestamp_path, 'w') as f:
|
||||||
|
f.write("0")
|
||||||
|
|
||||||
|
# Now safely read the timestamp
|
||||||
|
with open(build_timestamp_path, 'r') as f:
|
||||||
|
buildTimestamp = int(f.read().strip() or 0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
|
|||||||
@@ -378,7 +378,14 @@ def importConfigs (pm, db, all_plugins):
|
|||||||
# HANDLE APP was upgraded message - clear cache
|
# HANDLE APP was upgraded message - clear cache
|
||||||
|
|
||||||
# Check if app was upgraded
|
# Check if app was upgraded
|
||||||
with open(applicationPath + '/front/buildtimestamp.txt', 'r') as f:
|
build_timestamp_path = os.path.join(applicationPath, 'front/buildtimestamp.txt')
|
||||||
|
|
||||||
|
# Ensure the build timestamp file exists and has an initial value
|
||||||
|
if not os.path.exists(build_timestamp_path):
|
||||||
|
with open(build_timestamp_path, 'w') as f:
|
||||||
|
f.write("0")
|
||||||
|
|
||||||
|
with open(build_timestamp_path, 'r') as f:
|
||||||
|
|
||||||
buildTimestamp = int(f.read().strip())
|
buildTimestamp = int(f.read().strip())
|
||||||
cur_version = conf.VERSION
|
cur_version = conf.VERSION
|
||||||
|
|||||||
Reference in New Issue
Block a user