Browse Source

Use the version number when checking the appstore for compatible updates

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/12358/head
Joas Schilling 7 years ago
parent
commit
b04a44babd
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 2
      apps/updatenotification/js/updatenotification.js
  2. 2
      apps/updatenotification/js/updatenotification.js.map
  3. 2
      apps/updatenotification/lib/Command/Check.php
  4. 3
      apps/updatenotification/lib/Settings/Admin.php
  5. 5
      apps/updatenotification/lib/UpdateChecker.php
  6. 11
      apps/updatenotification/src/components/root.vue

2
apps/updatenotification/js/updatenotification.js
File diff suppressed because it is too large
View File

2
apps/updatenotification/js/updatenotification.js.map
File diff suppressed because it is too large
View File

2
apps/updatenotification/lib/Command/Check.php

@ -67,7 +67,7 @@ class Check extends Command {
// Server
$r = $this->updateChecker->getUpdateState();
if (isset($r['updateAvailable']) && $r['updateAvailable']) {
$output->writeln($r['updateVersion'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
$output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
$updatesAvailableCount += 1;
}

3
apps/updatenotification/lib/Settings/Admin.php

@ -97,7 +97,8 @@ class Admin implements ISettings {
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
'newVersion' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
'newVersionString' => empty($updateState['updateVersionString']) ? '' : $updateState['updateVersionString'],
'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
'changes' => $this->filterChanges($updateState['changes'] ?? []),
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],

5
apps/updatenotification/lib/UpdateChecker.php

@ -51,7 +51,8 @@ class UpdateChecker {
if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
$result['updateAvailable'] = true;
$result['updateVersion'] = $data['versionstring'];
$result['updateVersion'] = $data['version'];
$result['updateVersionString'] = $data['versionstring'];
$result['updaterEnabled'] = $data['autoupdater'] === '1';
$result['versionIsEol'] = $data['eol'] === '1';
if (strpos($data['web'], 'https://') === 0) {
@ -80,7 +81,7 @@ class UpdateChecker {
public function populateJavaScriptVariables(array $data) {
$data['array']['oc_updateState'] = json_encode([
'updateAvailable' => true,
'updateVersion' => $this->getUpdateState()['updateVersion'],
'updateVersion' => $this->getUpdateState()['updateVersionString'],
'updateLink' => $this->getUpdateState()['updateLink'] ?? '',
]);
}

11
apps/updatenotification/src/components/root.vue

@ -156,7 +156,7 @@
}
$.ajax({
url: OC.linkToOCS('apps/updatenotification/api/v1/applist', 2) + this.newVersionString,
url: OC.linkToOCS('apps/updatenotification/api/v1/applist', 2) + this.newVersion,
type: 'GET',
beforeSend: function (request) {
request.setRequestHeader('Accept', 'application/json');
@ -196,20 +196,18 @@
return t('updatenotification', 'Checking apps for compatible updates');
}
if (this.appstoreDisabled) {
if (this.appStoreDisabled) {
return t('updatenotification', 'Please make sure your config.php does not set <samp>appstoreenabled</samp> to false.');
}
if (this.appstoreFailed) {
if (this.appStoreFailed) {
return t('updatenotification', 'Could not connect to the appstore or the appstore returned no updates at all. Search manually for updates or make sure your server has access to the internet and can connect to the appstore.');
}
return this.missingAppUpdates.length === 0 ? t('updatenotification', '<strong>All</strong> apps have an update for this version available', this) : n('updatenotification',
'<strong>%n</strong> app has no update for this version available',
'<strong>%n</strong> apps have no update for this version available',
this.missingAppUpdates.length, {
version: this.newVersionString
});
this.missingAppUpdates.length);
},
productionInfoString: function() {
@ -313,6 +311,7 @@
// Parse server data
var data = JSON.parse($('#updatenotification').attr('data-json'));
this.newVersion = data.newVersion;
this.newVersionString = data.newVersionString;
this.lastCheckedDate = data.lastChecked;
this.isUpdateChecked = data.isUpdateChecked;

Loading…
Cancel
Save