homekit: use html setting

This commit is contained in:
Koushik Dutta
2024-07-10 19:16:57 -07:00
parent 259c6434da
commit 7bf4609d3d
4 changed files with 40 additions and 10 deletions

View File

@@ -12,7 +12,8 @@
"check-disk-space": "^3.4.0",
"hap-nodejs": "^0.11.2",
"lodash": "^4.17.21",
"mkdirp": "^3.0.1"
"mkdirp": "^3.0.1",
"qrcode-svg": "^1.1.0"
},
"devDependencies": {
"@scrypted/common": "file:../../common",
@@ -20,6 +21,7 @@
"@types/debug": "^4.1.12",
"@types/lodash": "^4.17.0",
"@types/node": "^20.11.28",
"@types/qrcode-svg": "^1.1.4",
"@types/url-parse": "^1.4.11"
}
},
@@ -30,12 +32,12 @@
"license": "ISC",
"dependencies": {
"@scrypted/sdk": "file:../sdk",
"@scrypted/server": "file:../server",
"http-auth-utils": "^5.0.1",
"typescript": "^5.3.3"
"typescript": "^5.5.3"
},
"devDependencies": {
"@types/node": "^20.11.0",
"monaco-editor": "^0.50.0",
"ts-node": "^10.9.2"
}
},
@@ -121,7 +123,7 @@
},
"../../sdk": {
"name": "@scrypted/sdk",
"version": "0.3.29",
"version": "0.3.37",
"dev": true,
"license": "ISC",
"dependencies": {
@@ -291,6 +293,12 @@
"undici-types": "~5.26.4"
}
},
"node_modules/@types/qrcode-svg": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@types/qrcode-svg/-/qrcode-svg-1.1.4.tgz",
"integrity": "sha512-gh+atEBHXpU5iO72Tg4q03YdGKoY0zH1Yr4mGl+NSzFpyPuJcgurs8F3aRpH0Gs93GFuB1rDoQj6U4Xshn72PA==",
"dev": true
},
"node_modules/@types/url-parse": {
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.11.tgz",
@@ -1032,6 +1040,14 @@
"teleport": ">=0.2.0"
}
},
"node_modules/qrcode-svg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/qrcode-svg/-/qrcode-svg-1.1.0.tgz",
"integrity": "sha512-XyQCIXux1zEIA3NPb0AeR8UMYvXZzWEhgdBgBjH9gO7M48H9uoHzviNz8pXw3UzrAcxRRRn9gxHewAVK7bn9qw==",
"bin": {
"qrcode-svg": "bin/qrcode-svg.js"
}
},
"node_modules/regexp.prototype.flags": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz",
@@ -1325,11 +1341,11 @@
"version": "file:../../common",
"requires": {
"@scrypted/sdk": "file:../sdk",
"@scrypted/server": "file:../server",
"@types/node": "^20.11.0",
"http-auth-utils": "^5.0.1",
"monaco-editor": "^0.50.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.5.3"
}
},
"@scrypted/sdk": {
@@ -1386,6 +1402,12 @@
"undici-types": "~5.26.4"
}
},
"@types/qrcode-svg": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@types/qrcode-svg/-/qrcode-svg-1.1.4.tgz",
"integrity": "sha512-gh+atEBHXpU5iO72Tg4q03YdGKoY0zH1Yr4mGl+NSzFpyPuJcgurs8F3aRpH0Gs93GFuB1rDoQj6U4Xshn72PA==",
"dev": true
},
"@types/url-parse": {
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.11.tgz",
@@ -1901,6 +1923,11 @@
"resolved": "https://registry.npmjs.org/q/-/q-1.1.2.tgz",
"integrity": "sha512-ROtylwux7Vkc4C07oKE/ReigUmb33kVoLtcR4SJ1QVqwaZkBEDL3vX4/kwFzIERQ5PfCl0XafbU8u2YUhyGgVA=="
},
"qrcode-svg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/qrcode-svg/-/qrcode-svg-1.1.0.tgz",
"integrity": "sha512-XyQCIXux1zEIA3NPb0AeR8UMYvXZzWEhgdBgBjH9gO7M48H9uoHzviNz8pXw3UzrAcxRRRn9gxHewAVK7bn9qw=="
},
"regexp.prototype.flags": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz",

View File

@@ -38,7 +38,8 @@
"check-disk-space": "^3.4.0",
"hap-nodejs": "^0.11.2",
"lodash": "^4.17.21",
"mkdirp": "^3.0.1"
"mkdirp": "^3.0.1",
"qrcode-svg": "^1.1.0"
},
"devDependencies": {
"@scrypted/common": "file:../../common",
@@ -46,6 +47,7 @@
"@types/debug": "^4.1.12",
"@types/lodash": "^4.17.0",
"@types/node": "^20.11.28",
"@types/qrcode-svg": "^1.1.4",
"@types/url-parse": "^1.4.11"
}
}

View File

@@ -89,7 +89,7 @@ export function createHAPUsernameStorageSettingsDict(device: { storage: Storage,
group,
// subgroup,
title: "Pairing QR Code",
type: 'qrcode',
type: 'html',
readonly: true,
description: "Scan with your iOS camera to pair this Scrypted with HomeKit.",
},

View File

@@ -16,6 +16,7 @@ import './types';
import { VIDEO_CLIPS_NATIVE_ID } from './types/camera/camera-recording-files';
import { reorderDevicesByProvider } from './util';
import { VideoClipsMixinProvider } from './video-clips-provider';
import QRCode from 'qrcode-svg';
const hapStorage: Storage = {
get length() {
@@ -283,7 +284,7 @@ export class HomeKitPlugin extends ScryptedDeviceBase implements MixinProvider,
await this.publishAccessory(accessory, storageSettings.values.mac, storageSettings.values.pincode, standaloneCategory, storageSettings.values.portOverride, storageSettings.values.addIdentifyingMaterial);
if (!hasPublished) {
hasPublished = true;
storageSettings.values.qrCode = accessory.setupURI();
storageSettings.values.qrCode = new QRCode(accessory.setupURI()).svg();
logConnections(mixinConsole, accessory, this.seenConnections);
}
}
@@ -364,7 +365,7 @@ export class HomeKitPlugin extends ScryptedDeviceBase implements MixinProvider,
};
this.bridge.publish(publishInfo, true).then(() => {
this.storageSettings.values.qrCode = this.bridge.setupURI();
this.storageSettings.values.qrCode = new QRCode(this.bridge.setupURI()).svg();
logConnections(this.console, this.bridge, this.seenConnections);
});