From c611a037db6ff0fe92922eaeb1e3e6627079077c Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Sat, 4 Nov 2023 14:01:55 -0500 Subject: [PATCH] revert homekit code changes --- src/modules/config-editor/config-editor.service.ts | 2 +- test/e2e/config-editor.e2e-spec.ts | 4 ++-- test/e2e/server.e2e-spec.ts | 2 +- test/mocks/config.json | 2 +- test/mocks/persist/AccessoryInfo.67E41F0EA05D.json | 2 +- ui/src/app/modules/config-editor/config-editor.component.ts | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/config-editor/config-editor.service.ts b/src/modules/config-editor/config-editor.service.ts index 72f3f76ff..f8ffc8883 100644 --- a/src/modules/config-editor/config-editor.service.ts +++ b/src/modules/config-editor/config-editor.service.ts @@ -113,7 +113,7 @@ export class ConfigEditorService { } // ensure the pin matches the required pattern - const pinPattern = /^([0-9]{4}-[0-9]{4})$/; + const pinPattern = /^([0-9]{3}-[0-9]{2}-[0-9]{3})$/; if (!pinPattern.test(config.bridge.pin)) { if (pinPattern.test(this.configService.homebridgeConfig.bridge.pin)) { config.bridge.pin = this.configService.homebridgeConfig.bridge.pin; diff --git a/test/e2e/config-editor.e2e-spec.ts b/test/e2e/config-editor.e2e-spec.ts index 675987a87..6108806ec 100644 --- a/test/e2e/config-editor.e2e-spec.ts +++ b/test/e2e/config-editor.e2e-spec.ts @@ -351,7 +351,7 @@ describe('ConfigEditorController (e2e)', () => { it('POST /config-editor (accept bridge.pin if a valid value is provided)', async () => { const currentConfig = await fs.readJson(configFilePath); - currentConfig.bridge.pin = '1111-1111'; + currentConfig.bridge.pin = '111-11-111'; const res = await app.inject({ method: 'POST', @@ -366,7 +366,7 @@ describe('ConfigEditorController (e2e)', () => { // check the updates were saved to disk and mistakes corrected const savedConfig: HomebridgeConfig = await fs.readJson(configFilePath); - expect(savedConfig.bridge.pin).toBe('1111-1111'); + expect(savedConfig.bridge.pin).toBe('111-11-111'); }); it('POST /config-editor (correct bridge.name if an invalid value is provided)', async () => { diff --git a/test/e2e/server.e2e-spec.ts b/test/e2e/server.e2e-spec.ts index 674cb5d91..a2e608930 100644 --- a/test/e2e/server.e2e-spec.ts +++ b/test/e2e/server.e2e-spec.ts @@ -106,7 +106,7 @@ describe('ServerController (e2e)', () => { expect(res.json()).toEqual({ displayName: 'Homebridge Test', isPaired: false, - pincode: '8749-9441', + pincode: '874-99-441', setupCode: 'X-HM://0024X0Z3L1FAP', }); }); diff --git a/test/mocks/config.json b/test/mocks/config.json index 7af1d1abc..a0efc63ed 100644 --- a/test/mocks/config.json +++ b/test/mocks/config.json @@ -2,7 +2,7 @@ "bridge": { "name": "Homebridge Test", "port": 51826, - "pin": "8749-9441", + "pin": "874-99-441", "username": "67:E4:1F:0E:A0:5D" }, "accessories": [], diff --git a/test/mocks/persist/AccessoryInfo.67E41F0EA05D.json b/test/mocks/persist/AccessoryInfo.67E41F0EA05D.json index 97ea2bdeb..efea7ea10 100644 --- a/test/mocks/persist/AccessoryInfo.67E41F0EA05D.json +++ b/test/mocks/persist/AccessoryInfo.67E41F0EA05D.json @@ -1,7 +1,7 @@ { "displayName": "Homebridge Test", "category": 2, - "pincode": "8749-9441", + "pincode": "874-99-441", "signSk": "fb7ecc3daa9b495d5867b49268af7568d52c4ab708e334809932976340d7a11f25e05221aa6ad3dbf4d7213e112db08752e6d94820e49038c58bc564b688626f", "signPk": "25e05221aa6ad3dbf4d7213e112db08752e6d94820e49038c58bc564b688626f", "pairedClients": {}, diff --git a/ui/src/app/modules/config-editor/config-editor.component.ts b/ui/src/app/modules/config-editor/config-editor.component.ts index f54f5ad8f..2905c8457 100644 --- a/ui/src/app/modules/config-editor/config-editor.component.ts +++ b/ui/src/app/modules/config-editor/config-editor.component.ts @@ -400,9 +400,9 @@ export class ConfigEditorComponent implements OnInit, OnDestroy { }, pin: { type: 'string', - description: 'The Homebridge instance pin.\nThis is used when pairing Homebridge to HomeKit.\nExample: 6302-7655', - default: '6302-7655', - pattern: '^([0-9]{4}-[0-9]{4})$', + description: 'The Homebridge instance pin.\nThis is used when pairing Homebridge to HomeKit.\nExample: 630-27-655', + default: '630-27-655', + pattern: '^([0-9]{3}-[0-9]{2}-[0-9]{3})$', }, manufacturer: { type: 'string',