mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
misc(core): use JsObject instead
This commit is contained in:
parent
e8fd1fb3f4
commit
7640a865e3
|
@ -1,12 +0,0 @@
|
|||
using Jint;
|
||||
using Jint.Native.Object;
|
||||
|
||||
namespace BililiveRecorder.Core.Scripting
|
||||
{
|
||||
internal class PlainOldJsObject : ObjectInstance
|
||||
{
|
||||
public PlainOldJsObject(Engine engine) : base(engine)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -117,11 +117,11 @@ namespace BililiveRecorder.Core.Scripting.Runtime
|
|||
var respString = resp.Content.ReadAsStringAsync().Result;
|
||||
#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits
|
||||
|
||||
var respHeaders = new PlainOldJsObject(this._engine);
|
||||
var respHeaders = new JsObject(this._engine);
|
||||
foreach (var respHeader in resp.Headers)
|
||||
respHeaders.Set(respHeader.Key, string.Join(", ", respHeader.Value));
|
||||
|
||||
var result = new PlainOldJsObject(this._engine);
|
||||
var result = new JsObject(this._engine);
|
||||
result.Set("body", respString);
|
||||
result.Set("headers", respHeaders);
|
||||
result.Set("ok", resp.IsSuccessStatusCode);
|
||||
|
|
|
@ -179,7 +179,7 @@ globalThis.recorderEvents = {};
|
|||
var func = this.ExecuteScriptThenGetEventHandler(log, callbackName);
|
||||
if (func is null) return null;
|
||||
|
||||
var input = new PlainOldJsObject(func.Engine);
|
||||
var input = new JsObject(func.Engine);
|
||||
input.Set("roomid", roomid);
|
||||
input.Set("qn", JsValue.FromObject(func.Engine, qnSetting));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user