A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.

9 downloads

dbbasic-browser/apps/browser/scripts/build-standalone.mjs
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-browser.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-browser.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-browser.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 toolbar: Back and Forward are greyed out when there's nowhere to go cc08c7a 1 week, 2 days ago History
build-standalone.mjs · 2.2 KB · 43 lines
1#!/usr/bin/env node
2/**
3 * A self-contained build: everything except Electron itself is bundled into one folder, so the app can be run with
4 * nothing but an Electron binary — no npm install and no Node version requirement on the machine that runs it.
5 *
6 * npm run build:standalone → standalone/ (copy this folder anywhere)
7 * <electron> standalone/ e.g. ./electron standalone/ --user-data-dir=<a folder of its own>
8 *
9 * On Linux, Chromium's sandbox needs either unprivileged user namespaces or a setuid chrome-sandbox helper. Where neither is
10 * available, prefer an AppArmor profile that allows user namespaces for this one binary, or make the helper setuid root once
11 * (chown root chrome-sandbox && chmod 4755 chrome-sandbox). Do not use --no-sandbox for pages you do not trust.
12 *
13 * It is the normal build plus the three SDK packages that the normal build leaves external (viem, anthropic, openai).
14 */
15import { build } from "esbuild";
16import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
17import { dirname, join } from "node:path";
18import { fileURLToPath } from "node:url";
19
20const root = join(dirname(fileURLToPath(import.meta.url)), "..");
21const out = join(root, "standalone");
22rmSync(out, { recursive: true, force: true });
23mkdirSync(out, { recursive: true });
24
25await build({
26 entryPoints: [join(root, "src", "main.ts")],
27 bundle: true,
28 platform: "node",
29 format: "esm",
30 external: ["electron"],
31 outfile: join(out, "main.js"),
32 // Bundled CommonJS packages call require(); give them one.
33 banner: { js: 'import { createRequire as __cr } from "node:module"; const require = __cr(import.meta.url);' },
34 logLevel: "warning",
35});
36
37// The rest of what the normal build puts in dist/ (it must have been built first).
38for (const f of ["chrome.html", "help.html", "preload.cjs", "webview-preload.cjs", "icon.png", "Readability.js", "reader-extractor.js"]) {
39 copyFileSync(join(root, "dist", f), join(out, f));
40}
41const version = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version;
42writeFileSync(join(out, "package.json"), JSON.stringify({ name: "dbbasic-browser-standalone", version, type: "module", main: "main.js" }, null, 2) + "\n");
43console.log(`standalone build: ${out}`);