tree: add some sanity check

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-16 21:53:43 +01:00
parent 5fa2c3a1c6
commit 5f030c2349
3 changed files with 5 additions and 5 deletions

View File

@ -1229,7 +1229,7 @@ function getCMDline () {
function uploadDiag () { function uploadDiag () {
if [ -f "${TMP_PATH}/sysinfo.yml" ]; then if [ -f "${TMP_PATH}/sysinfo.yml" ]; then
HWID="$(genHWID)" HWID="$(genHWID)"
curl -sk -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}" 2>/dev/null curl -sk -m 20 -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}" 2>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Your Code: ${HWID}" 5 40 dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Your Code: ${HWID}" 5 40
else else
@ -2288,7 +2288,7 @@ function checkHardwareID() {
HWID="$(genHWID)" HWID="$(genHWID)"
USERID="$(curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)" USERID="$(curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)"
if echo "${USERID}" | grep -vq "Hardware ID"; then if echo "${USERID}" | grep -vq "Hardware ID"; then
cp -f "${S_FILE}" "${S_FILE}.bak" [ ! -f "${S_FILE}" ] && cp -f "${S_FILE}" "${S_FILE}.bak" 2>/dev/null || true
if curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" -o "${S_FILE}" 2>/dev/null; then if curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" -o "${S_FILE}" 2>/dev/null; then
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
@ -2299,6 +2299,7 @@ function checkHardwareID() {
USERID="" USERID=""
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
fi fi
else else
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
@ -2307,6 +2308,7 @@ function checkHardwareID() {
USERID="" USERID=""
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
fi fi
return return
} }

View File

@ -92,8 +92,6 @@ function arcModel() {
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs updateConfigs
fi fi
# Check for Hardware ID
checkHardwareID
dialog --backtitle "$(backtitlep)" --title "Model" \ dialog --backtitle "$(backtitlep)" --title "Model" \
--infobox "Reading Models..." 3 25 --infobox "Reading Models..." 3 25
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"

View File

@ -362,7 +362,7 @@ function updateConfigs() {
dialog --backtitle "$(backtitle)" --title "Update Configs" \ dialog --backtitle "$(backtitle)" --title "Update Configs" \
--infobox "Update successful!" 3 50 --infobox "Update successful!" 3 50
sleep 2 sleep 2
[ -z "${USERID}" ] && checkHardwareID || true [ -n "${USERID}" ] && checkHardwareID || true
else else
return 1 return 1
fi fi