more updates for script plugin helper and corresponding VPNDetection update to properly send user gent
This commit is contained in:
parent
520a76a15e
commit
c3be7f7de5
@ -34,11 +34,6 @@ public class ScriptPluginHelper
|
||||
RequestUrl(new ScriptPluginWebRequest(url, Headers: headers), callback);
|
||||
}
|
||||
|
||||
public void GetUrl(string url, Dictionary<string, string> headers, Delegate callback)
|
||||
{
|
||||
RequestUrl(new ScriptPluginWebRequest(url, Headers: headers), callback);
|
||||
}
|
||||
|
||||
public void PostUrl(string url, string body, string bearerToken, Delegate callback)
|
||||
{
|
||||
var headers = new Dictionary<string, string> { { "Authorization", $"Bearer {bearerToken}" } };
|
||||
@ -46,11 +41,6 @@ public class ScriptPluginHelper
|
||||
new ScriptPluginWebRequest(url, body, "POST", Headers: headers), callback);
|
||||
}
|
||||
|
||||
public void PostUrl(string url, string body, Dictionary<string, string> headers, Delegate callback)
|
||||
{
|
||||
RequestUrl(new ScriptPluginWebRequest(url, body, "POST", Headers: headers), callback);
|
||||
}
|
||||
|
||||
public void RequestUrl(ScriptPluginWebRequest request, Delegate callback)
|
||||
{
|
||||
Task.Run(() =>
|
||||
|
@ -191,13 +191,15 @@ const plugin = {
|
||||
}
|
||||
|
||||
const userAgent = `IW4MAdmin-${this.manager.getApplicationSettings().configuration().id}`;
|
||||
const headers = {
|
||||
'User-Agent': userAgent
|
||||
};
|
||||
const stringDict = System.Collections.Generic.Dictionary(System.String, System.String);
|
||||
const headers = new stringDict();
|
||||
headers.add('User-Agent', userAgent);
|
||||
const pluginScript = importNamespace('IW4MAdmin.Application.Plugin.Script');
|
||||
const request = new pluginScript.ScriptPluginWebRequest(`https://api.xdefcon.com/proxy/check/?ip=${origin.IPAddressString}`,
|
||||
null, 'GET', 'application/json', headers);
|
||||
|
||||
try {
|
||||
this.pluginHelper.getUrl(`https://api.xdefcon.com/proxy/check/?ip=${origin.IPAddressString}`, headers,
|
||||
(response) => this.onVpnResponse(response, origin));
|
||||
this.pluginHelper.requestUrl(request, (response) => this.onVpnResponse(response, origin));
|
||||
|
||||
} catch (ex) {
|
||||
this.logger.logWarning('There was a problem checking client IP ({IP}) for VPN - {message}',
|
||||
|
Loading…
Reference in New Issue
Block a user