@minicode-dev/chat 0.1.10 → 0.1.12
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.md +109 -0
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js +1225 -0
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js.map +1 -0
- package/dist/chunks/{WebRtcLab-lijo_Rta.js → WebRtcLab-ClRSYt4E.js} +2 -2
- package/dist/chunks/{WebRtcLab-lijo_Rta.js.map → WebRtcLab-ClRSYt4E.js.map} +1 -1
- package/dist/chunks/{createLiveScene-GkalLsqm.js → createLiveScene-BqI7qV4n.js} +2 -2
- package/dist/chunks/{createLiveScene-GkalLsqm.js.map → createLiveScene-BqI7qV4n.js.map} +1 -1
- package/dist/chunks/createPeerLink-DBVs_yvQ.js +1136 -0
- package/dist/chunks/createPeerLink-DBVs_yvQ.js.map +1 -0
- package/dist/index.js +1656 -1423
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +24 -4
- package/package.json +1 -1
- package/dist/chunks/TanksLiveGameCard-BxQGR8P9.js +0 -897
- package/dist/chunks/TanksLiveGameCard-BxQGR8P9.js.map +0 -1
- package/dist/chunks/createPeerLink-CL7VZuHS.js +0 -480
- package/dist/chunks/createPeerLink-CL7VZuHS.js.map +0 -1
package/README.md
CHANGED
|
@@ -211,6 +211,22 @@ it is responsible for upload permissions, storage and preserving images used in
|
|
|
211
211
|
The local demo includes a session-only image uploader (PNG/JPG/WebP/GIF, up to 256 KB
|
|
212
212
|
and 2048 × 2048) and an example image. Open **Nuevas funciones** to try it.
|
|
213
213
|
|
|
214
|
+
## Countdown messages
|
|
215
|
+
|
|
216
|
+
Open **✨ → Cuenta regresiva**, choose a quick duration button or a custom duration in seconds or minutes
|
|
217
|
+
(up to 24 hours), select the final effect (pig, confetti or nudge), and choose
|
|
218
|
+
whether to include its sound. **Probar efecto** previews the selection without sending.
|
|
219
|
+
Send it to display a live countdown in the conversation. The card hides the chosen
|
|
220
|
+
effect until zero; quotes and conversation previews also keep the surprise.
|
|
221
|
+
The last ten seconds animate; at zero, the visible conversation plays the selected
|
|
222
|
+
effect, respecting automatic playback, sound preferences and reduced motion.
|
|
223
|
+
|
|
224
|
+
Countdowns use ordinary text messages with a separate `[minicode-countdown:v1]`
|
|
225
|
+
payload containing an absolute deadline. No backend change is needed. Both clients
|
|
226
|
+
need this library version for the countdown UI; older clients show readable fallback
|
|
227
|
+
text. Device clocks should be accurate. Closed or hidden conversations do not play
|
|
228
|
+
the deadline effect; expired cards offer manual replay on return.
|
|
229
|
+
|
|
214
230
|
## Zumbidos and animated effects
|
|
215
231
|
|
|
216
232
|
The chat includes a nudge, a dancing pig and confetti with approved audio recordings.
|
|
@@ -321,3 +337,96 @@ Use WASD/arrows, mouse and click/space on desktop, or the joystick, arena touch
|
|
|
321
337
|
button on mobile. Minimize preserves the match; reload/reopening the chat is not a persisted
|
|
322
338
|
match recovery flow. Wi-Fi versus cellular connectivity and runtime TURN still require real-device
|
|
323
339
|
validation.
|
|
340
|
+
|
|
341
|
+
### Manual TURN recovery inside TANQUES LIVE
|
|
342
|
+
|
|
343
|
+
Both players need a version with manual TURN support. No Django endpoint, consumer,
|
|
344
|
+
WebSocket protocol change, Cloudflare SDK, or application-level screen is required.
|
|
345
|
+
The existing `webrtc.iceServers` and `iceTransportPolicy` provider settings continue
|
|
346
|
+
working. Manual settings belong only to the current match and are not persisted.
|
|
347
|
+
|
|
348
|
+
1. Invite the other player and accept the match normally. Local/direct connections
|
|
349
|
+
keep working without TURN.
|
|
350
|
+
2. During negotiation (or even during a connected match), choose **Configurar
|
|
351
|
+
conexión alternativa**. A slow or failed negotiation also shows a connection notice.
|
|
352
|
+
3. **One player** pastes the JSON containing temporary `iceServers` and selects
|
|
353
|
+
**Aplicar y reconectar**. The other player receives and applies it automatically;
|
|
354
|
+
they do not need to paste anything.
|
|
355
|
+
4. Wait for the sharing confirmation, then inspect the actual connection state.
|
|
356
|
+
Applied credentials do not by themselves prove that TURN is reachable or in use.
|
|
357
|
+
|
|
358
|
+
The modal accepts `{ "iceServers": [...] }` and a full Cloudflare envelope such as
|
|
359
|
+
`{ "success": true, "result": { "iceServers": [...] } }`. It rejects invalid JSON,
|
|
360
|
+
STUN-only configurations, invalid ICE URLs, missing TURN passwords, known expired
|
|
361
|
+
credentials, and API-token fields. Limits: 6,000 characters/UTF-8 bytes, eight ICE
|
|
362
|
+
servers and sixteen URLs. Only `stun:`, `stuns:`, `turn:` and `turns:` URLs are allowed.
|
|
363
|
+
|
|
364
|
+
**Never paste the permanent Cloudflare TURN API token.** Generate temporary
|
|
365
|
+
credentials externally in your terminal. For example, with your credentials already
|
|
366
|
+
set in your terminal environment (not in React), this copies only the temporary
|
|
367
|
+
response to the macOS clipboard:
|
|
368
|
+
|
|
369
|
+
```sh
|
|
370
|
+
curl --fail --silent --show-error \
|
|
371
|
+
"https://rtc.live.cloudflare.com/v1/turn/keys/${CLOUDFLARE_TURN_KEY_ID}/credentials/generate-ice-servers" \
|
|
372
|
+
--header "Authorization: Bearer ${CLOUDFLARE_TURN_KEY_API_TOKEN}" \
|
|
373
|
+
--header "Content-Type: application/json" \
|
|
374
|
+
--data '{"ttl":3600}' | pbcopy
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The library never calls that API. The optional **Validez restante en segundos** field
|
|
378
|
+
means remaining validity from now, not the original issuance TTL. Leave it blank
|
|
379
|
+
when unknown; Cloudflare's opaque username is not treated as an expiry timestamp.
|
|
380
|
+
You can also supply `expiresAt` (ISO text or Unix milliseconds) or `expiresIn`/`ttl`
|
|
381
|
+
(remaining seconds) in the JSON. Known-expired settings are refused; expiry unknown
|
|
382
|
+
cannot be detected reliably from every ICE authentication failure, so obtain and
|
|
383
|
+
paste new credentials if the old ones stop working.
|
|
384
|
+
|
|
385
|
+
Recovery uses the private chat signaling already used for SDP/ICE. A tab-bound,
|
|
386
|
+
ephemeral ECDH/AES-GCM exchange encrypts the credentials before they enter the chat
|
|
387
|
+
transport. The host coordinates preparation, confirmation and recovery so either
|
|
388
|
+
player can initiate without racing two restart offers. A healthy direct connection
|
|
389
|
+
with policy `all` is kept; new fallback settings do not trigger an unnecessary
|
|
390
|
+
restart. Otherwise the link updates `setConfiguration()` and restarts ICE, or
|
|
391
|
+
recreates only PeerConnections when necessary. Positions, health and match state
|
|
392
|
+
remain in the existing simulation. Drafts clear on closing/applying the dialog;
|
|
393
|
+
credentials and encryption keys clear when the match ends or is destroyed.
|
|
394
|
+
|
|
395
|
+
The library excludes these internal frames from its visible client history and
|
|
396
|
+
unread counts; any server that stores all chat frames may still retain encrypted
|
|
397
|
+
signaling. No plaintext TURN password is sent in those frames. This relies on the
|
|
398
|
+
existing authenticated private-room relay; it is not protection against an actively
|
|
399
|
+
malicious signaling server. HTTPS (or localhost) and Web Crypto are required. Without
|
|
400
|
+
Web Crypto, sharing fails safely instead of sending plaintext. Closing the dialog
|
|
401
|
+
does not end the match; an already-started synchronization can still finish.
|
|
402
|
+
|
|
403
|
+
**Diagnostics and real-network validation:**
|
|
404
|
+
|
|
405
|
+
- Open **Diagnóstico de conexión** to see SDP/ICE/gathering states, DataChannel
|
|
406
|
+
readiness, reconnects, connection time, RTT and sanitized ICE errors/counters.
|
|
407
|
+
- `turnConfigured` only means a TURN URL is configured. `candidates.localRelay`
|
|
408
|
+
means relay candidates were gathered. `selectedPair.relay: true` means the actual
|
|
409
|
+
selected candidate pair uses TURN. No passwords, usernames, SDP or private candidate
|
|
410
|
+
addresses are included in the panel.
|
|
411
|
+
- To verify TURN, temporarily enable **Forzar relay para diagnóstico**. It is shared
|
|
412
|
+
with the settings so both peers use `iceTransportPolicy: "relay"`. Confirm both
|
|
413
|
+
DataChannels are open, `phase` is `connected`, the selected pair is relay, and
|
|
414
|
+
movement counters increase on both devices. Disable the option for normal play.
|
|
415
|
+
- Test from two devices on different networks (for example Wi-Fi and cellular),
|
|
416
|
+
with current temporary credentials. Also test interruption/retry and renewing
|
|
417
|
+
credentials from either player. No implementation can guarantee connectivity
|
|
418
|
+
through every restrictive firewall; TURN/TLS over TCP may add latency/jitter.
|
|
419
|
+
- The local two-player demo remains `/tanks-live-lab.html?user=ana` and
|
|
420
|
+
`/tanks-live-lab.html?user=luis`. Automated tests use fake RTC/TURN to verify
|
|
421
|
+
synchronization, retries, privacy and state preservation; they do not prove that
|
|
422
|
+
a real TURN service is reachable across networks.
|
|
423
|
+
|
|
424
|
+
For repeatable browser QA, `scripts/check-manual-turn-browser.mjs` uses Playwright
|
|
425
|
+
as an optional development tool (not a library dependency). Run the demo, make a
|
|
426
|
+
Playwright installation available, then run the script. `CHAT_DEMO_URL` overrides
|
|
427
|
+
the default `http://127.0.0.1:5173`; `PLAYWRIGHT_MODULE` and
|
|
428
|
+
`PLAYWRIGHT_EXECUTABLE_PATH` can select an existing tooling installation. It checks
|
|
429
|
+
two real local browser peers, host/guest manual sharing with dummy credentials,
|
|
430
|
+
invalid inputs, light/dark/mobile dialogs, cancellation and simulated blocked ICE.
|
|
431
|
+
Its headless-only flags allow local candidates without mDNS resolution. The script
|
|
432
|
+
never tests real TURN credentials or proves Wi-Fi/cellular connectivity.
|