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:
joenas
2017-09-12 11:28:56 +02:00
parent b601d5cc64
commit c3c6731d8b
8 changed files with 77 additions and 13 deletions

21
validate_server.lua Normal file
View 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