mirror of
https://github.com/peter-tanner/spacex-cli.git
synced 2024-11-30 11:00:15 +08:00
FIX: make notifications work when using in wsl
This commit is contained in:
parent
55d8b738a0
commit
8d32117d0e
|
@ -51,3 +51,4 @@ You can also view the differences (which includes data not in the table) in JSON
|
|||
| 2021-01-08 | 1.0.0 | Initial release. |
|
||||
| 2021-02-07 | 1.0.1 | Fix bug with diff where undefined cells would cause an error. |
|
||||
| 2021-02-16 | 1.0.2 | Added temp/placeholder icon to fix notifications. Remember to add your own icon (not including originals to prevent trademark infringement) |
|
||||
| 2021-04-23 | 1.0.3 | Fixed notifications on WSL due to unix-style paths not working as an argument on Windows with node-notifier |
|
|
@ -3,6 +3,7 @@ const clc = require('cli-color');
|
|||
const notifier = require('node-notifier');
|
||||
const Diff = require('diff');
|
||||
const path = require('path');
|
||||
const isWsl = require('is-wsl');
|
||||
|
||||
const arguments = require('./tools/process-args').arguments;
|
||||
const cli_elem = require('./tools/cli-elements'); //Idk js package structure/conventions...
|
||||
|
@ -50,6 +51,11 @@ const ARCHIVE = arguments.archive;
|
|||
var notified_1h = [];
|
||||
var notifying_1h = [];
|
||||
|
||||
var ICON_PATH = path.join(__dirname, 'spacex.ico');
|
||||
if (isWsl && ICON_PATH.startsWith("/mnt/",0)) {
|
||||
ICON_PATH = ICON_PATH.substr(5).replace("/",":/");
|
||||
}
|
||||
|
||||
function selectData(arr) {
|
||||
const LUNCHPADS_RESP = arr[0];
|
||||
const LUNCHES_RESP = arr[1];
|
||||
|
@ -293,7 +299,7 @@ async function main() {
|
|||
notifier.notify({
|
||||
title: STRING.H_WARNING,
|
||||
message: notifying_1h.join(' │ '),
|
||||
icon: path.join(__dirname, 'spacex.ico'),
|
||||
icon: ICON_PATH,
|
||||
appID: STRING.APPID
|
||||
});
|
||||
notifying_1h = [];
|
||||
|
@ -373,7 +379,7 @@ async function main() {
|
|||
notifier.notify({
|
||||
title: STRING.NEW_DATA,
|
||||
message: 'Press d to see table diff. Press j to see JSON diff.',
|
||||
icon: path.join(__dirname, 'spacex.ico'),
|
||||
icon: ICON_PATH,
|
||||
appID: STRING.APPID
|
||||
});
|
||||
net_tools.writeFile(path_prev_launches, JSON.stringify(curr_launches));
|
||||
|
|
Loading…
Reference in New Issue
Block a user