RUN set -eux && \
case "${PNGX_TAG_VERSION}" in \
dev|beta|fix*|feature*) \
- sed -i -E "s/version: '([0-9\.]+)'/version: '\1 #${PNGX_TAG_VERSION}'/g" /src/src-ui/src/environments/environment.prod.ts \
+ sed -i -E "s/tag: '([a-z\.]+)'/tag: '${PNGX_TAG_VERSION}'/g" /src/src-ui/src/environments/environment.prod.ts \
;; \
esac
extends ComponentWithPermissions
implements OnInit, ComponentCanDeactivate
{
- versionString = `${environment.appTitle} ${environment.version}`
appRemoteVersion: AppRemoteVersion
isMenuCollapsed: boolean = true
}, 200) // slightly longer than css animation for slim sidebar
}
+ get versionString(): string {
+ return `${environment.appTitle} v${this.settingsService.get(SETTINGS_KEYS.VERSION)}${environment.production ? '' : ` #${environment.tag}`}`
+ }
+
get customAppTitle(): string {
return this.settingsService.get(SETTINGS_KEYS.APP_TITLE)
}
<div class="card-body">
<dl class="card-text">
<dt i18n>Paperless-ngx Version</dt>
- <dd>{{status.pngx_version}}</dd>
+ <dd>
+ {{status.pngx_version}}
+ @if (versionMismatch) {
+ <button class="btn btn-sm d-inline align-items-center btn-dark text-uppercase small" [ngbPopover]="versionPopover" triggers="click mouseenter:mouseleave">
+ <i-bs name="exclamation-triangle-fill" class="text-danger lh-1"></i-bs>
+ </button>
+ }
+ <ng-template #versionPopover>
+ Frontend version: {{frontendVersion}}<br>
+ Backend version: {{status.pngx_version}}
+ </ng-template>
+ </dd>
<dt i18n>Install Type</dt>
<dd>{{status.install_type}}</dd>
<dt i18n>Server OS</dt>
+// Mock production environment for testing
+jest.mock('src/environments/environment', () => ({
+ environment: {
+ production: true,
+ apiBaseUrl: 'http://localhost:8000/api/',
+ apiVersion: '9',
+ appTitle: 'Paperless-ngx',
+ tag: 'prod',
+ version: '2.4.3',
+ webSocketHost: 'localhost:8000',
+ webSocketProtocol: 'ws:',
+ webSocketBaseUrl: '/ws/',
+ },
+}))
+
import { Clipboard } from '@angular/cdk/clipboard'
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
import { provideHttpClientTesting } from '@angular/common/http/testing'
`Task ${PaperlessTaskName.IndexOptimize} started`
)
})
+
+ it('shoduld handle version mismatch', () => {
+ component.frontendVersion = '2.4.2'
+ component.ngOnInit()
+ expect(component.versionMismatch).toBeTruthy()
+ expect(component.status.pngx_version).toContain('(frontend: 2.4.2)')
+ component.frontendVersion = '2.4.3'
+ component.status.pngx_version = '2.4.3'
+ component.ngOnInit()
+ expect(component.versionMismatch).toBeFalsy()
+ })
})
import { Clipboard, ClipboardModule } from '@angular/cdk/clipboard'
-import { Component } from '@angular/core'
+import { Component, OnInit } from '@angular/core'
import {
NgbActiveModal,
NgbModalModule,
import { SystemStatusService } from 'src/app/services/system-status.service'
import { TasksService } from 'src/app/services/tasks.service'
import { ToastService } from 'src/app/services/toast.service'
+import { environment } from 'src/environments/environment'
@Component({
selector: 'pngx-system-status-dialog',
NgxBootstrapIconsModule,
],
})
-export class SystemStatusDialogComponent {
+export class SystemStatusDialogComponent implements OnInit {
public SystemStatusItemStatus = SystemStatusItemStatus
public PaperlessTaskName = PaperlessTaskName
public status: SystemStatus
+ public frontendVersion: string = environment.version
+ public versionMismatch: boolean = false
public copied: boolean = false
private permissionsService: PermissionsService
) {}
+ public ngOnInit() {
+ this.versionMismatch =
+ environment.production &&
+ this.status.pngx_version &&
+ this.frontendVersion &&
+ this.status.pngx_version !== this.frontendVersion
+ if (this.versionMismatch) {
+ this.status.pngx_version = `${this.status.pngx_version} (frontend: ${this.frontendVersion})`
+ }
+ }
+
public close() {
this.activeModal.close()
}
export const PAPERLESS_GREEN_HEX = '#17541f'
export const SETTINGS_KEYS = {
+ VERSION: 'version',
LANGUAGE: 'language',
APP_LOGO: 'app_logo',
APP_TITLE: 'app_title',
}
export const SETTINGS: UiSetting[] = [
+ {
+ key: SETTINGS_KEYS.VERSION,
+ type: 'string',
+ default: '',
+ },
{
key: SETTINGS_KEYS.LANGUAGE,
type: 'string',
apiBaseUrl: document.baseURI + 'api/',
apiVersion: '9', // match src/paperless/settings.py
appTitle: 'Paperless-ngx',
+ tag: 'prod',
version: '2.16.3',
webSocketHost: window.location.host,
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
apiBaseUrl: 'http://localhost:8000/api/',
apiVersion: '9',
appTitle: 'Paperless-ngx',
+ tag: 'dev',
version: 'DEVELOPMENT',
webSocketHost: 'localhost:8000',
webSocketProtocol: 'ws:',
from rest_framework.test import APITestCase
from documents.tests.utils import DirectoriesMixin
+from paperless.version import __full_version_str__
class TestApiUiSettings(DirectoriesMixin, APITestCase):
self.assertDictEqual(
response.data["settings"],
{
+ "version": __full_version_str__,
"app_title": None,
"app_logo": None,
"auditlog_enabled": True,
general_config = GeneralConfig()
+ ui_settings["version"] = version.__full_version_str__
+
ui_settings["app_title"] = settings.APP_TITLE
if general_config.app_title is not None and len(general_config.app_title) > 0:
ui_settings["app_title"] = general_config.app_title
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
},
)
+
+import logging # noqa: E402
+
+from paperless.version import __full_version_str__ # noqa: E402
+
+logger = logging.getLogger("paperless.asgi")
+logger.info(f"[init] Paperless-ngx version: v{__full_version_str__}")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "paperless.settings")
application = get_wsgi_application()
+
+import logging # noqa: E402
+
+from paperless.version import __full_version_str__ # noqa: E402
+
+logger = logging.getLogger("paperless.wsgi")
+logger.info(f"[init] Paperless-ngx version: v{__full_version_str__}")