Commit b704e12c authored by nanahira's avatar nanahira

support manual login

parent 9a3329a8
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
* `username` `password` 萌卡帐号密码,需要有那个 app 的打包权限。 * `username` `password` 萌卡帐号密码,需要有那个 app 的打包权限。
* `token` 现成的登录 token,如果登录过的话。
* `appVersion` APP 版本号,如果不存在则从 APP 信息获取最新版本号。 * `appVersion` APP 版本号,如果不存在则从 APP 信息获取最新版本号。
* `platform` `arch` `locale` APP Depot 信息,空缺字段则用 `generic` 补全。 * `platform` `arch` `locale` APP Depot 信息,空缺字段则用 `generic` 补全。
apiRoot=https://sapi.moecube.com:444 apiRoot=https://sapi.moecube.com:444
loginInfo=$(curl -sL -X POST $apiRoot/accounts/signin -d account=$username -d password=$password) if [[ -z "$token" ]]; then
loginExitCode="$?" loginInfo=$(curl -sL -X POST $apiRoot/accounts/signin -d account=$username -d password=$password)
loginErrorMessage=$(echo "$loginInfo" | jq '.message' | sed 's/"//g') loginExitCode="$?"
if [[ "$loginErrorMessage" != "null" ]]; then loginErrorMessage=$(echo "$loginInfo" | jq '.message' | sed 's/"//g')
echo "Login failed: $loginErrorMessage" if [[ "$loginErrorMessage" != "null" ]]; then
exit 1 echo "Login failed: $loginErrorMessage"
exit 1
fi
token=$(echo "$loginInfo" | jq '.token' | sed 's/"//g')
fi fi
token=$(echo "$loginInfo" | jq '.token' | sed 's/"//g')
header="Authorization: $token" header="Authorization: $token"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment