Skip to content

Commit

Permalink
revert homekit code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Nov 4, 2023
1 parent b10709c commit c611a03
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
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 @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/config-editor.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/server.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/persist/AccessoryInfo.67E41F0EA05D.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge Test",
"category": 2,
"pincode": "8749-9441",
"pincode": "874-99-441",
"signSk": "fb7ecc3daa9b495d5867b49268af7568d52c4ab708e334809932976340d7a11f25e05221aa6ad3dbf4d7213e112db08752e6d94820e49038c58bc564b688626f",
"signPk": "25e05221aa6ad3dbf4d7213e112db08752e6d94820e49038c58bc564b688626f",
"pairedClients": {},
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/modules/config-editor/config-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit c611a03

Please sign in to comment.