You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1018 B
32 lines
1018 B
2 years ago
|
import { updateURLLink } from './common.js';
|
||
|
import * as bbMonitor from './monitor-bb.js';
|
||
|
import * as bbSdMonitor from './monitor-bb-sd.js';
|
||
|
import * as rpiMonitor from './monitor-rpi.js';
|
||
|
import * as ubuntuServerMonitor from './monitor-ub-server.js';
|
||
|
import * as raspbianOsMonitor from './monitor-raspbian-os.js';
|
||
|
|
||
|
const monitors = {
|
||
|
bbMonitor,
|
||
|
bbSdMonitor,
|
||
|
rpiMonitor,
|
||
|
ubuntuServerMonitor,
|
||
|
raspbianOsMonitor
|
||
|
};
|
||
|
|
||
|
Object.entries(monitors).map(async ([monitorName, { checkForUpdates, determineCurrentState, target, updateReference }]) => {
|
||
|
console.log(`${monitorName}: starting`);
|
||
|
// Read the input file, and parse the variable input
|
||
|
const state = await determineCurrentState();
|
||
|
const result = await checkForUpdates(state);
|
||
|
if (!result) {
|
||
|
console.log(`${monitorName}: no updates found`);
|
||
|
return;
|
||
|
}
|
||
|
console.log(`${monitorName}: We've got a new release! \\o/`);
|
||
|
if (updateReference) {
|
||
|
await updateReference(result);
|
||
|
return;
|
||
|
}
|
||
|
await updateURLLink({ ...result, target });
|
||
|
});
|