diff --git a/app/bin/certimate b/app/certimate similarity index 100% rename from app/bin/certimate rename to app/certimate diff --git a/cmd/install_callback b/cmd/install_callback index c7f9afa..ecca542 100644 --- a/cmd/install_callback +++ b/cmd/install_callback @@ -1,5 +1,24 @@ #!/bin/bash ### This script is called after the user installs the application. +DELETE_CMD="${TRIM_APPDEST}/certimate superuser delete admin@certimate.fun" +CREATE_CMD="${TRIM_APPDEST}/certimate superuser add ${cer_user} ${cer_pwd}" +echo "正在创建新的管理员账户..." +$DELETE_CMD + +if [ $? -eq 0 ]; then + echo "新管理员创建成功" +else + echo "错误:创建新管理员失败" + exit 1 # 如果创建失败,退出并返回错误码 +fi +$CREATE_CMD + +if [ $? -eq 0 ]; then + echo "新管理员创建成功" +else + echo "错误:创建新管理员失败" + exit 1 # 如果创建失败,退出并返回错误码 +fi exit 0 \ No newline at end of file diff --git a/cmd/main b/cmd/main index a9488c3..200af45 100644 --- a/cmd/main +++ b/cmd/main @@ -4,7 +4,7 @@ LOG_FILE="${TRIM_PKGVAR}/info.log" PID_FILE="${TRIM_PKGVAR}/app.pid" # write the command to start your program here -CMD="" +CMD="${TRIM_APPDEST}/certimate -serve ${server_address}:8090 --dir ./pb_data" log_msg() { echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> ${LOG_FILE} diff --git a/manifest b/manifest index fbd2099..334f3bd 100644 --- a/manifest +++ b/manifest @@ -4,7 +4,7 @@ display_name = Certimate desc = 证书自动化部署方案 arch = x86_64 source = thirdparty -maintainer = Krcia +maintainer = certimate distributor = Krcia desktop_uidir = ui desktop_applaunchname = certimate.Application diff --git a/wizard/install.json b/wizard/install.json new file mode 100644 index 0000000..f5345d7 --- /dev/null +++ b/wizard/install.json @@ -0,0 +1,72 @@ +[ + { + "stepTitle": "创建管理员", + "items": [ + { + "type": "text", + "field": "cer_user", + "label": "邮箱", + "initValue": "admin", + "rules": [ + { + "required": true, + "message": "请输入管理员邮箱" + }, + { + "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", + "message": "邮箱格式错误" + } + ] + }, + { + "type": "password", + "field": "cer_pwd", + "label": "管理员密码", + "rules": [ + { + "required": true, + "message": "请输入管理员密码" + }, + { + "min": 8, + "message": "密码长度不能少于8位" + } + ] + }, + { + "type": "password", + "field": "wizard_admin_password_confirm", + "label": "确认密码", + "rules": [ + { + "required": true, + "message": "请确认密码" + } + ] + } + ] + }, + { + "stepTitle": "请选择访问范围", + "type": "select", + "field": "server_address", + "label": "访问范围", + "initValue": "127.0.0.1", + "options": [ + { + "label": "127.0.0.1", + "value": "127.0.0.1" + }, + { + "label": "0.0.0.0", + "value": "0.0.0.0" + } + ], + "rules": [ + { + "required": true, + "message": "请选择访问范围" + } + ] + } +] \ No newline at end of file