diff options
-rw-r--r-- | .eslintrc.js | 2 | ||||
-rw-r--r-- | lib/Controller/PageController.php | 24 | ||||
-rw-r--r-- | src/main.js | 2 | ||||
-rw-r--r-- | src/views/Contacts.vue | 2 | ||||
-rw-r--r-- | webpack.common.js | 5 |
5 files changed, 8 insertions, 27 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index 998e3f23..79f26b51 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { }, globals: { oc_config: true, - oca_contacts: true, + appVersion: true, n: true, t: true, OC: true, diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 9fc2b28e..d0274101 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -25,25 +25,17 @@ namespace OCA\Contacts\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; -use OCP\IConfig; use OCP\IRequest; class PageController extends Controller { protected $appName; - /** - * @var IConfig - */ - private $config; - public function __construct(string $AppName, - IRequest $request, - IConfig $config) { + IRequest $request) { parent::__construct($AppName, $request); $this->appName = $AppName; - $this->config = $config; } /** @@ -53,20 +45,6 @@ class PageController extends Controller { * Default routing */ public function index(): TemplateResponse { - \OCP\Util::connectHook('\OCP\Config', 'js', $this, 'addJavaScriptVariablesForIndex'); return new TemplateResponse('contacts', 'main'); // templates/main.php } - - /** - * add parameters to javascript for user sites - * - * @param array $array - */ - public function addJavaScriptVariablesForIndex(array $array) { - $appversion = $this->config->getAppValue($this->appName, 'installed_version'); - - $array['array']['oca_contacts'] = \json_encode([ - 'versionstring' => $appversion, - ]); - } } diff --git a/src/main.js b/src/main.js index c65c3684..53e1e9a9 100644 --- a/src/main.js +++ b/src/main.js @@ -56,7 +56,7 @@ sync(store, router) Vue.prototype.t = t Vue.prototype.n = n // eslint-disable-next-line -Vue.prototype.oca_contacts = oca_contacts +Vue.prototype.appVersion = appVersion // eslint-disable-next-line Vue.prototype.oc_config = oc_config Vue.prototype.OC = OC diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 5e6d31de..d540c2d6 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -298,7 +298,7 @@ export default { const contact = new Contact(` BEGIN:VCARD VERSION:4.0 - PRODID:-//Nextcloud Contacts v${oca_contacts.versionstring} + PRODID:-//Nextcloud Contacts v${appVersion} END:VCARD `.trim().replace(/\t/gm, ''), this.defaultAddressbook) diff --git a/webpack.common.js b/webpack.common.js index 80c655a4..7c4d6a5b 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -44,7 +44,10 @@ module.exports = { plugins: [ new VueLoaderPlugin(), new StyleLintPlugin(), - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + new webpack.DefinePlugin({ + appVersion: JSON.stringify(require('./package.json').version) + }) ], resolve: { alias: { |