Code refactoring for xiaomi source

This commit is contained in:
Alex X
2026-01-17 10:06:13 +03:00
parent 9a1eac8ef4
commit 425fcffbe1
5 changed files with 14 additions and 40 deletions
+3 -3
View File
@@ -99,12 +99,12 @@ func getCameraURL(url *url.URL) (string, error) {
// The getMissURL request has a fallback to getP2PURL.
// But for known models we can save one request to the cloud.
if xiaomi.IsLegacy(model) {
return getP2PURL(url)
return getLegacyURL(url)
}
return getMissURL(url)
}
func getP2PURL(url *url.URL) (string, error) {
func getLegacyURL(url *url.URL) (string, error) {
query := url.Query()
clientPublic, clientPrivate, err := crypto.GenerateKey()
@@ -161,7 +161,7 @@ func getMissURL(url *url.URL) (string, error) {
res, err := cloudUserRequest(url.User, "/v2/device/miss_get_vendor", params)
if err != nil {
if strings.Contains(err.Error(), "no available vendor support") {
return getP2PURL(url)
return getLegacyURL(url)
}
return "", err
}