mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Add status update source
This commit is contained in:
parent
90b520c444
commit
059799164d
|
|
@ -194,6 +194,13 @@ export async function init() {
|
|||
app.setAppUserModelId('uk.org.fancy.nxapi.app');
|
||||
}
|
||||
|
||||
import('../../common/remote-config.js').then(m => {
|
||||
if (!m.default.status_update_url) return;
|
||||
appinstance.statusupdates.addSource(m.default.status_update_url);
|
||||
}).catch(err => {
|
||||
debug('error adding status update source from remote config', err);
|
||||
});
|
||||
|
||||
appinstance.statusupdates.subscribe({
|
||||
onUpdate: data => sendToAllWindows('nxapi:statusupdates', data),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ export function builder(yargs: Argv<ParentArguments>) {
|
|||
return yargs.option('url', {
|
||||
describe: 'Additional status update source',
|
||||
type: 'array',
|
||||
}).option('use-config', {
|
||||
describe: 'Use the status update source from nxapi\'s remote configuration',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
}).option('json', {
|
||||
describe: 'Output raw JSON',
|
||||
type: 'boolean',
|
||||
|
|
@ -24,10 +28,13 @@ export function builder(yargs: Argv<ParentArguments>) {
|
|||
type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
||||
export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
||||
// const { default: config } = await import('../../common/remote-config.js');
|
||||
|
||||
const status = new StatusUpdateMonitor();
|
||||
|
||||
if (argv.useConfig) {
|
||||
const { default: config } = await import('../../common/remote-config.js');
|
||||
if (config.status_update_url) status.addSource(config.status_update_url);
|
||||
}
|
||||
|
||||
for (const url of argv.url ?? []) {
|
||||
status.addSource(url.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@ export interface NxapiRemoteConfig {
|
|||
*/
|
||||
require_version: string[];
|
||||
|
||||
status_update_url?: string;
|
||||
log_encryption_key?: string;
|
||||
|
||||
// If null the API should not be used
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user