mirror of
https://github.com/unraid/api.git
synced 2026-01-29 20:19:06 -06:00
29 lines
650 B
TypeScript
29 lines
650 B
TypeScript
/*!
|
|
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
|
|
* Written by: Alexis Tyler
|
|
*/
|
|
|
|
import { CoreResult, CoreContext } from '../../types';
|
|
import { ensurePermission, getMachineId as getMachineIdFromFile } from '../../utils';
|
|
|
|
/**
|
|
* Get the machine ID.
|
|
*/
|
|
export const getMachineId = async function (context: CoreContext): Promise<CoreResult> {
|
|
const { user } = context;
|
|
|
|
// Check permissions
|
|
ensurePermission(user, {
|
|
resource: 'machine-id',
|
|
action: 'read',
|
|
possession: 'any'
|
|
});
|
|
|
|
const machineId = getMachineIdFromFile();
|
|
|
|
return {
|
|
text: `Machine ID: ${JSON.stringify(machineId, null, 2)}`,
|
|
json: machineId
|
|
};
|
|
};
|