diff --git a/chrome/manifest.json b/chrome/manifest.json index cd68ebf..869cebd 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "imoin WebExtensions", - "version": "17.0.1", + "version": "17.1.0", "description": "Monitor your icinga or nagios instance.", diff --git a/electron/package.json b/electron/package.json index f9ad2c6..71076da 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { "name": "Imoin", - "version": "17.0.1", + "version": "17.1.0", "description": "Monitor Icinga on your desktop", "main": "requireInitElectron.js", "scripts": { diff --git a/firefox/manifest.json b/firefox/manifest.json index 6a9ab69..21adffb 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "imoin WebExtensions", - "version": "17.0.1", + "version": "17.1.0", "description": "Monitor your icinga or nagios instance.", diff --git a/gulpfile.js b/gulpfile.js index eac53d5..f961309 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -139,7 +139,7 @@ gulp.task('chrome-package', [ .pipe(gulp.dest(targetpaths.target + '/artifacts/')); }); -// bump versions on package/bower/manifest +// bump versions on package/manifest gulp.task('bump', function () { // read version from package.json var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));; @@ -157,6 +157,24 @@ gulp.task('bump', function () { .pipe(gulp.dest('./')); }); +// bump versions on package/manifest +gulp.task('bump-minor', function () { + // read version from package.json + var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));; + // increment version + var newVer = semver.inc(pkg.version, 'minor'); + + return gulp.src([ + './chrome/manifest.json', + './firefox/manifest.json', + './electron/package.json', + './package.json'], { base: './' }) + .pipe(bump({ + version: newVer + })) + .pipe(gulp.dest('./')); +}); + gulp.task('clean-firefox', ['firefox-setpaths'], function () { return gulp.src(targetpaths.target, { read: false }) .pipe(clean()); diff --git a/package.json b/package.json index 10cfa2d..af0d262 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "imoin", - "version": "17.0.1", + "version": "17.1.0", "description": "Icinga/Nagios status display", "main": "", "scripts": { "test": "mocha -r ts-node/register test/**/*.ts", "bump-version": "gulp bump", + "bump-version-minor": "gulp bump-minor", "build:firefox": "gulp firefox", "build:chrome": "gulp chrome", "build:electron": "gulp electron", diff --git a/scripts/definitions/common-webextension/index.d.ts b/scripts/definitions/common-webextension/index.d.ts index 63a2d46..98aa35b 100644 --- a/scripts/definitions/common-webextension/index.d.ts +++ b/scripts/definitions/common-webextension/index.d.ts @@ -27,6 +27,7 @@ declare namespace WebExtension { } class Runtime { + onInstalled: InstalledEvent; onConnect: RuntimeEvent; connect(extensionId?: string, connectInfo? : {name?: string, includeTlsChannelId?: boolean}): Port; openOptionsPage(): void; @@ -37,6 +38,17 @@ declare namespace WebExtension { } + interface InstalledEventDetails { + id? : string; + previousVersion?: string; + reason: string; + temporary: boolean; + } + + class InstalledEvent { + addListener(callback: (details: InstalledEventDetails) => void): void; + } + class RuntimeEvent { addListener(callback: (message?: any, sender?: MessageSender, sendResponse?: (response: any) => void) => void): void; } diff --git a/scripts/firefox.ts b/scripts/firefox.ts index 38ad39d..a9bc3cc 100644 --- a/scripts/firefox.ts +++ b/scripts/firefox.ts @@ -18,6 +18,12 @@ export class Firefox extends AbstractWebExtensionsEnvironment { constructor() { super(); browser.runtime.onConnect.addListener(this.connected.bind(this)); + // temporary update notification + browser.runtime.onInstalled.addListener((details)=> { + if (details.reason === 'update') { + this.openWebPage('https://github.com/ErikWegner/imoin/releases/tag/17.1.0'); + } + }); } loadSettings(): Promise { diff --git a/scripts/icingaapi.ts b/scripts/icingaapi.ts index 059a84f..02132b3 100644 --- a/scripts/icingaapi.ts +++ b/scripts/icingaapi.ts @@ -35,7 +35,7 @@ export interface IServiceJsonData { export class IcingaApi extends AbstractMonitor { handleUICommand(param: UICommand): void { if (param.command == "recheck") { - let url = this.settings.url + "/api/v1/actions/reschedule-check"; + let url = this.settings.url + "/v1/actions/reschedule-check"; let data = { type: "Host", force_check: true, @@ -53,8 +53,8 @@ export class IcingaApi extends AbstractMonitor { fetchStatus(): Promise { return new Promise( (resolve, reject) => { - const hosturl = this.settings.url + "/api/v1/objects/hosts?attrs=display_name&attrs=last_check_result"; - const servicesurl = this.settings.url + "/api/v1/objects/services?attrs=display_name&attrs=last_check_result"; + const hosturl = this.settings.url + "/v1/objects/hosts?attrs=display_name&attrs=last_check_result"; + const servicesurl = this.settings.url + "/v1/objects/services?attrs=display_name&attrs=last_check_result"; const hostsrequest = this.environment.load(hosturl, this.settings.username, this.settings.password); const servicesrequest = this.environment.load(servicesurl, this.settings.username, this.settings.password); @@ -68,7 +68,13 @@ export class IcingaApi extends AbstractMonitor { resolve(m); }) .catch(a => { - resolve(Monitor.ErrorMonitorData("Connection error. Check settings and log. " + a[0] + "|" + a[1])); + let msg = "Connection error: "; + if (typeof a === "string") { + msg += a; + } else { + msg += 'Check settings and log.'; + } + resolve(Monitor.ErrorMonitorData(msg)); }) } ); diff --git a/webpack.config.js b/webpack.config.js index 1b83ab6..85b25a4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,7 +21,7 @@ module.exports = { }, // Source maps support ('inline-source-map' also works) - devtool: 'source-map', + devtool: 'inline-source-map', // Add the loader for .ts files. module: {