@kubohiroya/turbowarp-webrtc-qrcode-pairing 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +2 -2
- package/dist/webrtc-qrcode-pairing.js +10 -3
- package/docs/integration-guide.ja.md +4 -0
- package/docs/integration-guide.md +4 -0
- package/package.json +1 -1
- package/src/pairing/controller.ts +13 -3
package/README.ja.md
CHANGED
|
@@ -15,7 +15,7 @@ QRコードを使ってWebRTCの接続情報を交換するTurboWarp拡張です
|
|
|
15
15
|
- Answerがどの Offer への応答かを追跡し、2台のカメラ側端末の接続情報が入れ替わらないようにします。
|
|
16
16
|
- 搬送の進捗と接続状態を別々の状態として報告します。エラー、取消、再試行、期限にも対応します。
|
|
17
17
|
|
|
18
|
-
`0.2.0`では、メッセージを連結QRコードで運び、1枚のQRを既定でOfferはversion 15、Answerはversion 20までに抑え、読んだペアリング用のQRをすべて報告します。`turbowarp-jsqr` 0.4.0以降が必要です。`0.2.1`では、QRがカメラに写り続けている間の読取りがページの処理を止めてしまう不具合を直しました。`0.2.2`では、1枚目に収まらないheaderを先頭から続くQRで読み、読取りを1つずつ処理して接続情報を一度だけ渡し、規格に合わないQR
|
|
18
|
+
`0.2.0`では、メッセージを連結QRコードで運び、1枚のQRを既定でOfferはversion 15、Answerはversion 20までに抑え、読んだペアリング用のQRをすべて報告します。`turbowarp-jsqr` 0.4.0以降が必要です。`0.2.1`では、QRがカメラに写り続けている間の読取りがページの処理を止めてしまう不具合を直しました。`0.2.2`では、1枚目に収まらないheaderを先頭から続くQRで読み、読取りを1つずつ処理して接続情報を一度だけ渡し、規格に合わないQRを読んでも集めていたものを消さないようにしました。`0.2.3`では、交換が接続・失敗・取消のどれかで終わった時点で、接続情報を含むQRのデータを捨てます。
|
|
19
19
|
|
|
20
20
|
> [!NOTE]
|
|
21
21
|
> ペアリング用ブロックは起動時固定のフィーチャーフラグの内側にあり、既定は無効です。
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ A TurboWarp extension for exchanging WebRTC connection information through QR co
|
|
|
15
15
|
- Tracks which offer an answer replies to, so two camera machines never receive each other's connection.
|
|
16
16
|
- Reports transport progress and connection state as separate states, plus errors, cancellation, retry and deadlines.
|
|
17
17
|
|
|
18
|
-
Version 0.2.0 carries messages as Structured Append sequences, caps Offer codes at QR version 15 and Answer codes at 20, and reports every pairing code read. It needs `turbowarp-jsqr` 0.4.0 or later. 0.2.1 fixes a camera scan that starved the page while a code stayed in view. 0.2.2 reads a header that runs past the first code, takes reads one at a time so a code is handed over once, and keeps a sequence when a malformed code is read.
|
|
18
|
+
Version 0.2.0 carries messages as Structured Append sequences, caps Offer codes at QR version 15 and Answer codes at 20, and reports every pairing code read. It needs `turbowarp-jsqr` 0.4.0 or later. 0.2.1 fixes a camera scan that starved the page while a code stayed in view. 0.2.2 reads a header that runs past the first code, takes reads one at a time so a code is handed over once, and keeps a sequence when a malformed code is read. 0.2.3 forgets the QR codes, which carry the pairing codes, as soon as an exchange connects, fails or is cancelled.
|
|
19
19
|
|
|
20
20
|
> [!NOTE]
|
|
21
21
|
> The pairing blocks are behind a startup feature flag that is off by default. See
|
|
@@ -116,7 +116,7 @@ pnpm run dev
|
|
|
116
116
|
|
|
117
117
|
Build output: `dist/webrtc-qrcode-pairing.js` and `dist/extension-manifest.json`. Load the JavaScript file as a custom TurboWarp extension. The manifest always records every declared block, including blocks the feature flag hides at runtime: it is the build-time contract, not the runtime state.
|
|
118
118
|
|
|
119
|
-
Package name and version: `@kubohiroya/turbowarp-webrtc-qrcode-pairing@0.2.
|
|
119
|
+
Package name and version: `@kubohiroya/turbowarp-webrtc-qrcode-pairing@0.2.3`.
|
|
120
120
|
|
|
121
121
|
## Block reference
|
|
122
122
|
|
|
@@ -3989,7 +3989,7 @@
|
|
|
3989
3989
|
* Moves a session to a terminal phase and releases what it owns.
|
|
3990
3990
|
*
|
|
3991
3991
|
* Everything but an established RTCPeerConnection is released: timers, the
|
|
3992
|
-
*
|
|
3992
|
+
* QR codes sent and received, and the peer connection when it never connected.
|
|
3993
3993
|
*/
|
|
3994
3994
|
finish(session, phase, errorCode, errorMessage) {
|
|
3995
3995
|
if (isTerminalPhase(session.phase) && session.phase !== "connected") return;
|
|
@@ -4001,9 +4001,8 @@
|
|
|
4001
4001
|
this.clearTimer(session);
|
|
4002
4002
|
session.scanAbort?.abort();
|
|
4003
4003
|
this.releaseDisplay(session);
|
|
4004
|
+
this.dropCodes(session);
|
|
4004
4005
|
if (!connected) {
|
|
4005
|
-
session.assembler.clear();
|
|
4006
|
-
session.candidate.clear();
|
|
4007
4006
|
if (session.peerCreated) {
|
|
4008
4007
|
try {
|
|
4009
4008
|
this.webrtc().closePeer(session.remotePeerId);
|
|
@@ -4015,6 +4014,14 @@
|
|
|
4015
4014
|
for (const waiter of waiters) if (connected) waiter.resolve();
|
|
4016
4015
|
else waiter.reject(this.terminalError(session));
|
|
4017
4016
|
}
|
|
4017
|
+
/** Forgets the codes this session made and the codes it received. */
|
|
4018
|
+
dropCodes(session) {
|
|
4019
|
+
session.outgoing = void 0;
|
|
4020
|
+
session.outgoingSvgs = [];
|
|
4021
|
+
session.outgoingCurrentIndex = -1;
|
|
4022
|
+
session.assembler.clear();
|
|
4023
|
+
session.candidate.clear();
|
|
4024
|
+
}
|
|
4018
4025
|
failFrom(session, error) {
|
|
4019
4026
|
const code = error instanceof QrPairingError ? error.code : "webrtc-rejected";
|
|
4020
4027
|
const message = error instanceof Error ? error.message : "Pairing failed.";
|
|
@@ -235,6 +235,10 @@ start offer pairing [pairing-B] as [studio] to [cam-B]
|
|
|
235
235
|
|
|
236
236
|
停止ボタンは表示とカメラを解放し、進行中の交換を取り消します。成立済みの接続は切断しません。
|
|
237
237
|
|
|
238
|
+
QRには接続情報そのものが入っています。交換が終わると(接続、失敗、取消、期限切れのいずれでも)、作ったQRと
|
|
239
|
+
受け取ったQRのデータを捨てます。そのため、その後は`pairing QR part count`と`received parts`が0になり、
|
|
240
|
+
QRのSVGとdata URIを返すブロックは空の文字列を返します。
|
|
241
|
+
|
|
238
242
|
## 10. うまくいかないとき
|
|
239
243
|
|
|
240
244
|
`pairing error code of [SESSION]`が安定したコードを、`pairing error message of [SESSION]`が
|
|
@@ -246,6 +246,10 @@ session names.
|
|
|
246
246
|
Pressing the stop button releases displays and cameras and cancels exchanges in progress. It does
|
|
247
247
|
not disconnect an established connection.
|
|
248
248
|
|
|
249
|
+
The QR codes carry the pairing code itself. When an exchange ends — connected, failed, cancelled or
|
|
250
|
+
expired — the codes it made and the codes it received are forgotten, so `pairing QR part count` and
|
|
251
|
+
`received parts` read 0 afterwards and the part SVG and data URI reporters return an empty string.
|
|
252
|
+
|
|
249
253
|
## 10. When something goes wrong
|
|
250
254
|
|
|
251
255
|
`pairing error code of [SESSION]` gives a stable code; `pairing error message of [SESSION]` gives a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-webrtc-qrcode-pairing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "TurboWarp extension that pairs WebRTC peers by carrying offers and answers as QR codes.",
|
|
5
5
|
"author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -914,7 +914,7 @@ export class PairingController {
|
|
|
914
914
|
* Moves a session to a terminal phase and releases what it owns.
|
|
915
915
|
*
|
|
916
916
|
* Everything but an established RTCPeerConnection is released: timers, the
|
|
917
|
-
*
|
|
917
|
+
* QR codes sent and received, and the peer connection when it never connected.
|
|
918
918
|
*/
|
|
919
919
|
private finish(
|
|
920
920
|
session: PairingSessionState,
|
|
@@ -931,9 +931,10 @@ export class PairingController {
|
|
|
931
931
|
this.clearTimer(session);
|
|
932
932
|
session.scanAbort?.abort();
|
|
933
933
|
this.releaseDisplay(session);
|
|
934
|
+
// The codes carry the pairing code, SDP and all. Once the exchange is over,
|
|
935
|
+
// connected or not, nothing reads them again, so they are not kept.
|
|
936
|
+
this.dropCodes(session);
|
|
934
937
|
if (!connected) {
|
|
935
|
-
session.assembler.clear();
|
|
936
|
-
session.candidate.clear();
|
|
937
938
|
if (session.peerCreated) {
|
|
938
939
|
try {
|
|
939
940
|
this.webrtc().closePeer(session.remotePeerId);
|
|
@@ -950,6 +951,15 @@ export class PairingController {
|
|
|
950
951
|
}
|
|
951
952
|
}
|
|
952
953
|
|
|
954
|
+
/** Forgets the codes this session made and the codes it received. */
|
|
955
|
+
private dropCodes(session: PairingSessionState): void {
|
|
956
|
+
session.outgoing = undefined;
|
|
957
|
+
session.outgoingSvgs = [];
|
|
958
|
+
session.outgoingCurrentIndex = -1;
|
|
959
|
+
session.assembler.clear();
|
|
960
|
+
session.candidate.clear();
|
|
961
|
+
}
|
|
962
|
+
|
|
953
963
|
private failFrom(session: PairingSessionState, error: unknown): void {
|
|
954
964
|
const code: PairingErrorCode =
|
|
955
965
|
error instanceof QrPairingError ? error.code : 'webrtc-rejected';
|