You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.requiredOption("--vapidkey",`vapid key, you can use notify generate to generate a new one - warning a new key means that clients need to subscribe to it again!`)
24
-
.requiredOption("--sub",`Set the vapid subscription information (email of the owner of the site)`,validateEmail)
25
-
// .option("-s --store", `Store messages, so clients can request past messages that might be lost when device is not online for a long time.`, Boolean)
26
-
.option("-c --cors",`Enable CORS`,Boolean)
27
-
.option("-f --frontend",`if set the frontend will be served (this needs to point to the build directory of the frontend)`,undefined,'./frontend/build')
28
-
.option("--sendkey",`Set the api key (for sending a new request)`,String)
29
-
.option("--loginkey",`Set the api key (for login into the ui)`,String)
30
-
.option("-p --port",`Set the api url (for this request)`,validatePort,8787)
31
-
.action(async(ctx: Denomander)=>
32
-
awaitserve({
33
-
port: Number(ctx.port),
34
-
sub: ctx.sub,
35
-
vapidKey: ctx.vapidkey,
36
-
cors: ctx.cors,
37
-
frontend: ctx.frontend,
38
-
sendkey: ctx.sendkey,
39
-
loginkey: ctx.loginkey,
40
-
}));
22
+
.command('run','Run the server')
23
+
.requiredOption("--vapidkey",`vapid key, you can use notify generate to generate a new one - warning a new key means that clients need to subscribe to it again!`)
24
+
.requiredOption("--sub",`Set the vapid subscription information (email of the owner of the site)`,validateEmail)
25
+
// .option("-s --store", `Store messages, so clients can request past messages that might be lost when device is not online for a long time.`, Boolean)
26
+
.option("-c --cors",`Enable CORS`,Boolean)
27
+
.option("-f --frontend",`if set the frontend will be served (this needs to point to the build directory of the frontend)`,undefined,'./frontend/build')
28
+
.option("--sendkey",`Set the api key (for sending a new request)`,String)
29
+
.option("--loginkey",`Set the api key (for login into the ui)`,String)
30
+
.option("-p --port",`Set the api url (for this request)`,validatePort,8787)
31
+
.action(async(ctx: Denomander)=>
32
+
awaitserve({
33
+
port: Number(ctx.port),
34
+
sub: ctx.sub,
35
+
vapidKey: ctx.vapidkey,
36
+
cors: ctx.cors,
37
+
frontend: ctx.frontend,
38
+
sendkey: ctx.sendkey,
39
+
loginkey: ctx.loginkey,
40
+
}));
41
41
42
42
43
43
program.
44
-
command('generate','Generate a new vapid key')
45
-
.action(async()=>{
46
-
constvapidKey=awaitgenerateVapidKey();
47
-
console.log(vapidKey);
48
-
});
44
+
command('generate','Generate a new vapid key')
45
+
.action(async()=>{
46
+
constvapidKey=awaitgenerateVapidKey();
47
+
console.log(vapidKey);
48
+
});
49
49
50
50
program.
51
-
command('notify','Send a test notification to all clients')
52
-
.requiredOption("-t --title",`Set the title of the notification`,String)
53
-
.requiredOption("-m --message",`Set the body of the notification`,String)
54
-
.option("-i --icon",`Set the icon of the notification`,String)
55
-
.option("-t --tags",`Comma separated list of all tags`,String)
56
-
.option("-r --remote",`Set the remote url of the notification`,String,'http://localhost:8787')
57
-
.option("-k --key",`Set the api key (for this request)`,String)
58
-
.action(async(ctx: Denomander)=>{
59
-
awaitnotify(ctx.remote,{
60
-
title: ctx.title,
61
-
message: ctx.message,
62
-
iconUrl: ctx.icon,
63
-
tags: ctx.tags ? ctx.tags.split(',') : [],
64
-
},ctx.key);
65
-
console.log('Notification sent');
66
-
});
51
+
command('notify','Send a test notification to all clients')
52
+
.requiredOption("-t --title",`Set the title of the notification`,String)
53
+
.requiredOption("-m --message",`Set the body of the notification`,String)
54
+
.option("-i --icon",`Set the icon of the notification`,String)
55
+
.option("-t --tags",`Comma separated list of all tags`,String)
56
+
.option("-r --remote",`Set the remote url of the notification`,String,'http://localhost:8787')
57
+
.option("-k --key",`Set the api key (for this request)`,String)
0 commit comments