Show the desktop · NoMac

Docs · Show the desktop+

Show the desktop

Your user watches their Mac, or uses it, right in your page with no NoMac sign-in, and their agent gets a token for that Mac only.

A link

TypeScriptPython

const { url } = await mac.viewLink({ control: true }); // or watch only: viewLink()
// https://nomac.app/mac/view/...: open it, or put it in an iframe with ?embed=1

In your page

HTML

<iframe src="https://nomac.app/mac/view/...?embed=1"
        style="width: 100%; aspect-ratio: 16 / 10; border: 0"></iframe>

?embed=1shows only the screen, at any size, without the page's own bar. The desktop streams as video, so it needs a current Chrome, Edge, Safari or Firefox.

Only on your site

TypeScriptPython

const { url } = await mac.viewLink({ control: true, allowedOrigins: ["https://app.example.com"] });

Only for your user

TypeScriptPython

import { signVisitor } from "@nomac/sdk";

// Once. Keep the secret on your server (here NOMAC_EMBED_SECRET), never in a browser.
const { secret } = await nomac.embed.newSecret();

// On your server, for each page load: the link names your user, and you sign them.
const { url } = await mac.viewLink({ control: true, allowedOrigins: ["https://app.example.com"], visitor: user.id });
const visitor = await signVisitor({ secret: process.env.NOMAC_EMBED_SECRET, sessionId: mac.id, visitor: user.id });
const src = `${url}?embed=1#visitor=${visitor}`;

// In your page: <iframe src={src}>

For every link

TypeScriptPython

await nomac.embed.set({ allowedOrigins: ["https://app.example.com"], requireVisitor: true });

Both then apply to every link made over the API from then on, a Mac token's links too. A link can name fewer sites, never others. Links made before keep what they had.

A token for their agent

TypeScriptPython

const { token } = await mac.token({ minutes: 120 });

// Your user's agent, with that token only:
const theirs = new NoMac({ token }).mac(mac.id);
const { stdout } = await theirs.run("xcodebuild -list");

An nmm_…token reaches that Mac's commands and jobs, files and file links, screenshot, input, recording, password and view links. It never reaches another Mac, a start, a stop, an extension, your account's list or its price. It lasts 2 hours by default, a day at most.

Take it back

TypeScript

await mac.revokeTokens(); // every token and link of this Mac made so far; the Mac runs on

Open views close within 20 seconds, and new tokens and links work at once. Revoking the API key that made them ends them too. Over REST: DELETE /api/v1/mac/sessions/{id}/token.

Over REST, a link is POST /api/v1/mac/sessions/{id}/viewwith { "control": true, "minutes": 120 }, and allowed_originsand visitorif you need them. A token is POST .../tokenwith{ "minutes": 120 }. The defaults are GETand PUT /api/v1/embedwith{ "allowed_origins": [...], "require_visitor": true }, and the secret POST /api/v1/embed/secret. See Mac API.

Previous← A Mac per user NextDrives and data →