From 289742a7b5c117fa92429fdffb3d7244aa3a4cf2 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Wed, 8 Jun 2016 15:10:56 -0700 Subject: [PATCH] Check for Ghost Desktop manual update If the user is running a version of Ghost Desktop that requires a manual update, we display a little warning message referring to a blog post on dev.ghost.org. --- ghost/admin/app/routes/application.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ghost/admin/app/routes/application.js b/ghost/admin/app/routes/application.js index 83dcfbb30a..bb3d9596d6 100644 --- a/ghost/admin/app/routes/application.js +++ b/ghost/admin/app/routes/application.js @@ -96,6 +96,7 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, { signedIn() { this.get('notifications').clearAll(); this.send('loadServerNotifications', true); + this.send('checkForOutdatedDesktopApp'); }, invalidateSession() { @@ -122,6 +123,26 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, { } }, + checkForOutdatedDesktopApp() { + // Check if the user is running an older version of Ghost Desktop + // that needs to be manually updated + // (yes, the desktop team is deeply ashamed of these lines 😢) + let ua = navigator && navigator.userAgent ? navigator.userAgent : null; + + if (ua && ua.includes && ua.includes('ghost-desktop')) { + let updateCheck = /ghost-desktop\/0\.((5\.0)|((4|2)\.0)|((3\.)(0|1)))/; + let link = 'click here'; + let msg = `Your version of Ghost Desktop needs to be manually updated. Please ${link} to get started.`; + + if (updateCheck.test(ua)) { + this.get('notifications').showAlert(msg.htmlSafe(), { + type: 'upgrade', + key: 'desktop.manual.upgrade' + }); + } + } + }, + toggleMarkdownHelpModal() { this.get('controller').toggleProperty('showMarkdownHelpModal'); },