Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Allow notify user if update checking not explicitly set

Michael Shamoon440467e304db
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 98664f329..1581914c0 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -765,12 +765,25 @@ PAPERLESS_OCR_LANGUAGES=<list>
Defaults to none, which does not install any additional languages.
+
+.. _configuration-update-checking:
+
+Update Checking
+###############
+
PAPERLESS_ENABLE_UPDATE_CHECK=<bool>
- Enable (or disable) the automatic check for available updates. This works by
- pinging the releases endpoint of the Github API for the project e.g.
+ Enable (or disable) the automatic check for available updates. This feature is disabled
+ by default but if it is not explicitly set Paperless-ngx will show a message about this.
+
+ If enabled, the feature works by pinging the the Github API for the latest release e.g.
https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest
- to determine whether a new version is available. Actual updating of the app must be done manually.
+ to determine whether a new version is available.
- No tracking data is collected by the app in any way.
+ Actual updating of the app must still be performed manually.
- Defaults to true.
+ Note that for users of thirdy-party containers e.g. linuxserver.io this notification
+ may be 'ahead' of a new release from the third-party maintainers.
+
+ In either case, no tracking data is collected by the app in any way.
+
+ Defaults to none, which disables the feature.
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html
index e201a7d6e..d90d3b2d9 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.html
+++ b/src-ui/src/app/components/app-frame/app-frame.component.html
@@ -185,17 +185,30 @@
<li class="nav-item mt-2">
<div class="px-3 py-2 text-muted small d-flex align-items-center flex-wrap">
<div class="me-3">{{ versionString }}</div>
- <div *ngIf="appRemoteVersion?.update_available" class="version-check">
- <ng-template #updatePopContent>
+ <div *ngIf="appRemoteVersion" class="version-check">
+ <ng-template #updateAvailablePopContent>
<span class="small">Paperless-ngx v{{ appRemoteVersion.version }} <ng-container i18n>is available.</ng-container><br/><ng-container i18n>Click to view.</ng-container></span>
</ng-template>
- <a class="small text-decoration-none" target="_blank" rel="noopener noreferrer" href="https://github.com/paperless-ngx/paperless-ngx/releases"
- [ngbPopover]="updatePopContent" popoverClass="shadow" triggers="mouseenter:mouseleave" container="body">
- <svg fill="currentColor" class="me-1" width="1.2em" height="1.2em" style="vertical-align: text-top;" viewBox="0 0 16 16">
- <use xlink:href="assets/bootstrap-icons.svg#info-circle" />
- </svg>
- <ng-container i18n>Update available</ng-container>
- </a>
+ <ng-template #updateCheckingNotEnabledPopContent>
+ <span class="small"><ng-container i18n>Checking for updates is disabled.</ng-container><br/><ng-container i18n>Click for more information.</ng-container></span>
+ </ng-template>
+ <ng-container *ngIf="appRemoteVersion.feature_is_set; else updateCheckNotSet">
+ <a *ngIf="appRemoteVersion.update_available" class="small text-decoration-none" target="_blank" rel="noopener noreferrer" href="https://github.com/paperless-ngx/paperless-ngx/releases"
+ [ngbPopover]="updateAvailablePopContent" popoverClass="shadow" triggers="mouseenter:mouseleave" container="body">
+ <svg fill="currentColor" class="me-1" width="1.2em" height="1.2em" style="vertical-align: text-top;" viewBox="0 0 16 16">
+ <use xlink:href="assets/bootstrap-icons.svg#info-circle" />
+ </svg>
+ <ng-container *ngIf="appRemoteVersion?.update_available" i18n>Update available</ng-container>
+ </a>
+ </ng-container>
+ <ng-template #updateCheckNotSet>
+ <a class="small text-decoration-none" target="_blank" rel="noopener noreferrer" href="https://paperless-ngx.readthedocs.io/en/latest/configuration.html#update-checking"
+ [ngbPopover]="updateCheckingNotEnabledPopContent" popoverClass="shadow" triggers="mouseenter:mouseleave" container="body">
+ <svg fill="currentColor" class="me-1" width="1.2em" height="1.2em" style="vertical-align: text-top;" viewBox="0 0 16 16">
+ <use xlink:href="assets/bootstrap-icons.svg#info-circle" />
+ </svg>
+ </a>
+ </ng-template>
</div>
</div>
</li>
diff --git a/src-ui/src/app/services/rest/remote-version.service.ts b/src-ui/src/app/services/rest/remote-version.service.ts
index 9b1def363..ab1b5a66b 100644
--- a/src-ui/src/app/services/rest/remote-version.service.ts
+++ b/src-ui/src/app/services/rest/remote-version.service.ts
@@ -6,6 +6,7 @@ import { environment } from 'src/environments/environment'
export interface AppRemoteVersion {
version: string
update_available: boolean
+ feature_is_set: boolean
}
@Injectable({
diff --git a/src/documents/views.py b/src/documents/views.py
index 5dc5667c3..ff269186c 100644
--- a/src/documents/views.py
+++ b/src/documents/views.py
@@ -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,
},
)
diff --git a/src/paperless/settings.py b/src/paperless/settings.py
index 382a2a38b..708be2d33 100644
--- a/src/paperless/settings.py
+++ b/src/paperless/settings.py
@@ -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")