Skip to content

Commit ab6c300

Browse files
authored
Merge pull request #32 from remcoros/feat/frigate
feat: add Frigate as selectable Electrum server backend
2 parents cc3fba9 + c0b0d3b commit ab6c300

7 files changed

Lines changed: 71 additions & 14 deletions

File tree

startos/actions/config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export const inputSpec = InputSpec.of({
5858
server: Value.dynamicUnion(async ({ effects }) => {
5959
// determine default server type and disabled options
6060
const installedPackages = await effects.getInstalledPackages()
61-
let serverType: 'fulcrum' | 'electrs' | 'bitcoind' | 'public' = 'public'
61+
let serverType:
62+
| 'frigate'
63+
| 'fulcrum'
64+
| 'electrs'
65+
| 'bitcoind'
66+
| 'public' = 'public'
6267
let disabled: string[] = []
6368

6469
if (installedPackages.includes('bitcoind')) {
@@ -79,12 +84,25 @@ export const inputSpec = InputSpec.of({
7984
disabled.push('fulcrum')
8085
}
8186

87+
// frigate takes priority as default when installed
88+
if (installedPackages.includes('frigate')) {
89+
serverType = 'frigate'
90+
} else {
91+
disabled.push('frigate')
92+
}
93+
8294
return {
8395
name: 'Server',
8496
description: 'Bitcoin/Electrum Server',
8597
default: serverType,
8698
disabled: disabled,
8799
variants: Variants.of({
100+
frigate: {
101+
name:
102+
'Frigate' +
103+
(disabled.includes('frigate') ? ' (not installed)' : ''),
104+
spec: InputSpec.of({}),
105+
},
88106
fulcrum: {
89107
name:
90108
'Fulcrum (recommended)' +

startos/dependencies.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export const setDependencies = sdk.setupDependencies(async ({ effects }) => {
1717

1818
if (serverType == 'fulcrum') {
1919
deps['fulcrum'] = { kind: 'exists', versionRange: '>=2.1.0:1' }
20+
} else if (serverType == 'frigate') {
21+
deps['frigate'] = { kind: 'exists', versionRange: '>=1.5.2:0' }
2022
} else if (serverType == 'electrs') {
21-
deps['electrs'] = { kind: 'exists', versionRange: '>=0.10.9:1-alpha.1' }
23+
deps['electrs'] = { kind: 'exists', versionRange: '>=0.11.1:0' }
2224
} else if (serverType == 'bitcoind') {
23-
deps['bitcoind'] = { kind: 'exists', versionRange: '>=28.1:3-alpha.4' }
25+
deps['bitcoind'] = { kind: 'exists', versionRange: '>=28.3:0' }
2426
}
2527

2628
if (proxyType == 'tor') {

startos/fileModels/store.yaml.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const shape = z.object({
1111
server: z.object({
1212
type: z
1313
.union([
14+
z.literal('frigate'),
1415
z.literal('fulcrum'),
1516
z.literal('electrs'),
1617
z.literal('bitcoind'),
@@ -46,13 +47,15 @@ export const createDefaultStore = async (effects: T.Effects) => {
4647
// config file does not exist, create it
4748
console.log('Sparrow config file does not exist, creating it')
4849
const installedPackages = await effects.getInstalledPackages()
49-
const serverType = installedPackages.includes('fulcrum')
50-
? 'fulcrum'
51-
: installedPackages.includes('electrs')
52-
? 'electrs'
53-
: installedPackages.includes('bitcoind')
54-
? 'bitcoind'
55-
: 'public'
50+
const serverType = installedPackages.includes('frigate')
51+
? 'frigate'
52+
: installedPackages.includes('fulcrum')
53+
? 'fulcrum'
54+
: installedPackages.includes('electrs')
55+
? 'electrs'
56+
: installedPackages.includes('bitcoind')
57+
? 'bitcoind'
58+
: 'public'
5659

5760
await store.write(effects, {
5861
title: 'Sparrow on StartOS',

startos/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ export const main = sdk.setupMain(async ({ effects }) => {
106106
serverType: 'ELECTRUM_SERVER',
107107
electrumServer: 'tcp://fulcrum.startos:50001',
108108
}
109+
} else if (conf.sparrow.server.type == 'frigate') {
110+
sparrowConfig = {
111+
...sparrowConfig,
112+
serverType: 'ELECTRUM_SERVER',
113+
electrumServer: 'tcp://frigate.startos:50001',
114+
}
109115
} else if (conf.sparrow.server.type == 'electrs') {
110116
sparrowConfig = {
111117
...sparrowConfig,
@@ -201,7 +207,8 @@ export const main = sdk.setupMain(async ({ effects }) => {
201207

202208
if (
203209
conf.sparrow.server.type == 'electrs' ||
204-
conf.sparrow.server.type == 'fulcrum'
210+
conf.sparrow.server.type == 'fulcrum' ||
211+
conf.sparrow.server.type == 'frigate'
205212
) {
206213
return {
207214
message: i18n('Using local electrum server'),

startos/manifest/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ export const manifest = setupManifest({
6666
icon: 'https://raw.githubusercontent.com/Start9Labs/fulcrum-startos/master/icon.png',
6767
},
6868
},
69+
frigate: {
70+
description: 'Used to connect to your Bitcoin node.',
71+
optional: true,
72+
metadata: {
73+
title: 'Frigate',
74+
icon: 'https://raw.githubusercontent.com/remcoros/frigate-startos/master/icon.png',
75+
},
76+
},
6977
tor: {
7078
description: 'Used to route Sparrow traffic through Tor for privacy.',
7179
optional: true,

startos/versions/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { VersionGraph } from '@start9labs/start-sdk'
2-
import { v2_5_1, SPARROW_VERSION } from './v2_5_1'
2+
import { v2_5_1_1, SPARROW_VERSION } from './v2_5_1_1'
3+
import { v2_5_1 } from './v2_5_1'
34
import { v2_4_2 } from './v2_4_2'
45

56
export const versionGraph = VersionGraph.of({
6-
current: v2_5_1,
7-
other: [v2_4_2],
7+
current: v2_5_1_1,
8+
other: [v2_5_1, v2_4_2],
89
})
910

1011
export { SPARROW_VERSION }

startos/versions/v2_5_1_1.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { VersionInfo } from '@start9labs/start-sdk'
2+
3+
export const v2_5_1_1 = VersionInfo.of({
4+
version: '2.5.1:1',
5+
releaseNotes: {
6+
en_US: 'Add Frigate as a selectable Electrum server backend',
7+
es_ES: 'Añadir Frigate como servidor Electrum seleccionable',
8+
de_DE: 'Frigate als auswählbares Electrum-Server-Backend hinzufügen',
9+
pl_PL: 'Dodaj Frigate jako wybieralny serwer Electrum',
10+
fr_FR: 'Ajouter Frigate comme backend serveur Electrum sélectionnable',
11+
},
12+
migrations: {
13+
up: async ({ effects }) => {},
14+
down: async ({ effects }) => {},
15+
},
16+
})
17+
18+
export const SPARROW_VERSION = '2.5.1'

0 commit comments

Comments
 (0)