Skip to content

Commit

Permalink
minor proxy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bierdosenhalter committed Nov 10, 2024
1 parent b6eba9e commit 227701f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
19 changes: 16 additions & 3 deletions Client/Network/Web/WebBrowserProxyThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ private async Task HandleIncomingConnections()
{
var htmlData = result.Content.ReadAsStringAsync().Result;

// Replace add anchor tags to lua links
htmlData = Regex.Replace(htmlData, @"<lua>([^<]*?)((https?:\/\/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_\+.~#?&//=]*)([^<]*?))+</lua>",
m =>
{
string ret = "<lua>";

ret += m.Groups[1].Value;

for (int i = 0; i < m.Groups[3].Captures.Count; i++)
{
ret += "<a href=\"" + m.Groups[3].Captures[i].Value + "\">" + m.Groups[3].Captures[i].Value + "</a>" + m.Groups[4].Captures[i].Value;
}

return ret + "</lua>";
});

// Replace lua tags
htmlData = htmlData.Replace("<lua>", "<pre><code class=\"language-clike\">");
htmlData = htmlData.Replace("</lua>", "</code></pre>");
Expand All @@ -164,9 +180,6 @@ private async Task HandleIncomingConnections()
// Remove size tags
htmlData = Regex.Replace(htmlData, "<([^>]*?)(size=\"(.*?)\")(.*?)>", "<$1$4>");

// Remove bgcolor tags
//htmlData = Regex.Replace(htmlData, "<([^>]*?)(bgcolor=\"(.*?)\")(.*?)>", "<$1$4>");

// Add some style informations
htmlData = htmlData.Replace("</head>",
"<link href=\"https://prismjs.com/themes/prism.css\" rel=\"stylesheet\" />\r\n" +
Expand Down
15 changes: 11 additions & 4 deletions Client/RyzomClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public RyzomClient(bool autoStart = true)
_interfaceManager = new InterfaceManager(this);
_networkManager = new NetworkManager(this);
_actionHandlerManager = new ActionHandlerManager(this);

// create the data dir
if (!Directory.Exists("data")) Directory.CreateDirectory("data");

Expand Down Expand Up @@ -953,7 +953,14 @@ private void TimeoutDetector()

while (true)
{
Thread.Sleep(TimeSpan.FromSeconds(10));
try
{
Thread.Sleep(TimeSpan.FromSeconds(10));
}
catch
{
return;
}

if (_networkConnection.ConnectionState == ConnectionState.NotInitialized ||
_networkConnection.ConnectionState == ConnectionState.Connected)
Expand Down Expand Up @@ -1314,7 +1321,7 @@ public IEnumerable<string> AutoComplete(string behindCursor)
var stringManager = GetApiStringManager();
var networkManager = GetApiNetworkManager();

if (databaseManager == null || stringManager == null || networkManager == null)
if (databaseManager == null || stringManager == null || networkManager == null)
return ret;

for (var gm = 0; gm < 7; gm++)
Expand All @@ -1325,7 +1332,7 @@ public IEnumerable<string> AutoComplete(string behindCursor)
var nameId = databaseManager.GetProp($"SERVER:GROUP:{gm}:NAME");
stringManager.GetString((uint)nameId, out var name, networkManager);
name = EntityHelper.RemoveTitleAndShardFromName(name);
if(!ret.Contains(name))
if (!ret.Contains(name))
ret.Add(name);
}
}
Expand Down

0 comments on commit 227701f

Please sign in to comment.