diff --git a/README.md b/README.md index d2de762..99d4335 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ With [npm](http://npmjs.org) do: * `init ( opc )` * `pathToJson: ''` from repo main folder to package.json (only subfolders. Can't go backwards) - * `async: true` Currently not sync supported. - * `silent: false` Does not trigger events * `autoupdate: false` if true, all stages run one after the other. Else, you need to force the stages with the force methods * `check_git: true` Checks if the .git folder exists, so its a dev and doesnt download the proyect. + * `jsonhost: 'raw.githubusercontent.com'` URL of raw remote package.json + * `contenthost: 'codeload.github.com'` URL of full remote zip * `on ( event, callback )` Sets the events diff --git a/auto-updater.js b/auto-updater.js index c6ed2d7..93744db 100644 --- a/auto-updater.js +++ b/auto-updater.js @@ -41,6 +41,18 @@ module.exports = function(config) { * @default false */ this.opt.check_git = (options.check_git) ? true : false; + /** + * @attribute jsonhost + * @type {String} + * @default 'raw.githubusercontent.com' + */ + this.opt.jsonhost = options.jsonhost || 'raw.githubusercontent.com'; + /** + * @attribute contenthost + * @type {String} + * @default 'codeload.github.com' + */ + this.opt.contenthost = options.contenthost || 'codeload.github.com'; }; /** @@ -66,7 +78,7 @@ module.exports = function(config) { AutoUpdater.forceDownloadUpdate = function() { var self = this; this._remoteDownloadUpdate(this.updateName, { - host: 'codeload.github.com', + host: this.opt.contenthost, path: this.jsons.client['auto-updater'].repo + '/zip/' + this.jsons.client['auto-updater'].branch }, function(existed) { @@ -141,7 +153,7 @@ module.exports = function(config) { this._remoteDownloader({ - host: 'raw.githubusercontent.com', + host: this.opt.jsonhost, path: path }, function(data) { self.jsons.remote = JSON.parse(data); diff --git a/package.json b/package.json index 1c14e07..523a113 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "auto-updater", "description": "Automatically updates your client version when is outdated by the repository", - "version": "0.0.7", + "version": "0.1.0", "author": { "name": "@Juampi_92", "url": "https://github.com/juampi92"