initial relay scaffold

This commit is contained in:
local
2026-05-11 20:03:27 -05:00
commit b9d86fa303
58 changed files with 7609 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
import { sdk } from '../sdk'
import { configFile } from '../file-models/config.json'
const { InputSpec, Value } = sdk
// Where the relay calls to validate licenses. Defaults to the public
// Keysat endpoint. Operators running Keysat on the same Start9 server
// can override to the internal hostname (e.g. http://keysat.startos:3000)
// for a lower-latency hot path — every relay request hits this for the
// cached online check.
const inputSpec = InputSpec.of({
relay_keysat_base_url: Value.text({
name: 'Keysat Base URL',
description:
"URL of the Keysat license server. Defaults to https://keysat.xyz. If you're running Keysat as a co-located StartOS package, override to the internal hostname (http://keysat.startos:<port>) to skip the public-internet roundtrip.",
required: true,
default: 'https://keysat.xyz',
minLength: 8,
maxLength: 256,
patterns: [
{
regex: '^https?://.+$',
description: 'Must start with http:// or https://',
},
],
}),
})
export const setKeysatBaseUrl = sdk.Action.withInput(
'set-keysat-base-url',
async ({ effects }) => ({
name: 'Set Keysat URL',
description:
"Where the relay validates Recap user licenses. Defaults to https://keysat.xyz — override to a co-located internal hostname if Keysat is on the same Start9 server.",
warning: null,
allowedStatuses: 'any',
group: null,
visibility: 'enabled',
}),
inputSpec,
async ({ effects }) => {
const config = await configFile.read().once()
return {
relay_keysat_base_url: config?.relay_keysat_base_url || 'https://keysat.xyz',
}
},
async ({ effects, input }) => {
await configFile.merge(effects, {
relay_keysat_base_url: (input.relay_keysat_base_url || '').trim(),
})
return null
},
)