Open an app on a machine as a preview
A preview gives an app that listens on a machine’s own port an address on the web:
https://<name>-<address>.cmdop.page. The app keeps running where it is; nothing is deployed and
no port is opened on the machine.
Who can open a preview
| Kind | Who gets in |
|---|---|
| Private (the default) | the owner, signed in to their page; an agent granted http; a person with a share link |
Public (--public) | anyone with the address, as for a demo |
The app sees itself at http://localhost:<port>, so host and origin checks of common dev servers
pass with no setting. The app never sees a CMDOP token or sign-in.
Open one (person at the machine)
Run on the machine where the app runs:
cmdop expose 3000 --name shop--nameis the first part of the address: 1 to 20 ofa-zand0-9, no dashes (webstorybook, notstorybook-web). Without it the name is the port.- The machine asks before opening, and opens the address in the browser when you sit at its
screen.
--no-openonly prints it. --publiclets anyone in without signing in.cmdop expose --listshows what is open;cmdop expose --stop shopcloses it.
A container opens itself. Give the container that runs the app the label
cmdop.preview.name=<name> (Docker Compose: labels: ["cmdop.preview.name=shop"]). While it runs
it is a private preview with no command; when it stops, the preview leaves the list a minute later
and comes back under the same address. "http": { "ignore_declared": true } in the machine’s
ceiling.json turns this off.
From the page. The Previews page lists the ports a machine listens on that answer HTTP. A switch opens one as a private preview, also from a phone.
Look at it (owner)
Open the address. A browser that is not signed in shows “Sign in with CMDOP”; one click through your page signs that browser in to this preview only. The Previews page shows every open preview with its machine, the browsers signed in (and how many are agents), Copy, Share and Close.
Share it with someone
On the preview, Share makes a short link (https://s.cmdop.page/...) for 1 hour, 1 day or 7 days,
with an optional note (“for Acme”). Whoever opens it gets this preview only, nothing else of your
account. The link is shown once; revoke it on the page and its browsers are signed out at their
next request.
Let an agent see it (agent)
- Your grant needs
http: the owner turns on Open your previews for you on All machines → Agents, or when approving your connection (grant risk classes). The owner must also give you the machine the preview runs on. previews_listlists the previews you may open: name, address, port, private or public.preview_openwith the name returns a link for your own browser: it opens within 10 minutes, at most three times, and signs that browser in to this preview as you. Keep it secret. A public preview returns its address.- Look and act in your browser: real fonts, hover, clicks. Your sign-in ends when your token is
revoked or loses
httpor the machine, and when the preview closes.
An agent cannot open, share or close a preview; that stays with the person at the machine and the owner.
What does not work yet
- Absolute
http://localhostlinks written into a page’s content. - A sign-in with another service that sends you back to a
redirect_urithe app built as localhost. - An app that forces HTTPS on itself.
- A Content Security Policy that names localhost.
If it fails
| What you see | What to do |
|---|---|
| The name is refused | Use 1 to 20 of a-z and 0-9, no dashes |
| “offline” | The machine is not connected, or the app stopped; start it and reload |
| 403 “not granted http” | The owner turns on Open your previews for the agent on All machines → Agents |
| 403 “not given the computer of this preview” | The owner adds the machine to your token |
| “This link has expired or was turned off” | Ask for a new link, or call preview_open again |