import { sdk } from '../sdk' import { store } from '../file-models/store.json' const { InputSpec, Value } = sdk export const inputSpec = InputSpec.of({ password: Value.text({ name: 'Admin password', description: 'Password used to access the Munin Bitcoin web interface', required: true, default: null, masked: true, minLength: 12, placeholder: 'Enter admin password', }), }) export const setAdminPassword = sdk.Action.withInput( 'set-admin-password', async ({ effects }) => ({ name: 'Set Admin Password', description: 'Set the password for the Munin Bitcoin admin user', warning: null, allowedStatuses: 'any', group: null, visibility: 'enabled', }), inputSpec, async ({ effects }) => { const current = await store.read().const(effects) return { password: current?.adminPassword ?? null, } }, async ({ effects, input }) => store.merge(effects, { adminPassword: input.password, }), )