Files
spaces-startos/startos/init/taskSetPassword.ts
spacesops 172e3f63ac
Some checks are pending
Build Service / BuildPackage (push) Waiting to run
working
2026-05-14 05:39:56 -04:00

21 lines
643 B
TypeScript

import { showCredentials } from '../actions/showCredentials'
import { storeJson } from '../fileModels/storeJson'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
import { randomPassword } from '../utils'
export const taskSetPassword = sdk.setupOnInit(async (effects) => {
const existing = await storeJson.read((s) => s.password).once()
if (existing) return
await storeJson.merge(
effects,
{ password: randomPassword() },
{ allowWriteAfterConst: true },
)
await sdk.action.createOwnTask(effects, showCredentials, 'critical', {
reason: i18n('Spaces needs an admin password for the web terminal'),
})
})