Files
Genarrative/scripts/spacetime-authorize-migration-operator.mjs
T
kdletters 187d7735b9 修复编辑器定价持久化与资源预览
将模型定价改为 SpacetimeDB 强类型持久化并兼容旧配置种子迁移
修复快速编辑支付弹窗期间框选显示和交互冻结
补齐后台图片放大以及视频音频资源预览
收紧主站和 External 资源换签授权并记录管理员跨用户审计
固化外部生成入队价格、attempt 钱包结算和最终 lease 失败收口
加固运行时身份轮换、bootstrap secret 与生产构建发布门禁
同步生成绑定、定向测试、运维脚本和项目文档
2026-07-10 18:28:06 +08:00

43 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
import {
callSpacetimeProcedure,
callSpacetimeProcedureViaCli,
ensureProcedureOk,
parseArgs,
resolveBootstrapSecret,
} from './spacetime-migration-common.mjs';
try {
const options = parseArgs(process.argv.slice(2));
if (!options.operatorIdentity) {
throw new Error('必须传入 --operator-identity。');
}
const input = {
bootstrap_secret: await resolveBootstrapSecret(options),
operator_identity_hex: options.operatorIdentity,
note: options.note || '',
};
if (options.useHttp && !options.token) {
throw new Error('--use-http 需要同时传入 --token。');
}
const result = options.useHttp
? await callSpacetimeProcedure(options, 'authorize_database_migration_operator', input)
: await callSpacetimeProcedureViaCli(
options,
'authorize_database_migration_operator',
input,
);
ensureProcedureOk(result);
console.log(
`[spacetime:migration:operator] 已授权 ${result.operator_identity_hex ?? options.operatorIdentity}`,
);
} catch (error) {
console.error(
`[spacetime:migration:operator] ${error instanceof Error ? error.message : String(error)}`,
);
process.exit(1);
}