OpenAsar/src/winFirst.js
CanadaHonk ec5082860e
Remove Polyfills (#101)
* poly: remove completely

* bootstrap: remove unused request require

* asarUpdate: rewrite request -> https

* moduleUpdater: rewrite request -> https

* ui: fallback to channel instead of "custom" if no hash

* index: set name to branch for obvious testing

* config/backend: tweak source

* moduleUpdater: fix rewrite

* moduleUpdater: fix rewrite (x2)

* moduleUpdater: follow redirects with rewrite

* ci: start multi-branch rewrite

* ci: upgrade node to 18.x

* ci: rewrite version changing to use existing

* ci: change release version getting to in file

* ci: mess with yaml syntax

* ci: revert to node 16.x, fix version wrapped in quotes

* ci: fix invalid yaml

* ci: yaml syntax fixing

* ci: append to tag

* ci: make pre-release unless nightly build

* ci: add title nicening

* asarUpdate: fix release suffix

* asarUpdate: fix not following redirect

* winFirst: don't remake shortcuts, tweaks

* ui: add channel prefix if non-nightly

* chore: prep for main branch
2022-12-02 22:23:46 +00:00

30 lines
No EOL
835 B
JavaScript

const fs = require('fs');
const { join, resolve } = require('path');
const Constants = require('./Constants');
const reg = (a, c) => require('child_process').execFile('reg.exe', a, c);
const exec = process.execPath;
const app = resolve(exec, '..');
exports.do = () => {
const flag = join(app, '.first-run');
if (fs.existsSync(flag)) return; // Already done, skip
const proto = Constants.APP_PROTOCOL;
const base = 'HKCU\\Software\\Classes\\' + proto;
for (const x of [
[base, '/ve', '/d', `URL:${proto} Protocol`],
[base, '/v', 'URL Protocol'],
[base + '\\DefaultIcon', '/ve', '/d', `"${exec}",-1`],
[base + '\\shell\\open\\command', '/ve', '/d', `"${exec}" --url -- "%1"`]
]) reg([ 'add', ...x, '/f' ], e => {});
try {
fs.writeFileSync(flag, '');
} catch (e) {
log('FirstRun', e);
}
};