try to find string strip bug

This commit is contained in:
sevenrats 2023-09-10 15:40:39 -04:00
parent f29cddfdc1
commit bffaf0691e

View File

@ -189,8 +189,11 @@ function inferServerUrl(url as string) as string
' TODO ' TODO
' if response code is a 300 redirect then we should return the redirect url ' if response code is a 300 redirect then we should return the redirect url
' Make sure this happens or make it happen ' Make sure this happens or make it happen
if resp.GetResponseCode() = 200 and isJellyfinServer(resp.GetString()) if resp.GetResponseCode() = 200
selectedUrl = hosts.lookup(resp.GetSourceIdentity().ToStr()) selectedUrl = hosts.lookup(resp.GetSourceIdentity().ToStr())
print("CANDIDATE:")
print(selectedUrl)
isJellyfinServer(resp.GetString())
print "Successfully inferred server URL: " selectedUrl print "Successfully inferred server URL: " selectedUrl
return selectedUrl return selectedUrl
end if end if
@ -215,7 +218,10 @@ function urlCandidates(input as string)
host = url[2] host = url[2]
port = url[3] port = url[3]
path = url[4] path = url[4]
if path.endswith("/", 1) then path = path.Left(len(path) - 1) print "THE PATH IS: " path
print "The type of path is: " Type(path)
if path.endswith("/") then path = path.Left(len(path) - 1)
print "THE PATH AFTER I MODIFY IT: " path
protoCandidates = [] protoCandidates = []
supportedProtos = ["http:", "https:"] ' appending colons because the regex does supportedProtos = ["http:", "https:"] ' appending colons because the regex does
if proto = "none:" ' the user did not declare a protocol if proto = "none:" ' the user did not declare a protocol
@ -439,9 +445,10 @@ sub stopLoadingSpinner()
end if end if
end sub end sub
' accepts the raw json string of /system/info/public and returns function isJellyfinServer(si as object) as boolean
' a boolean indicating if ProductName is "Jellyfin Server" 'v = ParseJson(si).ProductName = "Jellyfin Server"
function isJellyfinServer(si as string) as boolean print "THE SI SENT TO THE ISJELLYFIN CHECK"
print si
d = ParseJson(si) d = ParseJson(si)
if isValid(d) and isValid(d.ProductName) if isValid(d) and isValid(d.ProductName)
return d.ProductName = "Jellyfin Server" return d.ProductName = "Jellyfin Server"