hostname optimizations

This commit is contained in:
Leon van Kammen 2026-08-21 11:47:02 +02:00
parent 737ac2bfef
commit 26d1bfbd1e
5 changed files with 11 additions and 331 deletions

View file

@ -5,7 +5,7 @@ return function(app)
local config = { -- default
name = "XRForge",
baseurl="/",
host="localhost",
hostname="",
admin_title = "admin panel",
admin_subtitle = "Manage your XR experiences here",
admin_user = "admin",

View file

@ -89,9 +89,14 @@ util.getURL = function(url,opts)
return 'http://localhost:' .. app.port .. url
else
port = ':' .. GetPort()
if port == ':80' then port = '' end
if port == ':80' then port = '' end
if arg[1] == 'generate' and port == ':8080' then port = '' end
return GetScheme() .. '://' .. (app.opts.host or GetHost()) .. port .. (url or GetPath())
-- if hostname is not localhost or ip then we can assume live server (reverse proxy e.g.)
if port and not GetHost():match('localhost') and not GetHost():match('^[0-9]') then
port = ''
end
local host = #app.opts.hostname > 0 and app.opts.hostname or GetHost()
return GetScheme() .. '://' .. host .. port .. (url or GetPath())
end
end

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 117 KiB

View file

@ -214,9 +214,6 @@ div#xrecosystem{
<b>Hello</b> post-scarcity technology.
<br><br>
<center>
<img src="img/xrforge_term.svg" style="border-radius:7px; border-radius: 7px; width: 100%; max-width: 450px; margin-bottom: 40px;">
</center>
</div>
<div class="spectrum">
@ -242,12 +239,12 @@ div#xrecosystem{
<tr>
<td>users can host content themselves</td>
<td><small>HTTP/DAT/IPFS Open Protocols</small></td>
<td><small>we own your data</small></td>
<td><small>they own your data</small></td>
</tr>
<tr>
<td>User operated content and viewers</td>
<td></td>
<td><small>we control both</small></td>
<td><small>they control both</small></td>
</tr>
<tr>
<td>portals to remote content</td>

View file

@ -21,7 +21,7 @@ end}
{if items then
function getURL(url)
if app.arg[1] == 'generate' and url:match("://") then
if app.arg[1] == 'generate' or url:match("://") then
url = 'janusweb/index.html#janus.url=' ..
EscapeFragment( url ) .. '&janus.referrer=' .. util.getURL(urlpath )
url = util.baseURLify(url)