mirror of
https://github.com/unraid/api.git
synced 2026-05-18 06:29:40 -05:00
feat: enable os uptime
This commit is contained in:
@@ -27,6 +27,7 @@ export * from './get-permissions';
|
||||
export * from './get-plugins';
|
||||
export * from './get-services';
|
||||
export * from './get-unassigned-devices';
|
||||
export * from './get-uptime';
|
||||
export * from './get-users';
|
||||
export * from './get-vars';
|
||||
export * from './get-welcome';
|
||||
|
||||
+10
-1
@@ -344,17 +344,26 @@ dee.on('*', async (data: { Type: string }) => {
|
||||
|
||||
dee.listen();
|
||||
|
||||
// This needs to be fixed to run from events
|
||||
// @TODO: This needs to be fixed to run from events
|
||||
setIntervalAsync(async () => {
|
||||
// @todo: Create a system user for this
|
||||
const user = usersState.findOne({ name: 'root' });
|
||||
|
||||
// Services
|
||||
await run('services', 'UPDATED', {
|
||||
moduleToRun: modules.getServices,
|
||||
context: {
|
||||
user
|
||||
}
|
||||
});
|
||||
|
||||
// OS uptime
|
||||
await run('uptime', 'UPDATED', {
|
||||
moduleToRun: modules.getUptime,
|
||||
context: {
|
||||
user
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
export const graphql = {
|
||||
|
||||
@@ -51,6 +51,9 @@ export const Subscription = {
|
||||
unassignedDevices: {
|
||||
...createSubscription('devices/unassigned')
|
||||
},
|
||||
uptime: {
|
||||
...createSubscription('uptime')
|
||||
},
|
||||
users: {
|
||||
...createSubscription('users')
|
||||
},
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
type Query {
|
||||
uptime: Uptime @func(module: "getUptime")
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
uptime: Uptime
|
||||
}
|
||||
|
||||
type Uptime {
|
||||
milliseconds: Int!
|
||||
timestamp: String!
|
||||
}
|
||||
Reference in New Issue
Block a user