mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 00:40:51 +01:00
Update socket url matching
This commit is contained in:
parent
9bb98c1739
commit
bea6848fdc
@ -18,7 +18,7 @@ public class NitroHttpProxyFilter extends HttpFiltersAdapter {
|
|||||||
|
|
||||||
private static final String NitroConfigSearch = "socket.url";
|
private static final String NitroConfigSearch = "socket.url";
|
||||||
private static final String NitroClientSearch = "configurationUrls:";
|
private static final String NitroClientSearch = "configurationUrls:";
|
||||||
private static final Pattern NitroConfigPattern = Pattern.compile("[\"']socket\\.url[\"']:.+[\"'](wss?://.*?)[\"']", Pattern.MULTILINE);
|
private static final Pattern NitroConfigPattern = Pattern.compile("[\"']socket\\.url[\"']:(\\s+)?[\"'](wss?:.*?)[\"']", Pattern.MULTILINE);
|
||||||
|
|
||||||
// https://developers.cloudflare.com/fundamentals/get-started/reference/cloudflare-cookies/
|
// https://developers.cloudflare.com/fundamentals/get-started/reference/cloudflare-cookies/
|
||||||
private static final HashSet<String> CloudflareCookies = new HashSet<>(Arrays.asList(
|
private static final HashSet<String> CloudflareCookies = new HashSet<>(Arrays.asList(
|
||||||
@ -95,11 +95,11 @@ public class NitroHttpProxyFilter extends HttpFiltersAdapter {
|
|||||||
final Matcher matcher = NitroConfigPattern.matcher(responseBody);
|
final Matcher matcher = NitroConfigPattern.matcher(responseBody);
|
||||||
|
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
final String originalWebsocket = matcher.group(1);
|
final String originalWebsocket = matcher.group(2).replace("\\/", "/");
|
||||||
final String replacementWebsocket = callback.replaceWebsocketServer(this.url, originalWebsocket);
|
final String replacementWebsocket = callback.replaceWebsocketServer(this.url, originalWebsocket);
|
||||||
|
|
||||||
if (replacementWebsocket != null) {
|
if (replacementWebsocket != null) {
|
||||||
responseBody = responseBody.replace(originalWebsocket, replacementWebsocket);
|
responseBody = responseBody.replace(matcher.group(2), replacementWebsocket);
|
||||||
responseModified = true;
|
responseModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user