homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
96 lines • 4.46 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 { Body, Controller, Get, Inject, Put, Query, Request, UseGuards, } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
import { AdminGuard } from '../../../core/auth/guards/admin.guard.js';
import { HbServiceStartupSettings } from './hb-service.dto.js';
import { HbServiceService } from './hb-service.service.js';
let HbServiceController = class HbServiceController {
hbServiceService;
constructor(hbServiceService) {
this.hbServiceService = hbServiceService;
}
getHomebridgeStartupSettings() {
return this.hbServiceService.getHomebridgeStartupSettings();
}
setHomebridgeStartupSettings(body) {
return this.hbServiceService.setHomebridgeStartupSettings(body);
}
setFullServiceRestartFlag() {
return this.hbServiceService.setFullServiceRestartFlag();
}
downloadLogFile(colour) {
return this.hbServiceService.downloadLogFile((colour !== 'yes'));
}
truncateLogFile(req) {
return this.hbServiceService.truncateLogFile(req.user.username);
}
};
__decorate([
UseGuards(AdminGuard),
ApiOperation({ summary: 'Return the startup flags and env variables for Homebridge.' }),
Get('homebridge-startup-settings'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], HbServiceController.prototype, "getHomebridgeStartupSettings", null);
__decorate([
UseGuards(AdminGuard),
ApiOperation({ summary: 'Update the startup flags and env variables for Homebridge.' }),
Put('homebridge-startup-settings'),
__param(0, Body()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [HbServiceStartupSettings]),
__metadata("design:returntype", void 0)
], HbServiceController.prototype, "setHomebridgeStartupSettings", null);
__decorate([
UseGuards(AdminGuard),
ApiOperation({
summary: 'Request the UI does a full restart next time a restart for Homebridge is sent.',
description: 'The UI will only restart if it detects it needs to.',
}),
Put('set-full-service-restart-flag'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], HbServiceController.prototype, "setFullServiceRestartFlag", null);
__decorate([
UseGuards(AdminGuard),
ApiOperation({ summary: 'Download the entire log file.' }),
Get('log/download'),
ApiQuery({ name: 'colour', enum: ['yes', 'no'], required: false }),
__param(0, Query('colour')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], HbServiceController.prototype, "downloadLogFile", null);
__decorate([
UseGuards(AdminGuard),
ApiOperation({ summary: 'Truncate/empty the log file.' }),
Put('log/truncate'),
__param(0, Request()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], HbServiceController.prototype, "truncateLogFile", null);
HbServiceController = __decorate([
ApiTags('Platform - HB Service'),
ApiBearerAuth(),
UseGuards(AuthGuard()),
Controller('platform-tools/hb-service'),
__param(0, Inject(HbServiceService)),
__metadata("design:paramtypes", [HbServiceService])
], HbServiceController);
export { HbServiceController };
//# sourceMappingURL=hb-service.controller.js.map