Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use package.json version instead of info.xml #1010

Merged
merged 1 commit into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
oc_config: true,
oca_contacts: true,
appVersion: true,
n: true,
t: true,
OC: true,
Expand Down
24 changes: 1 addition & 23 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,17 @@

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;
}

/**
Expand All @@ -53,20 +45,6 @@ public function __construct(string $AppName,
* 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,
]);
}
}
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/views/Contacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down