Skip to content

Commit

Permalink
final commit!
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Nov 11, 2023
1 parent ee8ae2c commit 553677f
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 75 deletions.
23 changes: 12 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
- This mimics the behaviour of updating Homebridge itself
- The option of 'Update Anyway' will still appear for other plugins when running an unsupported version of Node.js
- GLIBC Version is now cached
- When uninstalling a plugin, it will also be removed from the disabled plugin list if it was previously disabled

### UI Changes

#### General

- Fixed icon widths throughout UI
- Updated menu (thanks [mkz212](https://github.com/mkz212)!)
- Updated menu (thanks [@mkz212](https://github.com/mkz212)!)
- Added links to main dropdown menu: 'Logs' and 'Restart Homebridge' + reordered list
- Changed the menu layout order
- Made the dropdown darker in dark mode ([1660](https://github.com/homebridge/homebridge-config-ui-x/pull/1660))
- Made the dropdown darker in dark mode ([#1660](https://github.com/homebridge/homebridge-config-ui-x/pull/1660))
- Username is now displayed by logout Menu option

#### Status Page
Expand All @@ -31,7 +32,7 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
- Added alert icon and modal when running an older OS that cannot update to Node.js 18/20
- Added alert icon and modal when not running in service mode
- **Homebridge Widget**
- Added ability to scroll Homebridge widget ([1651](https://github.com/homebridge/homebridge-config-ui-x/pull/1651))
- Added ability to scroll Homebridge widget ([#1651](https://github.com/homebridge/homebridge-config-ui-x/pull/1651))
- 'Update available' icons are now up-arrows to match plugins page

#### Plugins Page
Expand Down Expand Up @@ -82,19 +83,19 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
- `plugins.manage.message_thanks_for_updating_restart`
- `plugins.donate.message_learn_more`
- `status.message_code_scan_instructions`
- **i18n:** Update pl.json ([1633](https://github.com/homebridge/homebridge-config-ui-x/pull/1633))
- **i18n:** Update fr.json ([1629](https://github.com/homebridge/homebridge-config-ui-x/pull/1629))
- **i18n:** Update es.json (Improves Spanish localization) ([1632](https://github.com/homebridge/homebridge-config-ui-x/pull/1632))
- **i18n:** Update pl.json ([#1633](https://github.com/homebridge/homebridge-config-ui-x/pull/1633))
- **i18n:** Update fr.json ([#1629](https://github.com/homebridge/homebridge-config-ui-x/pull/1629))
- **i18n:** Update es.json (Improves Spanish localization) ([#1632](https://github.com/homebridge/homebridge-config-ui-x/pull/1632))

### Other Changes

- Updated dependencies, including `@homebridge/node-pty-prebuilt-multiarch` to `0.11.10`
- Updated dependencies, including `@homebridge/node-pty-prebuilt-multiarch` to `0.11.10` (thanks [@NorthernMan54](https://github.com/NorthernMan54)!)

## 4.52.1 (2023-11-04)

### Other Changes

- **i18n:** Update de.json ([1627](https://github.com/homebridge/homebridge-config-ui-x/pull/1627))
- **i18n:** Update de.json ([#1627](https://github.com/homebridge/homebridge-config-ui-x/pull/1627))

### Bug Fixes

Expand Down Expand Up @@ -126,10 +127,10 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
- `hb-service` will now refuse to install `node` versions less than `16.18.0`
- Plugin node warning screen will appear when running a version of `node` lower than `18.15.0` (bumped up from `14.15.0`)
- UI node warning screen will appear when running a version of `node` lower than `18.15.0` (bumped up from `10.17.0`)
- Obtain correct beta branch name for Homebridge (and UI) (https://github.com/homebridge/homebridge-config-ui-x/commit/212b3eb1d5cb3ccda01fe2c3be711b80af4d5bf6)
- Rename pre-release npm tag from `test` to `beta` for consistency with other Homebridge repositories (https://github.com/homebridge/homebridge-config-ui-x/commit/86ea73ffd0b35f372a164ee42e17a996905cffb6)
- Obtain correct beta branch name for Homebridge (and UI) ([#212b3eb](https://github.com/homebridge/homebridge-config-ui-x/commit/212b3eb1d5cb3ccda01fe2c3be711b80af4d5bf6))
- Rename pre-release npm tag from `test` to `beta` for consistency with other Homebridge repositories ([#86ea73f](https://github.com/homebridge/homebridge-config-ui-x/commit/86ea73ffd0b35f372a164ee42e17a996905cffb6))
- Updated dependencies
- Update @homebridge/node-pty-prebuilt-multiarch to version v0.11.8 ( Updated build process and back-level support for Synology DSM devices )
- Update `@homebridge/node-pty-prebuilt-multiarch` to version v0.11.8 (updated build process and back-level support for Synology DSM devices)

## 4.51.2 (2023-10-27)

Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import * as path from 'path';
import { program } from 'commander';
import * as semver from 'semver';

let homebridge;
let homebridge: any;

class HomebridgeConfigUi {
log;
log: any;

constructor(log, config) {
constructor(log: any, config: any) {
this.log = log;

process.env.UIX_CONFIG_PATH = homebridge.user.configPath();
Expand Down
23 changes: 11 additions & 12 deletions src/modules/accessories/accessories.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export class AccessoriesService {
* Connects the client to the homebridge service
* @param client
*/
public async connect(client) {
public async connect(client: any) {
if (!this.configService.homebridgeInsecureMode) {
this.logger.error('Homebridge must be running in insecure mode to control accessories');
return;
}

let services;
let services: any[];

const loadAllAccessories = async (refresh: boolean) => {
if (!refresh) {
Expand All @@ -55,7 +55,7 @@ export class AccessoriesService {
await loadAllAccessories(false);

// handling incoming requests
const requestHandler = async (msg?) => {
const requestHandler = async (msg?: any) => {
if (msg.set) {
const service: ServiceType = services.find(x => x.uniqueId === msg.set.uniqueId);
if (service) {
Expand All @@ -76,12 +76,12 @@ export class AccessoriesService {

const monitor = await this.hapClient.monitorCharacteristics();

const updateHandler = (data) => {
const updateHandler = (data: any) => {
client.emit('accessories-data', data);
};
monitor.on('service-update', updateHandler);

const instanceUpdateHandler = async (data) => {
const instanceUpdateHandler = async (data: any) => {
client.emit('accessories-reload-required', services);
};
this.hapClient.on('instance-discovered', instanceUpdateHandler);
Expand Down Expand Up @@ -113,13 +113,12 @@ export class AccessoriesService {
* Refresh the characteristics from Homebridge
* @param services
*/
private refreshCharacteristics(services) {
private refreshCharacteristics(services: any[]) {
services.forEach(service => service.refreshCharacteristics());
}

/**
* Load all the accessories from Homebridge
* @param refreshServices
*/
public async loadAccessories(): Promise<ServiceType[]> {
if (!this.configService.homebridgeInsecureMode) {
Expand All @@ -141,7 +140,7 @@ export class AccessoriesService {
}

/**
* Get a single accessory and refresh it's characteristics
* Get a single accessory and refresh its characteristics
* @param uniqueId
*/
public async getAccessory(uniqueId: string) {
Expand All @@ -163,7 +162,7 @@ export class AccessoriesService {
/**
* Set a characteristics value
* @param uniqueId
* @param iid
* @param characteristicType
* @param value
*/
public async setAccessoryCharacteristic(uniqueId: string, characteristicType: string, value: number | boolean | string) {
Expand Down Expand Up @@ -212,7 +211,7 @@ export class AccessoriesService {
value = false;
}
} else if (typeof value === 'number') {
value = value === 1 ? true : false;
value = value === 1;
}

if (typeof value !== 'boolean') {
Expand All @@ -238,7 +237,7 @@ export class AccessoriesService {
if (username in accessoryLayout) {
return accessoryLayout[username];
} else {
throw new Error('User not in Acccessory Layout');
throw new Error('User not in Accessory Layout');
}
} catch (e) {
return [
Expand All @@ -256,7 +255,7 @@ export class AccessoriesService {
* @param layout
*/
public async saveAccessoryLayout(user: string, layout: Record<string, unknown>) {
let accessoryLayout;
let accessoryLayout: any;

try {
accessoryLayout = await fs.readJson(this.configService.accessoryLayoutPath);
Expand Down
20 changes: 10 additions & 10 deletions src/modules/backup/backup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const pump = util.promisify(pipeline);

@Injectable()
export class BackupService {
private restoreDirectory;
private restoreDirectory: string;

constructor(
private readonly configService: ConfigService,
Expand Down Expand Up @@ -62,7 +62,7 @@ export class BackupService {
}

/**
* Creates the .tar.gz instance backup of the curent Homebridge instance
* Creates the .tar.gz instance backup of the current Homebridge instance
*/
private async createBackup() {
// prepare a temp working directory
Expand Down Expand Up @@ -180,7 +180,7 @@ export class BackupService {
}

/**
* Runs the job to create a a scheduled backup
* Runs the job to create a scheduled backup
*/
async runScheduledBackupJob() {
// ensure backup path exists
Expand Down Expand Up @@ -594,9 +594,9 @@ export class BackupService {

// restore accessories
const sourceAccessoriesPath = path.resolve(this.restoreDirectory, 'etc', 'accessories');
const targetAccessoriestPath = path.resolve(storagePath, 'accessories');
const targetAccessoriesPath = path.resolve(storagePath, 'accessories');
if (await fs.pathExists(sourceAccessoriesPath)) {
await fs.copy(sourceAccessoriesPath, targetAccessoriestPath, {
await fs.copy(sourceAccessoriesPath, targetAccessoriesPath, {
filter: (filePath) => {
client.emit('stdout', `Restoring ${path.basename(filePath)}\r\n`);
return true;
Expand Down Expand Up @@ -639,11 +639,11 @@ export class BackupService {
// clone elements from the source config that we care about
const targetConfig: HomebridgeConfig = JSON.parse(JSON.stringify({
bridge: sourceConfig.bridge,
accessories: sourceConfig.accessories?.map((x) => {
accessories: sourceConfig.accessories?.map((x: any) => {
delete x.plugin_map;
return x;
}) || [],
platforms: sourceConfig.platforms?.map((x) => {
platforms: sourceConfig.platforms?.map((x: any) => {
if (x.platform === 'google-home') {
x.platform = 'google-smarthome';
x.notice = 'Keep your token a secret!';
Expand Down Expand Up @@ -721,7 +721,7 @@ export class BackupService {
// if running in standalone mode, need to find the pid of homebridge and kill it
if (os.platform() === 'linux' && this.configService.ui.standalone) {
try {
// try get pid by port
// try to get pid by port
const getPidByPort = (port: number): number => {
try {
return parseInt(child_process.execSync(
Expand All @@ -732,7 +732,7 @@ export class BackupService {
}
};

// try get pid by name
// try to get pid by name
const getPidByName = (): number => {
try {
return parseInt(child_process.execSync('pidof homebridge').toString('utf8').trim(), 10);
Expand Down Expand Up @@ -769,7 +769,7 @@ export class BackupService {
}

/**
* Checks the bridge.bind options are valid for the current system when restoring.
* Checks the 'bridge.bind' options are valid for the current system when restoring.
*/
private checkBridgeBindConfig(restoredConfig: HomebridgeConfig) {
if (restoredConfig.bridge.bind) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/config-editor/config-editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class ConfigEditorService {

const idx = config.disabledPlugins.findIndex(x => x === pluginName);

// Check plugin is in thw list
// Check plugin is in the list
if (idx > -1) {
config.disabledPlugins.splice(idx, 1);
await this.updateConfigFile(config);
Expand Down
5 changes: 3 additions & 2 deletions src/modules/log/log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class LogService {
/**
* Connect pty
* @param client
* @param size
*/
private tailLog(client: EventEmitter, size: LogTermSize) {
const command = [...this.command];
Expand Down Expand Up @@ -212,11 +213,11 @@ export class LogService {
}

// watch for lines and emit to client
const onLine = (line) => {
const onLine = (line: string) => {
client.emit('stdout', line + '\n\r');
};

const onError = (err) => {
const onError = (err: Error) => {
client.emit('stdout', err.message + '\n\r');
};

Expand Down
10 changes: 6 additions & 4 deletions src/modules/platform-tools/hb-service/hb-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BadRequestException, Injectable } from '@nestjs/common';
import * as fs from 'fs-extra';
import { ConfigService } from '../../../core/config/config.service';
import { Logger } from '../../../core/logger/logger.service';
import { HbServiceStartupSettings } from './hb-service.dto';

@Injectable()
export class HbServiceService {
Expand All @@ -12,7 +13,8 @@ export class HbServiceService {
constructor(
private readonly configService: ConfigService,
private readonly logger: Logger
) { }
) {
}

/**
* Returns the Homebridge startup settings
Expand Down Expand Up @@ -43,7 +45,7 @@ export class HbServiceService {
/**
* Sets the Homebridge startup settings
*/
async setHomebridgeStartupSettings(data) {
async setHomebridgeStartupSettings(data: HbServiceStartupSettings) {
// restart ui on next restart
this.configService.hbServiceUiRestartRequired = true;

Expand Down Expand Up @@ -91,8 +93,8 @@ export class HbServiceService {
}

const removeColour = new stream.Transform({
transform(chunk, encoding, callback) {
callback(null, chunk.toString('utf8').replace(/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]/g, ''));
transform(chunk, _encoding, callback) {
callback(null, chunk.toString().replace(/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]/g, ''));
},
});

Expand Down
1 change: 1 addition & 0 deletions src/modules/platform-tools/terminal/terminal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class TerminalService {
/**
* Create a new terminal session
* @param client
* @param size
*/
async startSession(client: WsEventEmitter, size: TermSize) {
this.ending = false;
Expand Down
Loading

0 comments on commit 553677f

Please sign in to comment.