From d8bc7254a676eff0d95e064d84ff160e56bef65f Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 21 Oct 2021 13:56:41 +0200
Subject: [PATCH] Move the annotations feature flag into the app config

This makes it more clear where it is enabled and where it isn't
---
 app.config.js                 | 15 ++++++++++-----
 assets/dbp-signature.html.ejs |  2 +-
 rollup.config.js              |  4 +++-
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/app.config.js b/app.config.js
index 99431cd..2313713 100644
--- a/app.config.js
+++ b/app.config.js
@@ -10,7 +10,8 @@ export default {
         nextcloudBaseURL: 'http://localhost:8081',
         nextcloudName: 'TU Graz cloud',
         pdfAsQualifiedlySigningServer: 'https://sig-dev.tugraz.at',
-        hiddenActivities: ['dbp-signature-verification-full']
+        hiddenActivities: ['dbp-signature-verification-full'],
+        enableAnnotations: true
     },
     bs: {
         basePath: '/dist/',
@@ -23,7 +24,8 @@ export default {
         nextcloudBaseURL: 'http://bs-local.com:8081',
         nextcloudName: 'TU Graz cloud',
         pdfAsQualifiedlySigningServer: 'https://sig-dev.tugraz.at',
-        hiddenActivities: []
+        hiddenActivities: [],
+        enableAnnotations: true
     },
     development: {
         basePath: '/apps/signature/',
@@ -36,7 +38,8 @@ export default {
         nextcloudBaseURL: 'https://nc-dev.tugraz.at/pers',
         nextcloudName: 'TU Graz cloud',
         pdfAsQualifiedlySigningServer: 'https://sig-dev.tugraz.at',
-        hiddenActivities: ['dbp-signature-verification-full']
+        hiddenActivities: ['dbp-signature-verification-full'],
+        enableAnnotations: true
     },
     demo: {
         basePath: '/apps/signature/',
@@ -49,7 +52,8 @@ export default {
         nextcloudBaseURL: 'https://cloud.tugraz.at',
         nextcloudName: 'TU Graz cloud',
         pdfAsQualifiedlySigningServer: 'https://sig-demo.tugraz.at',
-        hiddenActivities: ['dbp-signature-verification-full']
+        hiddenActivities: ['dbp-signature-verification-full'],
+        enableAnnotations: true
     },
     production: {
         basePath: '/',
@@ -62,6 +66,7 @@ export default {
         nextcloudBaseURL: 'https://cloud.tugraz.at',
         nextcloudName: 'TU Graz cloud',
         pdfAsQualifiedlySigningServer: 'https://sig.tugraz.at',
-        hiddenActivities: ['dbp-signature-verification-full']
+        hiddenActivities: ['dbp-signature-verification-full'],
+        enableAnnotations: false
     },
 };
\ No newline at end of file
diff --git a/assets/dbp-signature.html.ejs b/assets/dbp-signature.html.ejs
index ebad63d..15149dd 100644
--- a/assets/dbp-signature.html.ejs
+++ b/assets/dbp-signature.html.ejs
@@ -68,7 +68,7 @@
     id="app"
     lang="de" entry-point-url="<%= entryPointURL %>"
     file-handling-enabled-targets="local,nextcloud"
-    <%= buildInfo.env !== 'production' ? 'allow-annotating' : '' %>
+    <%= enableAnnotations ? 'allow-annotating' : '' %>
     nextcloud-web-app-password-url="<%= nextcloudWebAppPasswordURL %>"
     nextcloud-webdav-url="<%= nextcloudWebDavURL %>"
     nextcloud-name="<%= nextcloudName %>"
diff --git a/rollup.config.js b/rollup.config.js
index 4d765da..ceb158f 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -42,6 +42,7 @@ if (appEnv in appConfig) {
         nextcloudName: '',
         pdfAsQualifiedlySigningServer: 'https://test',
         hiddenActivities: [],
+        enableAnnotations: true,
     };
 } else {
     console.error(`Unknown build environment: '${appEnv}', use one of '${Object.keys(appConfig)}'`);
@@ -134,7 +135,8 @@ export default (async () => {
             CSP: config.CSP,
             matomoUrl: config.matomoUrl,
             matomoSiteId: config.matomoSiteId,
-            buildInfo: getBuildInfo(appEnv)
+            buildInfo: getBuildInfo(appEnv),
+            enableAnnotations: config.enableAnnotations,
           }
         }),
         resolve({
-- 
GitLab