lumabrowser 1.0.6 → 1.0.7
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 +11 -2
- package/bin/lumabrowser.js +30 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
npx lumabrowser start
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
That's it. The first run downloads the right build for your OS from
|
|
11
|
+
That's it. The first run downloads the right build for your OS from [lumabyte.com](https://lumabyte.com), caches it under `~/.lumabrowser/`, and launches it.
|
|
12
12
|
|
|
13
13
|
Subsequent runs launch from cache — no re-download unless you ask for one.
|
|
14
14
|
|
|
@@ -53,7 +53,16 @@ lumabrowser start
|
|
|
53
53
|
## Learn more
|
|
54
54
|
|
|
55
55
|
- Docs & downloads: [lumabyte.com](https://lumabyte.com)
|
|
56
|
-
-
|
|
56
|
+
- API docs: [lumabyte.com/apis](https://lumabyte.com/apis)
|
|
57
|
+
- Report issues: [github.com/amurgola/notification2webhookbrowser/issues](https://github.com/amurgola/notification2webhookbrowser/issues)
|
|
58
|
+
|
|
59
|
+
## Advanced: custom manifest
|
|
60
|
+
|
|
61
|
+
By default the launcher reads `https://lumabyte.com/install/manifest.json`. To point at a staging or self-hosted mirror, set `LUMABROWSER_MANIFEST_URL`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
LUMABROWSER_MANIFEST_URL=https://staging.lumabyte.com/install/manifest.json npx lumabrowser start
|
|
65
|
+
```
|
|
57
66
|
|
|
58
67
|
## License
|
|
59
68
|
|
package/bin/lumabrowser.js
CHANGED
|
@@ -7,7 +7,10 @@ const path = require('path');
|
|
|
7
7
|
const os = require('os');
|
|
8
8
|
const { spawn, execSync } = require('child_process');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// The LumaBrowser source repository is private, so we resolve downloads via
|
|
11
|
+
// lumabyte.com (not GitHub Releases). The site exposes a JSON manifest that
|
|
12
|
+
// lists the current installer for each platform.
|
|
13
|
+
const MANIFEST_URL = process.env.LUMABROWSER_MANIFEST_URL || 'https://lumabyte.com/install/manifest.json';
|
|
11
14
|
const CACHE_DIR = path.join(os.homedir(), '.lumabrowser');
|
|
12
15
|
const STATE_FILE = path.join(CACHE_DIR, 'install.json');
|
|
13
16
|
const USER_AGENT = 'lumabrowser-cli';
|
|
@@ -66,7 +69,7 @@ function httpRequest(url, { json = false } = {}) {
|
|
|
66
69
|
const req = https.get(url, {
|
|
67
70
|
headers: {
|
|
68
71
|
'User-Agent': USER_AGENT,
|
|
69
|
-
'Accept': json ? 'application/
|
|
72
|
+
'Accept': json ? 'application/json' : '*/*'
|
|
70
73
|
}
|
|
71
74
|
}, (res) => {
|
|
72
75
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
@@ -141,68 +144,52 @@ function renderBar(pct) {
|
|
|
141
144
|
return '[' + '#'.repeat(filled) + '-'.repeat(width - filled) + ']';
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
function
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/win.*portable.*\.exe$/i,
|
|
152
|
-
/lumabrowser[^/]*\.exe$/i
|
|
153
|
-
],
|
|
154
|
-
darwin: [
|
|
155
|
-
arch === 'arm64'
|
|
156
|
-
? /(mac|osx|darwin).*arm64.*\.zip$/i
|
|
157
|
-
: /(mac|osx|darwin).*(x64|x86_64).*\.zip$/i,
|
|
158
|
-
/(mac|osx|darwin).*\.zip$/i
|
|
159
|
-
],
|
|
160
|
-
linux: [
|
|
161
|
-
/\.AppImage$/i
|
|
162
|
-
]
|
|
163
|
-
}[platform] || [];
|
|
164
|
-
|
|
165
|
-
for (const pattern of patterns) {
|
|
166
|
-
const match = assets.find((a) => pattern.test(a.name));
|
|
167
|
-
if (match) return match;
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
147
|
+
function platformKey() {
|
|
148
|
+
const p = process.platform;
|
|
149
|
+
const a = process.arch;
|
|
150
|
+
if (p === 'win32') return 'win32-x64';
|
|
151
|
+
if (p === 'darwin') return a === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
|
|
152
|
+
if (p === 'linux') return 'linux-x64';
|
|
153
|
+
return `${p}-${a}`;
|
|
170
154
|
}
|
|
171
155
|
|
|
172
|
-
async function
|
|
173
|
-
return httpRequest(
|
|
156
|
+
async function fetchManifest() {
|
|
157
|
+
return httpRequest(MANIFEST_URL, { json: true });
|
|
174
158
|
}
|
|
175
159
|
|
|
176
160
|
async function install({ force = false } = {}) {
|
|
177
|
-
info(
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
161
|
+
info(`Checking ${MANIFEST_URL.replace(/^https?:\/\//, '').split('/')[0]} for the latest LumaBrowser release…`);
|
|
162
|
+
const manifest = await fetchManifest();
|
|
163
|
+
const key = platformKey();
|
|
164
|
+
const asset = manifest && manifest.assets && manifest.assets[key];
|
|
165
|
+
if (!asset || !asset.url || !asset.filename) {
|
|
166
|
+
const available = (manifest && manifest.assets) ? Object.keys(manifest.assets).join(', ') : '(none)';
|
|
181
167
|
throw new Error(
|
|
182
|
-
`No
|
|
183
|
-
`Available
|
|
168
|
+
`No LumaBrowser build available for ${key}.\n` +
|
|
169
|
+
`Available platforms in manifest: ${available}\n` +
|
|
170
|
+
`If this is wrong, please open an issue at https://github.com/amurgola/notification2webhookbrowser/issues`
|
|
184
171
|
);
|
|
185
172
|
}
|
|
186
173
|
|
|
187
174
|
const current = readState();
|
|
188
|
-
if (!force && current && current.version ===
|
|
175
|
+
if (!force && current && current.version === manifest.version && current.executable && fs.existsSync(current.executable)) {
|
|
189
176
|
return current;
|
|
190
177
|
}
|
|
191
178
|
|
|
192
179
|
fs.mkdirSync(CACHE_DIR, { recursive: true });
|
|
193
|
-
const downloadPath = path.join(CACHE_DIR, asset.
|
|
194
|
-
ok(`Downloading LumaBrowser ${
|
|
195
|
-
await downloadFile(asset.
|
|
180
|
+
const downloadPath = path.join(CACHE_DIR, asset.filename);
|
|
181
|
+
ok(`Downloading LumaBrowser ${manifest.version} — ${asset.filename}`);
|
|
182
|
+
await downloadFile(asset.url, downloadPath, 'Downloading');
|
|
196
183
|
|
|
197
184
|
const executable = prepareExecutable(downloadPath);
|
|
198
185
|
const record = {
|
|
199
|
-
version:
|
|
200
|
-
asset: asset.
|
|
186
|
+
version: manifest.version,
|
|
187
|
+
asset: asset.filename,
|
|
201
188
|
executable,
|
|
202
189
|
installedAt: new Date().toISOString()
|
|
203
190
|
};
|
|
204
191
|
writeState(record);
|
|
205
|
-
ok(`Installed LumaBrowser ${
|
|
192
|
+
ok(`Installed LumaBrowser ${manifest.version}`);
|
|
206
193
|
return record;
|
|
207
194
|
}
|
|
208
195
|
|
package/package.json
CHANGED