Files
spacesopsandCursor 073344d4d1
Build Service / BuildPackage (push) Canceled after 0s
0.3.0:1
Group Actions and Config by category (Space-CLI, Bitcoin, Spaced,
Subspaces, Certrelay, Nacho) and build x86 + arm only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 03:34:34 -04:00

84 lines
2.0 KiB
TypeScript

import { storeJson } from '../fileModels/storeJson'
import { actionGroups } from '../actionGroups'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
import { dataDir, SPACED_CHAIN } from '../utils'
export const syncStatus = sdk.Action.withoutInput(
// id
'sync-status',
// metadata
async ({ effects }) => ({
name: i18n('Sync Status'),
description: i18n(
"Query spaced's getserverinfo RPC and report sync progress",
),
warning: null,
allowedStatuses: 'only-running',
group: actionGroups.spaced,
visibility: 'enabled',
}),
// run
async ({ effects }) => {
const spacedAuth = await storeJson.read((s) => s.spacedAuth).once()
if (!spacedAuth) {
return {
version: '1',
title: i18n('Failure'),
message: i18n('Could not query spaced. Is the service running?'),
result: null,
}
}
const res = await sdk.SubContainer.withTemp(
effects,
{ imageId: 'spaces' },
sdk.Mounts.of().mountVolume({
volumeId: 'main',
subpath: null,
mountpoint: dataDir,
readonly: false,
}),
'spaces-sync-status',
(subc) =>
subc.exec([
'/root/.cargo/bin/space-cli',
'--chain',
SPACED_CHAIN,
'--rpc-user',
spacedAuth.username,
'--rpc-password',
spacedAuth.password,
'getserverinfo',
]),
)
if (res.exitCode !== 0) {
return {
version: '1',
title: i18n('Failure'),
message: i18n('Could not query spaced. Is the service running?'),
result: null,
}
}
const stdout = (res.stdout ?? '').toString().trim()
return {
version: '1',
title: i18n('Sync Status'),
message: stdout || i18n('Sync Status'),
result: {
type: 'single',
name: 'getserverinfo',
description: null,
value: stdout,
masked: false,
copyable: true,
qr: false,
},
}
},
)