Breaking changes:
Removed port setting (fixes #9) Throw errors when weird/faulty matrix url (work on #10) Added neturl for url parsing
This commit is contained in:
21
validate_server.lua
Normal file
21
validate_server.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local url = require "net.url"
|
||||
|
||||
function validate_server(hs_url)
|
||||
u = url.parse(hs_url):normalize()
|
||||
|
||||
if not (u.host and u.scheme) then
|
||||
return error("'"..hs_url.."' doesn't look like a valid url. Please specify scheme (http/s) and hostname")
|
||||
end
|
||||
|
||||
if u.port and u.port == 8448 and u.scheme == 'http' then
|
||||
return error("Port 8448 is for https, make sure your homeserver URL is correct")
|
||||
end
|
||||
|
||||
if u.port and u.port == 8008 and u.scheme == 'https' then
|
||||
minetest.log("warn", "Port 8008 is not https, make sure your homeserver URL is correct")
|
||||
end
|
||||
|
||||
return hs_url
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user