mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
feat(core): add danmaku workaround with toggle
add danmaku masked username workaround add new advcaned settings
This commit is contained in:
parent
b13aa6816e
commit
14c8fde4a4
|
@ -42,6 +42,7 @@ namespace BililiveRecorder.Cli.Configure
|
|||
TimingWatchdogTimeout,
|
||||
RecordDanmakuFlushInterval,
|
||||
DanmakuTransport,
|
||||
DanmakuAuthenticateWithStreamerUid,
|
||||
NetworkTransportUseSystemProxy,
|
||||
NetworkTransportAllowedAddressFamily,
|
||||
UserScript
|
||||
|
@ -99,6 +100,7 @@ namespace BililiveRecorder.Cli.Configure
|
|||
GlobalConfig.Add(GlobalConfigProperties.TimingWatchdogTimeout, new ConfigInstruction<GlobalConfig, uint>(config => config.HasTimingWatchdogTimeout = false, (config, value) => config.TimingWatchdogTimeout = value) { Name = "TimingWatchdogTimeout", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.RecordDanmakuFlushInterval, new ConfigInstruction<GlobalConfig, uint>(config => config.HasRecordDanmakuFlushInterval = false, (config, value) => config.RecordDanmakuFlushInterval = value) { Name = "RecordDanmakuFlushInterval", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.DanmakuTransport, new ConfigInstruction<GlobalConfig, DanmakuTransportMode>(config => config.HasDanmakuTransport = false, (config, value) => config.DanmakuTransport = value) { Name = "DanmakuTransport", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.DanmakuAuthenticateWithStreamerUid, new ConfigInstruction<GlobalConfig, bool>(config => config.HasDanmakuAuthenticateWithStreamerUid = false, (config, value) => config.DanmakuAuthenticateWithStreamerUid = value) { Name = "DanmakuAuthenticateWithStreamerUid", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.NetworkTransportUseSystemProxy, new ConfigInstruction<GlobalConfig, bool>(config => config.HasNetworkTransportUseSystemProxy = false, (config, value) => config.NetworkTransportUseSystemProxy = value) { Name = "NetworkTransportUseSystemProxy", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.NetworkTransportAllowedAddressFamily, new ConfigInstruction<GlobalConfig, AllowedAddressFamily>(config => config.HasNetworkTransportAllowedAddressFamily = false, (config, value) => config.NetworkTransportAllowedAddressFamily = value) { Name = "NetworkTransportAllowedAddressFamily", CanBeOptional = true });
|
||||
GlobalConfig.Add(GlobalConfigProperties.UserScript, new ConfigInstruction<GlobalConfig, string>(config => config.HasUserScript = false, (config, value) => config.UserScript = value) { Name = "UserScript", CanBeOptional = true });
|
||||
|
|
|
@ -202,6 +202,11 @@ namespace BililiveRecorder.Core.Config.V3
|
|||
/// </summary>
|
||||
public DanmakuTransportMode DanmakuTransport => this.GetPropertyValue<DanmakuTransportMode>();
|
||||
|
||||
/// <summary>
|
||||
/// 使用直播间主播的uid进行弹幕服务器认证
|
||||
/// </summary>
|
||||
public bool DanmakuAuthenticateWithStreamerUid => this.GetPropertyValue<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用系统代理
|
||||
/// </summary>
|
||||
|
@ -446,6 +451,14 @@ namespace BililiveRecorder.Core.Config.V3
|
|||
[JsonProperty(nameof(DanmakuTransport)), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Optional<DanmakuTransportMode> OptionalDanmakuTransport { get => this.GetPropertyValueOptional<DanmakuTransportMode>(nameof(this.DanmakuTransport)); set => this.SetPropertyValueOptional(value, nameof(this.DanmakuTransport)); }
|
||||
|
||||
/// <summary>
|
||||
/// 使用直播间主播的uid进行弹幕服务器认证
|
||||
/// </summary>
|
||||
public bool DanmakuAuthenticateWithStreamerUid { get => this.GetPropertyValue<bool>(); set => this.SetPropertyValue(value); }
|
||||
public bool HasDanmakuAuthenticateWithStreamerUid { get => this.GetPropertyHasValue(nameof(this.DanmakuAuthenticateWithStreamerUid)); set => this.SetPropertyHasValue<bool>(value, nameof(this.DanmakuAuthenticateWithStreamerUid)); }
|
||||
[JsonProperty(nameof(DanmakuAuthenticateWithStreamerUid)), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Optional<bool> OptionalDanmakuAuthenticateWithStreamerUid { get => this.GetPropertyValueOptional<bool>(nameof(this.DanmakuAuthenticateWithStreamerUid)); set => this.SetPropertyValueOptional(value, nameof(this.DanmakuAuthenticateWithStreamerUid)); }
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用系统代理
|
||||
/// </summary>
|
||||
|
@ -533,6 +546,8 @@ namespace BililiveRecorder.Core.Config.V3
|
|||
|
||||
public DanmakuTransportMode DanmakuTransport => DanmakuTransportMode.Random;
|
||||
|
||||
public bool DanmakuAuthenticateWithStreamerUid => false;
|
||||
|
||||
public bool NetworkTransportUseSystemProxy => false;
|
||||
|
||||
public AllowedAddressFamily NetworkTransportAllowedAddressFamily => AllowedAddressFamily.Any;
|
||||
|
|
|
@ -13,6 +13,7 @@ using BililiveRecorder.Core.Event;
|
|||
using BililiveRecorder.Core.Recording;
|
||||
using BililiveRecorder.Core.Scripting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Polly;
|
||||
using Serilog;
|
||||
|
@ -538,6 +539,15 @@ retry:
|
|||
|
||||
private string? DanmakuClient_BeforeHandshake(string json)
|
||||
{
|
||||
if (this.RoomConfig.DanmakuAuthenticateWithStreamerUid)
|
||||
{
|
||||
var obj = JObject.Parse(json);
|
||||
// TODO add uid to property of IRoom
|
||||
obj["uid"] = this.RawBilibiliApiJsonData?["room_info"]?["uid"]?.ToObject<int>() ?? 0;
|
||||
// delete token
|
||||
obj.Remove("key");
|
||||
json = obj.ToString(Formatting.None);
|
||||
}
|
||||
return this.userScriptRunner.CallOnDanmakuHandshake(this.logger, this, json);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace BililiveRecorder.Web.Models
|
|||
public Optional<uint>? OptionalTimingWatchdogTimeout { get; set; }
|
||||
public Optional<uint>? OptionalRecordDanmakuFlushInterval { get; set; }
|
||||
public Optional<DanmakuTransportMode>? OptionalDanmakuTransport { get; set; }
|
||||
public Optional<bool>? OptionalDanmakuAuthenticateWithStreamerUid { get; set; }
|
||||
public Optional<bool>? OptionalNetworkTransportUseSystemProxy { get; set; }
|
||||
public Optional<AllowedAddressFamily>? OptionalNetworkTransportAllowedAddressFamily { get; set; }
|
||||
public Optional<string?>? OptionalUserScript { get; set; }
|
||||
|
@ -106,6 +107,7 @@ namespace BililiveRecorder.Web.Models
|
|||
if (this.OptionalTimingWatchdogTimeout.HasValue) config.OptionalTimingWatchdogTimeout = this.OptionalTimingWatchdogTimeout.Value;
|
||||
if (this.OptionalRecordDanmakuFlushInterval.HasValue) config.OptionalRecordDanmakuFlushInterval = this.OptionalRecordDanmakuFlushInterval.Value;
|
||||
if (this.OptionalDanmakuTransport.HasValue) config.OptionalDanmakuTransport = this.OptionalDanmakuTransport.Value;
|
||||
if (this.OptionalDanmakuAuthenticateWithStreamerUid.HasValue) config.OptionalDanmakuAuthenticateWithStreamerUid = this.OptionalDanmakuAuthenticateWithStreamerUid.Value;
|
||||
if (this.OptionalNetworkTransportUseSystemProxy.HasValue) config.OptionalNetworkTransportUseSystemProxy = this.OptionalNetworkTransportUseSystemProxy.Value;
|
||||
if (this.OptionalNetworkTransportAllowedAddressFamily.HasValue) config.OptionalNetworkTransportAllowedAddressFamily = this.OptionalNetworkTransportAllowedAddressFamily.Value;
|
||||
if (this.OptionalUserScript.HasValue) config.OptionalUserScript = this.OptionalUserScript.Value;
|
||||
|
@ -162,6 +164,7 @@ namespace BililiveRecorder.Web.Models.Rest
|
|||
public Optional<uint> OptionalTimingWatchdogTimeout { get; set; }
|
||||
public Optional<uint> OptionalRecordDanmakuFlushInterval { get; set; }
|
||||
public Optional<DanmakuTransportMode> OptionalDanmakuTransport { get; set; }
|
||||
public Optional<bool> OptionalDanmakuAuthenticateWithStreamerUid { get; set; }
|
||||
public Optional<bool> OptionalNetworkTransportUseSystemProxy { get; set; }
|
||||
public Optional<AllowedAddressFamily> OptionalNetworkTransportAllowedAddressFamily { get; set; }
|
||||
public Optional<string?> OptionalUserScript { get; set; }
|
||||
|
@ -223,6 +226,7 @@ namespace BililiveRecorder.Web.Models.Graphql
|
|||
this.Field(x => x.OptionalTimingWatchdogTimeout, type: typeof(HierarchicalOptionalType<uint>));
|
||||
this.Field(x => x.OptionalRecordDanmakuFlushInterval, type: typeof(HierarchicalOptionalType<uint>));
|
||||
this.Field(x => x.OptionalDanmakuTransport, type: typeof(HierarchicalOptionalType<DanmakuTransportMode>));
|
||||
this.Field(x => x.OptionalDanmakuAuthenticateWithStreamerUid, type: typeof(HierarchicalOptionalType<bool>));
|
||||
this.Field(x => x.OptionalNetworkTransportUseSystemProxy, type: typeof(HierarchicalOptionalType<bool>));
|
||||
this.Field(x => x.OptionalNetworkTransportAllowedAddressFamily, type: typeof(HierarchicalOptionalType<AllowedAddressFamily>));
|
||||
this.Field(x => x.OptionalUserScript, type: typeof(HierarchicalOptionalType<string>));
|
||||
|
@ -261,6 +265,7 @@ namespace BililiveRecorder.Web.Models.Graphql
|
|||
this.Field(x => x.TimingWatchdogTimeout);
|
||||
this.Field(x => x.RecordDanmakuFlushInterval);
|
||||
this.Field(x => x.DanmakuTransport);
|
||||
this.Field(x => x.DanmakuAuthenticateWithStreamerUid);
|
||||
this.Field(x => x.NetworkTransportUseSystemProxy);
|
||||
this.Field(x => x.NetworkTransportAllowedAddressFamily);
|
||||
this.Field(x => x.UserScript);
|
||||
|
@ -318,6 +323,7 @@ namespace BililiveRecorder.Web.Models.Graphql
|
|||
this.Field(x => x.OptionalTimingWatchdogTimeout, nullable: true, type: typeof(HierarchicalOptionalInputType<uint>));
|
||||
this.Field(x => x.OptionalRecordDanmakuFlushInterval, nullable: true, type: typeof(HierarchicalOptionalInputType<uint>));
|
||||
this.Field(x => x.OptionalDanmakuTransport, nullable: true, type: typeof(HierarchicalOptionalInputType<DanmakuTransportMode>));
|
||||
this.Field(x => x.OptionalDanmakuAuthenticateWithStreamerUid, nullable: true, type: typeof(HierarchicalOptionalInputType<bool>));
|
||||
this.Field(x => x.OptionalNetworkTransportUseSystemProxy, nullable: true, type: typeof(HierarchicalOptionalInputType<bool>));
|
||||
this.Field(x => x.OptionalNetworkTransportAllowedAddressFamily, nullable: true, type: typeof(HierarchicalOptionalInputType<AllowedAddressFamily>));
|
||||
this.Field(x => x.OptionalUserScript, nullable: true, type: typeof(HierarchicalOptionalInputType<string>));
|
||||
|
|
|
@ -302,6 +302,22 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"DanmakuAuthenticateWithStreamerUid": {
|
||||
"description": "使用直播间主播的uid进行弹幕服务器认证\n默认: false",
|
||||
"markdownDescription": "使用直播间主播的uid进行弹幕服务器认证 \n默认: `false `\n\n",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"HasValue": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"Value": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"NetworkTransportUseSystemProxy": {
|
||||
"description": "是否使用系统代理\n默认: false",
|
||||
"markdownDescription": "是否使用系统代理 \n默认: `false `\n\n",
|
||||
|
|
|
@ -224,6 +224,14 @@ export const data: Array<ConfigEntry> = [
|
|||
advancedConfig: true,
|
||||
default: "DanmakuTransportMode.Random",
|
||||
},
|
||||
{
|
||||
id: "DanmakuAuthenticateWithStreamerUid",
|
||||
name: "使用直播间主播的uid进行弹幕服务器认证",
|
||||
type: "bool",
|
||||
configType: "globalOnly",
|
||||
advancedConfig: true,
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "NetworkTransportUseSystemProxy",
|
||||
name: "是否使用系统代理",
|
||||
|
|
Loading…
Reference in New Issue
Block a user