update
Some checks failed
Build Gurty / Build Gurty (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 1m33s
Build GurtCA / Build GurtCA (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 11m20s
Build GDExtension / Build GDExtension (libgurt_godot.so, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 16m9s
Build Flumi / Build Flumi (Linux, 4.4.1, ubuntu-latest, linux) (push) Failing after 2h10m11s
Build Flumi / Build Flumi (Windows Desktop, 4.4.1, windows-latest, windows) (push) Has been cancelled
Build GDExtension / Build GDExtension (gurt_godot.dll, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build GurtCA / Build GurtCA (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build Gurty / Build Gurty (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled

This commit is contained in:
2025-11-06 20:02:53 +08:00
parent 3f79614850
commit a508e3cefd
48 changed files with 136 additions and 137 deletions

View File

@@ -12,7 +12,7 @@ static func setup_network_api(vm: LuauVM):
vm.lua_setglobal("fetch")
static func resolve_fetch_url(url: String) -> String:
if url.begins_with("http://") or url.begins_with("https://") or url.begins_with("gurt://"):
if url.begins_with("http://") or url.begins_with("https://") or url.begins_with("lw://"):
return url
var main_node = Engine.get_main_loop().current_scene
@@ -22,9 +22,9 @@ static func resolve_fetch_url(url: String) -> String:
if current_domain.is_empty():
if url.begins_with("/"):
return "gurt://" + url.substr(1)
return "lw://" + url.substr(1)
else:
return "gurt://" + url
return "lw://" + url
return URLUtils.resolve_url(current_domain, url)
@@ -35,7 +35,7 @@ static func _lua_fetch_handler(vm: LuauVM) -> int:
if vm.lua_gettop() >= 2 and vm.lua_istable(2):
options = vm.lua_todictionary(2)
# Resolve relative URLs and default to gurt:// protocol
# Resolve relative URLs and default to lw:// protocol
var url = resolve_fetch_url(original_url)
# Default options
@@ -135,7 +135,7 @@ static func _response_ok_handler(vm: LuauVM) -> int:
return 1
static func make_http_request(url: String, method: String, headers: PackedStringArray, body: String) -> Dictionary:
if url.begins_with("gurt://"):
if url.begins_with("lw://"):
return make_gurt_request(url, method, headers, body)
var http_client = HTTPClient.new()
var response_data = {
@@ -320,7 +320,7 @@ static func make_gurt_request(url: String, method: String, headers: PackedString
"body": ""
}
var domain_part = url.replace("gurt://", "")
var domain_part = url.replace("lw://", "")
if domain_part.contains("/"):
domain_part = domain_part.split("/")[0]