mirror of
https://github.com/unraid/api.git
synced 2026-05-07 15:40:33 -05:00
feat: get flash info
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* Copyright 2019-2021 Lime Technology Inc. All rights reserved.
|
||||
* Written by: Alexis Tyler
|
||||
*/
|
||||
|
||||
import { varState } from '../../states';
|
||||
import { CoreContext, CoreResult } from '../../types';
|
||||
import { ensurePermission } from '../../utils';
|
||||
|
||||
/**
|
||||
* Get server's flash info
|
||||
*
|
||||
* @memberof Core
|
||||
* @module info/get-flash
|
||||
*/
|
||||
export const getFlash = async function (context: CoreContext): Promise<CoreResult> {
|
||||
const { user } = context;
|
||||
|
||||
// Check permissions
|
||||
ensurePermission(user, {
|
||||
resource: 'flash',
|
||||
action: 'read',
|
||||
possession: 'any'
|
||||
});
|
||||
|
||||
// Get flash data
|
||||
const guid = varState.data.flashGuid;
|
||||
const product = varState.data.flashProduct;
|
||||
const vendor = varState.data.flashVendor;
|
||||
|
||||
return {
|
||||
get text() {
|
||||
return `GUID: ${guid}\nProduct: ${product}\nVendor: ${vendor}`;
|
||||
},
|
||||
get json() {
|
||||
return {
|
||||
guid,
|
||||
product,
|
||||
vendor
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user