feat: add auto update support (#65)

This commit is contained in:
2026-05-16 00:09:14 -07:00
committed by GitHub
parent 105713361e
commit 91a01b86a9
71 changed files with 2368 additions and 188 deletions
@@ -15,13 +15,13 @@ test('looksLikeSubminerLauncher rejects unrelated executable content', () => {
assert.equal(looksLikeSubminerLauncher(Buffer.from('SubMiner launcher binary payload')), true);
});
test('buildProtectedLauncherUpdateCommand uses sudo curl and chmod for protected paths', () => {
test('buildProtectedLauncherUpdateCommand quotes sudo curl and chmod paths', () => {
assert.equal(
buildProtectedLauncherUpdateCommand(
'https://github.com/ksyasuda/SubMiner/releases/latest/download/subminer',
'/usr/local/bin/subminer',
"https://github.com/ksyasuda/SubMiner/releases/latest/download/sub miner?sig='abc'",
"/usr/local/bin/subminer's launcher",
),
'sudo curl -fSL https://github.com/ksyasuda/SubMiner/releases/latest/download/subminer -o /usr/local/bin/subminer && sudo chmod +x /usr/local/bin/subminer',
"sudo curl -fSL 'https://github.com/ksyasuda/SubMiner/releases/latest/download/sub miner?sig='\\''abc'\\''' -o '/usr/local/bin/subminer'\\''s launcher' && sudo chmod +x '/usr/local/bin/subminer'\\''s launcher'",
);
});
@@ -84,7 +84,7 @@ test('updateLauncherAtPath reports protected command without replacing non-writa
});
assert.equal(result.status, 'protected');
assert.match(result.command ?? '', /^sudo curl -fSL https:\/\/example\.test\/subminer/);
assert.match(result.command ?? '', /^sudo curl -fSL 'https:\/\/example\.test\/subminer'/);
});
test('updateLauncherAtPath aborts on hash mismatch and suspicious launcher content', async () => {