homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
144 lines • 6.18 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { Controller, Get, Inject, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { ChildBridgesService } from '../child-bridges/child-bridges.service.js';
import { StatusService } from './status.service.js';
let StatusController = class StatusController {
statusService;
childBridgesService;
constructor(statusService, childBridgesService) {
this.statusService = statusService;
this.childBridgesService = childBridgesService;
}
getServerCpuInfo() {
return this.statusService.getServerCpuInfo();
}
getServerMemoryInfo() {
return this.statusService.getServerMemoryInfo();
}
getServerNetworkInfo() {
return this.statusService.getCurrentNetworkUsage();
}
getServerUptimeInfo() {
return this.statusService.getServerUptimeInfo();
}
async checkHomebridgeStatus() {
return {
status: await this.statusService.checkHomebridgeStatus(),
};
}
async getChildBridges() {
return this.childBridgesService.getChildBridges();
}
async getHomebridgeVersion() {
return this.statusService.getHomebridgeVersion();
}
async getHomebridgeServerInfo() {
return this.statusService.getHomebridgeServerInfo();
}
async getNodeVersionInfo() {
return this.statusService.getNodeVersionInfo();
}
async getRaspberryPiThrottledStatus() {
return this.statusService.getRaspberryPiThrottledStatus();
}
};
__decorate([
ApiOperation({ summary: 'Return the current CPU load, load history and temperature (if available).' }),
Get('/cpu'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusController.prototype, "getServerCpuInfo", null);
__decorate([
ApiOperation({ summary: 'Return total memory, memory usage, and memory usage history in bytes.' }),
Get('/ram'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusController.prototype, "getServerMemoryInfo", null);
__decorate([
ApiOperation({ summary: 'Returns the current transmitted and received bytes per second.' }),
Get('/network'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusController.prototype, "getServerNetworkInfo", null);
__decorate([
ApiOperation({ summary: 'Return the host and process (UI) uptime.' }),
Get('/uptime'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusController.prototype, "getServerUptimeInfo", null);
__decorate([
ApiOperation({
summary: 'Return the current Homebridge status.',
description: 'Possible Homebridge statuses are `up`, `pending` or `down`.',
}),
Get('/homebridge'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "checkHomebridgeStatus", null);
__decorate([
ApiOperation({
summary: 'Return an array of the active child bridges and their status.',
}),
Get('/homebridge/child-bridges'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "getChildBridges", null);
__decorate([
ApiOperation({ summary: 'Return the current Homebridge version and package information.' }),
Get('/homebridge-version'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "getHomebridgeVersion", null);
__decorate([
ApiOperation({ summary: 'Return general information about the host environment.' }),
Get('/server-information'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "getHomebridgeServerInfo", null);
__decorate([
ApiOperation({ summary: 'Return current Node.js version and update availability information.' }),
Get('/nodejs'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "getNodeVersionInfo", null);
__decorate([
ApiOperation({ summary: 'Returns throttled status for Raspberry Pi.' }),
Get('/rpi/throttled'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusController.prototype, "getRaspberryPiThrottledStatus", null);
StatusController = __decorate([
ApiTags('Server Status'),
ApiBearerAuth(),
UseGuards(AuthGuard()),
Controller('status'),
__param(0, Inject(StatusService)),
__param(1, Inject(ChildBridgesService)),
__metadata("design:paramtypes", [StatusService,
ChildBridgesService])
], StatusController);
export { StatusController };
//# sourceMappingURL=status.controller.js.map