vkma.devRU

Inspector: the same panel on a phone and in a published mini app

On this page

The inspector shows the devtools panel at inspect.vkma.dev. It is for the pages where neither the dev-server plugin nor the extension works: a mini app open in a WebView on a phone, a published build, a third-party app. No dev server is needed: the page connects to the panel straight from the browser over WebRTC.

Connecting a page

Open the panel. The Connect button holds the snippet with this panel’s id:

<script src="https://inspect.vkma.dev/inspector.js?id=<peer id>"></script>

Two rules follow:

  1. Put the tag first in <head>, before the app bundle. The bridge freezes its references to the native objects at import, so the inspector has to intercept them earlier.
  2. Load the mini app. The first connection of each page waits for an answer in the panel: Allow, Always allow or Deny.

The console variant

For a quick look at your own page, the snippet can be called from the console:

import("https://inspect.vkma.dev/inspector.js?id=<peer id>");

On vk.com the CSP may block console imports, so the variant suits your own pages. An inspector loaded after the app bundle sees less: only the bridge methods that already exist on the page.

What gets captured

Where the page is open Outgoing calls Incoming events Execute
On @vkma.dev/bridge from the bridge’s own event log yes yes
Android WebView yes yes (VKWebAppEvent) yes
iOS WebView yes yes yes
Top-level page, web transport yes yes (window message) yes
Cross-origin iframe on desktop no, it needs the extension yes yes

The service event VKWebAppSettings never appears in the timeline.

Security

  • The panel’s id from the snippet gives access to the traffic, launch params included. The panel blurs sign and access_token, but they travel whole. Keep the snippet out of public repositories. If it leaked, press Rotate: the panel gets a new id.
  • The approval is on by default: a new page waits until you press Allow or Always allow. Always allow remembers the page, and after a reload it connects without a question. Deny disconnects a page that is already connected and revokes the remembered grant.
  • By default the id lives as long as the panel’s tab is open. A fresh tab of the panel gets a new id, and the earlier snippet stops working. The Pin switch stores the id for the origin: the snippet then survives a tab restart, but a leaked id lives longer too.
  • There are no relay servers, the connection is established directly. On the same network it always works. Many pairs of mobile data and a home network work too. Symmetric NAT does not: such a pair simply fails to connect.
  • The connection is set up through the public PeerJS signaling server (0.peerjs.com). It sees the IP addresses of both sides, never the data. The data travels directly between the browsers.

Next

  • Panel — the Timeline, Execute and Clients sections.
  • Extension — the same result on a computer without changes to the app.
  • Overview — the panel on the dev server.
vkma.dev
RU
Esc