Skip to content

Commit

Permalink
Version/Update Check and Admin Page Style Fixes (#481)
Browse files Browse the repository at this point in the history
- Refactor version checking method to pull from version.txt and the latest release tag on git
- Fix Admin page sidebar styling issue where labels would go outside the sidebars background
- Version Bump v1.20.7
  • Loading branch information
RickyGrassmuck authored and lokenx committed Jun 30, 2017
1 parent 1ca69e3 commit 9be2f1c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
4 changes: 4 additions & 0 deletions client/lib/stylesheets/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
padding-bottom: 2em;
}

.admin-sidebar {
width: auto;
}

#at-btn, #at-nav-button {
background-color: transparent;
border: 1px solid #ccc;
Expand Down
2 changes: 1 addition & 1 deletion client/templates/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>Admin</h1>

{{#if currentUser}}
<div class="row settings">
<div class="col-md-2 col-md-offset-1">
<div class="col-md-2 col-md-offset-1 admin-sidebar">
<ul class="list-group settings-options">
<a href="#"><li class="list-group-item active">General</li></a>
<a href="#"><li class="list-group-item">Authentication</li></a>
Expand Down
33 changes: 13 additions & 20 deletions server/methods/admin/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,24 @@ Meteor.methods({
},

getVersion: function () {
return "1.20.6";
// parse the version.txt file and return the contents
var fs = Npm.require('fs');
return 'v' + fs.readFileSync(process.env.PWD + '/version.txt','utf8');
},

checkForUpdate : function () {
var branch = Meteor.call('getBranch');
var currentVersion = Meteor.call('getVersion');
// Only the master branch is versioned and has tagged releases
if (Meteor.call('getBranch') === "master") {
try {
var latestJson = HTTP.call("GET", "https://api.github.com/repos/lokenx/plexrequests-meteor/releases/latest", {headers: {"User-Agent": "Plexrequests/" + currentVersion}});
}
catch (err) {
logger.info("Error checking for update: " + err);
return false;
}

try {
var latestJson = HTTP.call("GET","https://api.github.com/repos/lokenx/plexrequests-meteor/contents/version.txt?ref=" + branch,{headers: {"User-Agent": "Meteor/1.1"}});
}
catch (err) {
logger.log("Error checking for update: " + err);
return false;
}

var latestJson64 = latestJson['data']['content'];
var latestVersion64 = new Buffer(latestJson64, "base64").toString();
var latestVersion = latestVersion64.slice(0, - 1);

if (latestVersion != currentVersion) {
logger.info("New update available");
return true;
} else {
return false
return (latestJson.data.tag_name !== currentVersion);
}
}

});
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.6
1.20.7

0 comments on commit 9be2f1c

Please sign in to comment.