update
This commit is contained in:
@@ -67,15 +67,15 @@ static func resolve_gurt_domain(domain: String) -> String:
|
||||
|
||||
static func get_error_type(error_message: String) -> Dictionary:
|
||||
if "DNS server is not responding" in error_message or "Domain not found" in error_message:
|
||||
return {"code": "ERR_NAME_NOT_RESOLVED", "title": "This site can't be reached", "icon": "? :("}
|
||||
return {"code": "ERR_NAME_NOT_RESOLVED", "title": "无法连接到站点", "icon": "? :("}
|
||||
elif "timeout" in error_message.to_lower() or "timed out" in error_message.to_lower():
|
||||
return {"code": "ERR_CONNECTION_TIMED_OUT", "title": "This site can't be reached", "icon": "...?"}
|
||||
return {"code": "ERR_CONNECTION_TIMED_OUT", "title": "连接网站中超时", "icon": "...?"}
|
||||
elif "Failed to fetch" in error_message or "No response" in error_message:
|
||||
return {"code": "ERR_CONNECTION_REFUSED", "title": "This site can't be reached", "icon": ">:("}
|
||||
return {"code": "ERR_CONNECTION_REFUSED", "title": "连接出现问题", "icon": ">:("}
|
||||
elif "Invalid domain format" in error_message:
|
||||
return {"code": "ERR_INVALID_URL", "title": "This page isn't working", "icon": ":|"}
|
||||
return {"code": "ERR_INVALID_URL", "title": "页面没有在运作", "icon": ":|"}
|
||||
else:
|
||||
return {"code": "ERR_UNKNOWN", "title": "Something went wrong", "icon": ">_<"}
|
||||
return {"code": "ERR_UNKNOWN", "title": "出现未知错误", "icon": ">_<"}
|
||||
|
||||
static func create_error_page(error_message: String) -> PackedByteArray:
|
||||
var error_info = get_error_type(error_message)
|
||||
@@ -118,14 +118,14 @@ static func create_error_page(error_message: String) -> PackedByteArray:
|
||||
<div style="error-code">""" + error_info.code + """</div>
|
||||
|
||||
<div style="suggestions">
|
||||
<h2 style="suggestion-title">Try:</h2>
|
||||
<h2 style="suggestion-title">请尝试:</h2>
|
||||
<ul style="suggestion-list">
|
||||
<li style="suggestion-item">Checking if the domain is correctly registered</li>
|
||||
<li style="suggestion-item">Verifying your DNS server is running</li>
|
||||
<li style="suggestion-item">Checking your internet connection</li>
|
||||
<li style="suggestion-item">检查域名是否注册成功</li>
|
||||
<li style="suggestion-item">检查DNS服务器是否配置在正确</li>
|
||||
<li style="suggestion-item">检查你的网络连接</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button style="retry-button" id="reload">Reload</button>
|
||||
<button style="retry-button" id="reload">重新加载</button>
|
||||
</div>
|
||||
</body>""").to_utf8_buffer()
|
||||
|
||||
@@ -212,7 +212,7 @@ func play_appear_animation(target_width: float) -> void:
|
||||
var should_hide_text = target_width < TEXT_HIDE_THRESHOLD
|
||||
|
||||
close_button.visible = not should_hide_close
|
||||
button.text = "" if should_hide_text else button.get_meta("original_text", "New Tab")
|
||||
button.text = "" if should_hide_text else button.get_meta("original_text", "新标签页")
|
||||
|
||||
var should_show_gradient = not should_hide_text and not should_hide_close
|
||||
gradient_texture.visible = should_show_gradient
|
||||
|
||||
@@ -37,21 +37,14 @@ input[type="date"] { w-28 text-[16px] bg-[#1b1b1b] rounded-md text-white hover:b
|
||||
|
||||
var HTML_CONTENT = """
|
||||
<head>
|
||||
<title>New tab</title>
|
||||
<script>
|
||||
local items = {"Hi","Hello","Salut","Bonjour","Hola","Ciao","Hallo","Hej","Hei","Ola","Privet","Zdravstvuyte","Konnichiwa","Ni hao","Annyeonghaseyo","Merhaba","Selam","Habari","Shalom","Namaste","Marhaba","Geia","Sawasdee","Selamat","Halo","Kumusta","Sawubona","Jambo","Aloha","Goddag","Tere","Moikka","Sveiki"}
|
||||
local h = gurt.select(".target")
|
||||
local res = items[math.random(#items)] .. "!"
|
||||
|
||||
h.text = res
|
||||
</script>
|
||||
<title>新标签页</title>
|
||||
</head>
|
||||
<body style="bg-[#323949] text-white font-sans">
|
||||
<postprocess preset="crt"></postprocess>
|
||||
<div style="flex flex-col items-center justify-center w-full mt-12">
|
||||
<h1 style="target text-8xl font-bold mb-4 text-[#4a9eff] font-serif font-italic">Hello!</h1>
|
||||
<p style="text-lg mb-8 text-[#cccccc]">Start browsing by typing in the omnibar.</p>
|
||||
|
||||
<p style="mb-2">Happy GURT:// exploration!</p>
|
||||
<h1 style="target text-8xl font-bold mb-4 text-[#4a9eff] font-serif font-italic">你好!</h1>
|
||||
<p style="text-lg mb-8 text-[#cccccc]">欢迎使用LeonBrowser</p>
|
||||
<p style="text-lg mb-8 text-[#cccccc]">使用搜索栏进行搜索</p>
|
||||
</div>
|
||||
</body>
|
||||
""".to_utf8_buffer()
|
||||
|
||||
@@ -23,7 +23,7 @@ static func get_user_agent() -> String:
|
||||
_:
|
||||
arch = "Unknown"
|
||||
|
||||
var user_agent = "Mozilla/5.0 (%s; %s) Flumi/%s GurtKit/%s Godot/%s.%s.%s (gurted.com)" % [
|
||||
var user_agent = "Mozilla/5.0 (%s; %s) LeonBrowser/%s LeonWWWKit/%s Godot/%s.%s.%s (gurted.com)" % [
|
||||
os_name,
|
||||
arch,
|
||||
app_version,
|
||||
|
||||
Reference in New Issue
Block a user