homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
311 lines • 10.9 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 { Inject, UseGuards } from '@nestjs/common';
import { SubscribeMessage, WebSocketGateway, WsException } from '@nestjs/websockets';
import { WsGuard } from '../../core/auth/guards/ws.guard.js';
import { devServerCorsConfig } from '../../core/cors.config.js';
import { PluginsService } from '../plugins/plugins.service.js';
import { StatusService } from './status.service.js';
let StatusGateway = class StatusGateway {
statusService;
pluginsService;
constructor(statusService, pluginsService) {
this.statusService = statusService;
this.pluginsService = pluginsService;
}
async getDashboardLayout() {
try {
return await this.statusService.getDashboardLayout();
}
catch (e) {
return new WsException(e.message);
}
}
async getDashboardInit() {
try {
return await this.statusService.getDashboardInit();
}
catch (e) {
return new WsException(e.message);
}
}
async setDashboardLayout(client, payload) {
try {
return await this.statusService.setDashboardLayout(payload);
}
catch (e) {
return new WsException(e.message);
}
}
async homebridgeVersionCheck() {
try {
return await this.pluginsService.getHomebridgePackage();
}
catch (e) {
return new WsException(e.message);
}
}
async homebridgeUiVersionCheck() {
try {
return await this.pluginsService.getHomebridgeUiPackage();
}
catch (e) {
return new WsException(e.message);
}
}
async npmVersionCheck() {
try {
return await this.pluginsService.getNpmPackage();
}
catch (e) {
return new WsException(e.message);
}
}
async dockerVersionCheck() {
try {
return await this.statusService.getDockerDetails();
}
catch (e) {
return new WsException(e.message);
}
}
async nodeVersionCheck() {
try {
return await this.statusService.getNodeVersionInfo();
}
catch (e) {
return new WsException(e.message);
}
}
clearNodeJsVersionCache() {
this.statusService.clearNodeJsVersionCache();
return { success: true };
}
async getOutOfDatePlugins() {
try {
return await this.pluginsService.getOutOfDatePlugins();
}
catch (e) {
return new WsException(e.message);
}
}
async getVersionOverview() {
try {
return await this.statusService.getVersionOverview();
}
catch (e) {
return new WsException(e.message);
}
}
async getHomebridgeServerInfo() {
try {
return await this.statusService.getHomebridgeServerInfo();
}
catch (e) {
return new WsException(e.message);
}
}
async getServerCpuInfo() {
try {
return await this.statusService.getServerCpuInfo();
}
catch (e) {
return new WsException(e.message);
}
}
async getServerMemoryInfo() {
try {
return await this.statusService.getServerMemoryInfo();
}
catch (e) {
return new WsException(e.message);
}
}
async getServerNetworkInfo(client, payload) {
try {
return await this.statusService.getCurrentNetworkUsage(payload.netInterfaces || []);
}
catch (e) {
return new WsException(e.message);
}
}
async getServerUptimeInfo() {
try {
return await this.statusService.getServerUptimeInfo();
}
catch (e) {
return new WsException(e.message);
}
}
async getHomebridgePairingPin() {
try {
return await this.statusService.getHomebridgePairingPin();
}
catch (e) {
return new WsException(e.message);
}
}
async getHomebridgeStatus() {
try {
return await this.statusService.getHomebridgeStatus();
}
catch (e) {
return new WsException(e.message);
}
}
async serverStatus(client) {
this.statusService.watchStats(client);
}
async getRaspberryPiThrottledStatus() {
try {
return await this.statusService.getRaspberryPiThrottledStatus();
}
catch (e) {
return new WsException(e.message);
}
}
};
__decorate([
SubscribeMessage('get-dashboard-layout'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getDashboardLayout", null);
__decorate([
SubscribeMessage('get-dashboard-init'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getDashboardInit", null);
__decorate([
SubscribeMessage('set-dashboard-layout'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "setDashboardLayout", null);
__decorate([
SubscribeMessage('homebridge-version-check'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "homebridgeVersionCheck", null);
__decorate([
SubscribeMessage('homebridge-ui-version-check'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "homebridgeUiVersionCheck", null);
__decorate([
SubscribeMessage('npm-version-check'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "npmVersionCheck", null);
__decorate([
SubscribeMessage('docker-version-check'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "dockerVersionCheck", null);
__decorate([
SubscribeMessage('nodejs-version-check'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "nodeVersionCheck", null);
__decorate([
SubscribeMessage('clear-nodejs-version-cache'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusGateway.prototype, "clearNodeJsVersionCache", null);
__decorate([
SubscribeMessage('get-out-of-date-plugins'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getOutOfDatePlugins", null);
__decorate([
SubscribeMessage('get-version-overview'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getVersionOverview", null);
__decorate([
SubscribeMessage('get-homebridge-server-info'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getHomebridgeServerInfo", null);
__decorate([
SubscribeMessage('get-server-cpu-info'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getServerCpuInfo", null);
__decorate([
SubscribeMessage('get-server-memory-info'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getServerMemoryInfo", null);
__decorate([
SubscribeMessage('get-server-network-info'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getServerNetworkInfo", null);
__decorate([
SubscribeMessage('get-server-uptime-info'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getServerUptimeInfo", null);
__decorate([
SubscribeMessage('get-homebridge-pairing-pin'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getHomebridgePairingPin", null);
__decorate([
SubscribeMessage('get-homebridge-status'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getHomebridgeStatus", null);
__decorate([
SubscribeMessage('monitor-server-status'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "serverStatus", null);
__decorate([
SubscribeMessage('get-raspberry-pi-throttled-status'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], StatusGateway.prototype, "getRaspberryPiThrottledStatus", null);
StatusGateway = __decorate([
UseGuards(WsGuard),
WebSocketGateway({
namespace: 'status',
allowEIO3: true,
cors: devServerCorsConfig,
}),
__param(0, Inject(StatusService)),
__param(1, Inject(PluginsService)),
__metadata("design:paramtypes", [StatusService,
PluginsService])
], StatusGateway);
export { StatusGateway };
//# sourceMappingURL=status.gateway.js.map