From b31bf3489034ea3327f7a645bcda9a08a57f4712 Mon Sep 17 00:00:00 2001
From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com>
Date: Mon, 1 Mar 2021 15:09:37 +0100
Subject: [PATCH] Check for new version
---
README.md | 2 +-
backend/__init__.py | 22 ++++++++++++++++------
backend/static/css/styles.css | 15 ++++++++++++++-
backend/templates/base.html | 13 +++++++------
changedetection.py | 6 +++++-
5 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 3dc4736d..c76996d9 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-
+
## Self-hosted change monitoring of web pages.
diff --git a/backend/__init__.py b/backend/__init__.py
index 06744202..00b0ba81 100644
--- a/backend/__init__.py
+++ b/backend/__init__.py
@@ -513,18 +513,28 @@ def changedetection_app(config=None, datastore_o=None):
# Check for new version and anonymous stats
def check_for_new_version():
import requests
- app.config['NEW_VERSION_AVAILABLE'] = True
+
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
while not app.config.exit.is_set():
- r = requests.post("https://changedetection.io/check-ver.php",
- data={'version': datastore.data['version_tag'],
- 'app_guid': datastore.data['app_guid']},
+ try:
+ r = requests.post("https://changedetection.io/check-ver.php",
+ data={'version': datastore.data['version_tag'],
+ 'app_guid': datastore.data['app_guid']},
- verify=False)
+ verify=False)
+ except:
+ pass
- app.config.exit.wait(10)
+ try:
+ if "new_version" in r.text:
+ app.config['NEW_VERSION_AVAILABLE'] = True
+ except:
+ pass
+
+ # Check daily
+ app.config.exit.wait(86400)
# Requests for checking on the site use a pool of thread Workers managed by a Queue.
diff --git a/backend/static/css/styles.css b/backend/static/css/styles.css
index 180ac5ef..da504eef 100644
--- a/backend/static/css/styles.css
+++ b/backend/static/css/styles.css
@@ -252,4 +252,17 @@ footer {
#feed-icon {
vertical-align: middle;
-}
\ No newline at end of file
+}
+
+#version {
+ position: absolute;
+ top: 80px;
+ right: 0px;
+ font-size: 8px;
+ background: #fff;
+ padding: 10px;
+}
+
+#new-version-text a{
+ color: #e07171;
+}
diff --git a/backend/templates/base.html b/backend/templates/base.html
index f9e89e06..03afb75a 100644
--- a/backend/templates/base.html
+++ b/backend/templates/base.html
@@ -19,11 +19,11 @@