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

added option for download url prefix #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion bin/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var myNuts = nuts.Nuts({
timeout: process.env.VERSIONS_TIMEOUT,
cache: process.env.VERSIONS_CACHE,
refreshSecret: process.env.GITHUB_SECRET,
proxyAssets: !Boolean(process.env.DONT_PROXY_ASSETS)
proxyAssets: !Boolean(process.env.DONT_PROXY_ASSETS),
prefixUrl: process.env.PREFIX_URL
});

// Control access to API
Expand Down
8 changes: 4 additions & 4 deletions lib/nuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ var platforms = require('./utils/platforms');
var winReleases = require('./utils/win-releases');
var API_METHODS = require('./api');

function getFullUrl(req) {
return req.protocol + '://' + req.get('host') + req.originalUrl;
function getFullUrl(opts, req) {
return req.protocol + '://' + req.get('host') + opts.prefixUrl + req.originalUrl;
}

function Nuts(opts) {
Expand Down Expand Up @@ -210,7 +210,7 @@ Nuts.prototype.onUpdateRedirect = function(req, res, next) {
// Updater used by OSX (Squirrel.Mac) and others
Nuts.prototype.onUpdate = function(req, res, next) {
var that = this;
var fullUrl = getFullUrl(req);
var fullUrl = getFullUrl(that.opts, req);
var platform = req.params.platform;
var channel = req.params.channel || '*';
var tag = req.params.version;
Expand Down Expand Up @@ -256,7 +256,7 @@ Nuts.prototype.onUpdate = function(req, res, next) {
Nuts.prototype.onUpdateWin = function(req, res, next) {
var that = this;

var fullUrl = getFullUrl(req);
var fullUrl = getFullUrl(that.opts, req);
var platform = 'win_32';
var channel = req.params.channel || '*';
var tag = req.params.version;
Expand Down