Use inspectorKey

This commit is contained in:
Tobias Baunbaek
2024-01-30 10:20:07 +01:00
parent 6e1a7ef117
commit f6988154c2
2 changed files with 8 additions and 7 deletions

View File

@@ -62,8 +62,8 @@ customElements.define('devtools-inspector', class extends HTMLElement {
import inspector from 'inspector' import inspector from 'inspector'
import { Inspector } from 'pear-inspect' import { Inspector } from 'pear-inspect'
const pearInspector = await new Inspector({ inspector }).enable() const pearInspector = await new Inspector({ inspector }).enable()
const { publicKey } = await pearInspector.enable() const { inspectorKey } = await pearInspector.enable()
console.log('Pear Inspector key:', publicKey.toString('hex')) console.log('Pear Inspector key:', inspectorKey.toString('hex'))
</div> </div>
</li> </li>
<li>Running your program and the Pear Inspector key will be logged</li> <li>Running your program and the Pear Inspector key will be logged</li>
@@ -97,16 +97,16 @@ customElements.define('devtools-inspector', class extends HTMLElement {
this.addKeyFormElem.addEventListener('submit', e => { this.addKeyFormElem.addEventListener('submit', e => {
e.preventDefault() e.preventDefault()
const publicKey = this.addKeyInputElem.value const inspectorKey = this.addKeyInputElem.value
if (publicKey.length !== 64) { if (inspectorKey.length !== 64) {
this.addKeyErrorElem.textContent = 'Key needs to be 64 characters long' this.addKeyErrorElem.textContent = 'Key needs to be 64 characters long'
return return
} }
const sessionId = generateUuid() const sessionId = generateUuid()
const inspectorSession = new Session({ publicKey: b4a.from(publicKey, 'hex') }) const inspectorSession = new Session({ inspectorKey: b4a.from(inspectorKey, 'hex') })
const app = { const app = {
publicKey, inspectorKey,
title: '', title: '',
url: '', url: '',
inspectorSession inspectorSession

View File

@@ -10,7 +10,8 @@
} }
}, },
"dependencies": { "dependencies": {
"@holepunchto/pear-inspect": "^2.0.0", "@holepunchto/pear-inspect": "^3.0.0",
"b4a": "^1.6.4",
"bare-path": "^2.1.0", "bare-path": "^2.1.0",
"redhat-overpass-font": "^1.0.0", "redhat-overpass-font": "^1.0.0",
"ws": "^8.16.0" "ws": "^8.16.0"