Files
spaces-startos/startos/actions/showSubsProverCredentials.ts
T
spacesopsandCursor ad64a47d42
Build Service / BuildPackage (push) Has been cancelled
Release v0.1.1:2 with certrelay, nacho, and prebuilt subspaces.
Remove the embedded explorer/indexer stack, switch subspaces to prebuilt images, add certrelay and nacho as always-on services, expose Spaces and Subs APIs, and wire optional HTTP basic auth for subs and subs-prover with the correct SUBS_BASIC_AUTH_PASSWORD env var.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 12:06:16 -04:00

80 lines
2.3 KiB
TypeScript

import { storeJson } from '../fileModels/storeJson'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
import { SUBSPACES_PROVER_PORT } from '../utils'
export const showSubsProverCredentials = sdk.Action.withoutInput(
// id
'show-subs-prover-credentials',
// metadata
async ({ effects }) => ({
name: i18n('Show Subspaces Prover Auth Credentials'),
description: i18n(
'Display the HTTP basic auth username and password used in front of the Subspaces Prover. Returns blanks if no credentials have been set yet.',
),
warning: null,
allowedStatuses: 'any',
group: null,
visibility: 'enabled',
}),
// run
async ({ effects }) => {
const [subsProverAuth, enabled] = await Promise.all([
storeJson.read((s) => s.subsProverAuth).once(),
storeJson.read((s) => s.subsProverAuthEnabled).once(),
])
const username = subsProverAuth?.username ?? ''
const password = subsProverAuth?.password ?? ''
const status =
enabled === true
? i18n('Auth is ENABLED — these credentials are enforced.')
: i18n(
'Auth is DISABLED — subs-prover is serving unauthenticated. These credentials will take effect when enabled.',
)
const url = subsProverAuth
? `http://${subsProverAuth.username}:${subsProverAuth.password}@127.0.0.1:${SUBSPACES_PROVER_PORT}`
: ''
return {
version: '1',
title: i18n('Show Subspaces Prover Auth Credentials'),
message: status,
result: {
type: 'group',
value: [
{
type: 'single',
name: i18n('SUBS_PROVER_BASIC_AUTH_USER'),
description: null,
value: username,
masked: false,
copyable: true,
qr: false,
},
{
type: 'single',
name: i18n('SUBS_PROVER_BASIC_AUTH_PASSWORD'),
description: null,
value: password,
masked: true,
copyable: true,
qr: false,
},
{
type: 'single',
name: i18n('Connection URL'),
description: null,
value: url,
masked: true,
copyable: true,
qr: false,
},
],
},
}
},
)