mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Allow notify user if update checking not explicitly set
This commit is contained in:
@@ -675,8 +675,10 @@ class BulkDownloadView(GenericAPIView):
|
||||
class RemoteVersionView(GenericAPIView):
|
||||
def get(self, request, format=None):
|
||||
remote_version = "0.0.0"
|
||||
is_greater = False
|
||||
if settings.ENABLE_UPDATE_CHECK:
|
||||
is_greater_than_current = False
|
||||
# TODO: this can likely be removed when frontend settings are saved to DB
|
||||
feature_is_set = settings.ENABLE_UPDATE_CHECK != "default"
|
||||
if feature_is_set and settings.ENABLE_UPDATE_CHECK:
|
||||
try:
|
||||
with urllib.request.urlopen(
|
||||
"https://api.github.com/repos/"
|
||||
@@ -692,7 +694,7 @@ class RemoteVersionView(GenericAPIView):
|
||||
logger.debug("An error occured checking for available updates")
|
||||
|
||||
current_version = ".".join([str(_) for _ in version.__version__[:3]])
|
||||
is_greater = packaging_version.parse(
|
||||
is_greater_than_current = packaging_version.parse(
|
||||
remote_version,
|
||||
) > packaging_version.parse(
|
||||
current_version,
|
||||
@@ -701,6 +703,7 @@ class RemoteVersionView(GenericAPIView):
|
||||
return Response(
|
||||
{
|
||||
"version": remote_version,
|
||||
"update_available": is_greater,
|
||||
"update_available": is_greater_than_current,
|
||||
"feature_is_set": feature_is_set,
|
||||
},
|
||||
)
|
||||
|
@@ -567,4 +567,6 @@ if os.getenv("PAPERLESS_IGNORE_DATES", ""):
|
||||
if d:
|
||||
IGNORE_DATES.add(d.date())
|
||||
|
||||
ENABLE_UPDATE_CHECK = __get_boolean("PAPERLESS_ENABLE_UPDATE_CHECK", "true")
|
||||
ENABLE_UPDATE_CHECK = os.getenv("PAPERLESS_ENABLE_UPDATE_CHECK", "default")
|
||||
if ENABLE_UPDATE_CHECK != "default":
|
||||
ENABLE_UPDATE_CHECK = __get_boolean("PAPERLESS_ENABLE_UPDATE_CHECK", "true")
|
||||
|
Reference in New Issue
Block a user