From 45292f33d5360c4e6f7219fd3c55ce313c61c501 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 3 Jul 2016 15:12:35 -0700 Subject: [PATCH] improvements to update checker --- app/hyperterm.js | 10 ++++++---- app/update-checker.js | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/hyperterm.js b/app/hyperterm.js index 517b3e9b..c3ea5241 100644 --- a/app/hyperterm.js +++ b/app/hyperterm.js @@ -22,7 +22,8 @@ export default class HyperTerm extends Component { activeMarkers: [], mac: /Mac/.test(navigator.userAgent), resizeIndicatorShowing: false, - updateVersion: null + updateVersion: null, + updateNote: null }; // we set this to true when the first tab @@ -89,7 +90,7 @@ export default class HyperTerm extends Component {
Update available ({ this.state.updateVersion }). - {' '} + {this.state.updateNote ? ` ${this.state.updateNote}. ` : ' '} Download
; @@ -231,8 +232,9 @@ export default class HyperTerm extends Component { term.clear(); } - onUpdateAvailable (updateVersion) { - this.setState({ updateVersion }); + onUpdateAvailable (updateVersion, updateNote = '') { + updateNote = updateNote.replace(/\.$/, ''); + this.setState({ updateVersion, updateNote }); } moveTo (n) { diff --git a/app/update-checker.js b/app/update-checker.js index 0e8a907b..393ae2ab 100644 --- a/app/update-checker.js +++ b/app/update-checker.js @@ -19,7 +19,7 @@ export default class UpdateChecker { }; console.log('checking for update'); - fetch('https://hyperterm.now.sh/data.json') + fetch('https://hyperterm.now.sh/updates.json') .then((res) => { if (200 !== res.status) { console.error('Update check error. Status (%d)', res.status); @@ -27,13 +27,13 @@ export default class UpdateChecker { } res.json() - .then(({ version }) => { + .then(({ version, note }) => { if (this.lastKnown !== version) { this.lastKnown = version; if (1 === compare(version, currentVersion)) { console.log('update found'); - this.callback(version); + this.callback(version, note); } else { console.log('no update. latest:', version); }