Skip to content

Commit cc6c0b6

Browse files
committed
chore: merge upstream
2 parents 21275e3 + 20c2b10 commit cc6c0b6

File tree

32 files changed

+880
-652
lines changed

32 files changed

+880
-652
lines changed

.github/workflows/Lagrange.OneBot-build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@ jobs:
5555
- name: Install .NET
5656
uses: actions/setup-dotnet@v4
5757
with:
58-
dotnet-version: '8.0.x'
59-
60-
- name: Build Lagrange.OneBot .NET 7.0
61-
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --no-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net7.0
62-
58+
dotnet-version: '9.0.x'
59+
6360
- name: Build Lagrange.OneBot .NET 8.0
6461
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --no-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net8.0
6562

66-
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 7.0
67-
uses: actions/upload-artifact@v4
68-
if: github.event_name != 'pull_request'
69-
with:
70-
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net7.0_NoSelfContained
71-
path: Lagrange.OneBot/bin/Debug/net7.0/${{ matrix.runtimeIdentifier }}/publish
63+
- name: Build Lagrange.OneBot .NET 9.0
64+
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --no-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net9.0
7265

7366
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 8.0
7467
uses: actions/upload-artifact@v4
7568
if: github.event_name != 'pull_request'
7669
with:
7770
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net8.0_NoSelfContained
7871
path: Lagrange.OneBot/bin/Release/net8.0/${{ matrix.runtimeIdentifier }}/publish
72+
73+
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 9.0
74+
uses: actions/upload-artifact@v4
75+
if: github.event_name != 'pull_request'
76+
with:
77+
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_net9.0_NoSelfContained
78+
path: Lagrange.OneBot/bin/Release/net9.0/${{ matrix.runtimeIdentifier }}/publish

.github/workflows/Lagrange.OneBot-release.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,6 @@ jobs:
6161
mkdir upload
6262
copy 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip' 'upload/Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip'
6363
64-
- name: Build Lagrange.OneBot .NET 7.0
65-
run: dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net7.0
66-
67-
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 7.0
68-
uses: actions/upload-artifact@v3
69-
with:
70-
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0
71-
path: Lagrange.OneBot/bin/Debug/net7.0/${{ matrix.runtimeIdentifier }}/publish
72-
73-
- name: Compress files .NET 7.0
74-
run: Compress-Archive -Path 'Lagrange.OneBot\bin\Debug\net7.0\${{ matrix.runtimeIdentifier }}\publish\*' -DestinationPath 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_7.0.zip'
75-
76-
- name: dir
77-
run: dir 'Lagrange.OneBot\bin\Debug\net7.0\${{ matrix.runtimeIdentifier }}\publish\'
78-
79-
- name: Rename .NET 7.0
80-
run: |
81-
copy 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_7.0.zip' 'upload/Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_7.0.zip'
82-
8364
# - name: Rename
8465
# if: matrix.runtimeIdentifier == 'win-x64' || matrix.runtimeIdentifier == 'win-x86'
8566
# run: move 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot.exe' 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot_${{ matrix.runtimeIdentifier }}.exe'

Lagrange.Core.Test/Tests/NTLoginTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Lagrange.Core.Common;
22
using Lagrange.Core.Common.Interface;
33
using Lagrange.Core.Common.Interface.Api;
4-
using Lagrange.Core.Internal.Event.System;
4+
using Lagrange.Core.Message;
55

66
namespace Lagrange.Core.Test.Tests;
77

@@ -13,41 +13,41 @@ public async Task LoginByPassword()
1313
{
1414
var deviceInfo = WtLoginTest.GetDeviceInfo();
1515
var keyStore = WtLoginTest.LoadKeystore();
16-
16+
1717
if (keyStore == null)
1818
{
1919
Console.WriteLine("Please login by QrCode first");
2020
return;
2121
}
2222

23-
var bot = BotFactory.Create(new BotConfig()
23+
var bot = BotFactory.Create(new BotConfig()
2424
{
2525
UseIPv6Network = false,
2626
GetOptimumServer = true,
2727
AutoReconnect = true,
2828
Protocol = Protocols.Linux
2929
}, deviceInfo, keyStore);
30-
30+
3131
bot.Invoker.OnBotLogEvent += (_, @event) =>
3232
{
3333
Utility.Console.ChangeColorByTitle(@event.Level);
3434
Console.WriteLine(@event.ToString());
3535
};
36-
36+
3737
bot.Invoker.OnBotOnlineEvent += (_, @event) =>
3838
{
3939
Console.WriteLine(@event.ToString());
4040
WtLoginTest.SaveKeystore(bot.UpdateKeystore());
4141
};
42-
42+
4343
bot.Invoker.OnBotCaptchaEvent += (_, @event) =>
4444
{
4545
Console.WriteLine(@event.ToString());
4646
var captcha = Console.ReadLine();
4747
var randStr = Console.ReadLine();
4848
if (captcha != null && randStr != null) bot.SubmitCaptcha(captcha, randStr);
4949
};
50-
50+
5151
bot.Invoker.OnGroupInvitationReceived += (_, @event) =>
5252
{
5353
Console.WriteLine(@event.ToString());

Lagrange.Core/Common/Interface/Api/GroupExt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static Task<bool> SetGroupRequest(this BotContext bot, BotGroupRequest re
8888
public static Task<bool> SetGroupFilteredRequest(this BotContext bot, BotGroupRequest request, bool accept = true, string reason = "")
8989
=> bot.ContextCollection.Business.OperationLogic.SetGroupFilteredRequest(request.GroupUin, request.Sequence, (uint)request.EventType, accept, reason);
9090

91-
public static Task<bool> SetFriendRequest(this BotContext bot, FriendRequestEvent request, bool accept = true)
91+
public static Task<bool> SetFriendRequest(this BotContext bot, BotFriendRequest request, bool accept = true)
9292
=> bot.ContextCollection.Business.OperationLogic.SetFriendRequest(request.SourceUid, accept);
9393

9494
public static Task<bool> GroupPoke(this BotContext bot, uint groupUin, uint friendUin)

Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ private async Task ResolveIncomingChain(MessageChain chain)
397397
case ImageEntity image when !image.ImageUrl.Contains("&rkey=") && image.MsgInfo is not null:
398398
{
399399
var @event = image.IsGroup
400-
? ImageGroupDownloadEvent.Create(image.GroupUin ?? 0, image.MsgInfo)
401-
: ImageDownloadEvent.Create(image.FriendUid ?? string.Empty, image.MsgInfo);
400+
? ImageGroupDownloadEvent.Create(chain.GroupUin ?? 0, image.MsgInfo)
401+
: ImageDownloadEvent.Create(chain.Uid ?? string.Empty, image.MsgInfo);
402402

403403
var results = await Collection.Business.SendEvent(@event);
404404
if (results.Count != 0)
@@ -425,6 +425,24 @@ private async Task ResolveOutgoingChain(MessageChain chain)
425425
face.SysFaceEntry ??= await cache.GetCachedFaceEntity(face.FaceId);
426426
break;
427427
}
428+
case BounceFaceEntity bounceFace:
429+
{
430+
var cache = Collection.Business.CachingLogic;
431+
432+
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
433+
if (bounceFace.Name != null)
434+
break;
435+
436+
string name = (await cache.GetCachedFaceEntity(bounceFace.FaceId))?.QDes ?? string.Empty;
437+
438+
// Because the name is used as a preview text, it should not start with '/'
439+
// But the QDes of the face may start with '/', so remove it
440+
if (name.StartsWith('/'))
441+
name = name[1..];
442+
443+
bounceFace.Name = name;
444+
break;
445+
}
428446
case ForwardEntity forward when forward.TargetUin != 0:
429447
{
430448
var cache = Collection.Business.CachingLogic;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma warning disable CS8618
2+
3+
using ProtoBuf;
4+
5+
namespace Lagrange.Core.Internal.Packets.Message.Element.Implementation.Extra;
6+
7+
[ProtoContract]
8+
internal class QBounceFaceExtra
9+
{
10+
[ProtoMember(1)] public int Field1 { get; set; } = 13;
11+
12+
[ProtoMember(2)] public uint Count { get; set; } = 1;
13+
14+
[ProtoMember(3)] public string Name { get; set; } = string.Empty;
15+
16+
[ProtoMember(6)] public QSmallFaceExtra Face { get; set; }
17+
18+
[ProtoContract]
19+
public class FallbackPreviewTextPb
20+
{
21+
[ProtoMember(1)] public string Text { get; set; } = string.Empty;
22+
}
23+
}

Lagrange.Core/Internal/Packets/Service/Oidb/Common/NTV2RichMediaReq.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ internal class PicExtBizInfo
295295

296296
[ProtoMember(2)] public string TextSummary { get; set; }
297297

298-
[ProtoMember(11)] public byte[] BytesPbReserveC2c { get; set; }
298+
[ProtoMember(11)] public byte[]? BytesPbReserveC2c { get; set; }
299299

300-
[ProtoMember(12)] public byte[] BytesPbReserveTroop { get; set; }
300+
[ProtoMember(12)] public byte[]? BytesPbReserveTroop { get; set; }
301301

302302
[ProtoMember(1001)] public uint FromScene { get; set; }
303303

Lagrange.Core/Internal/Packets/SsoPacker.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public static BinaryPacket Build(SsoPacket packet, BotAppInfo appInfo, BotDevice
1919
var writer = new BinaryPacket();
2020

2121
var sign = signProvider.Sign(packet.Command, packet.Sequence, packet.Payload.ToArray(), out var extra, out var token);
22-
var signature = new NTDeviceSign
22+
var signature = new SsoReserveFields
2323
{
24-
Sign = sign == null ? null : new SecInfo
24+
SecInfo = sign == null ? null : new SsoSecureInfo
2525
{
2626
SecSign = sign,
2727
SecToken = token,
2828
SecExtra = extra
2929
},
30-
Trace = StringGen.GenerateTrace(),
30+
TraceParent = StringGen.GenerateTrace(),
3131
Uid = keystore.Uid
3232
};
3333
var stream = new MemoryStream();

Lagrange.Core/Internal/Packets/System/NTDeviceSign.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using ProtoBuf;
2+
3+
namespace Lagrange.Core.Internal.Packets.System;
4+
5+
[ProtoContract]
6+
internal class SsoReserveFields
7+
{
8+
[ProtoMember(4)] public byte[]? ClientIpcookie { get; set; }
9+
10+
[ProtoMember(9)] public uint? Flag { get; set; }
11+
12+
[ProtoMember(10)] public uint? EnvId { get; set; }
13+
14+
[ProtoMember(11)] public uint? LocaleId { get; set; }
15+
16+
[ProtoMember(12)] public string? Qimei { get; set; }
17+
18+
[ProtoMember(13)] public byte[]? Env { get; set; }
19+
20+
[ProtoMember(14)] public uint? NewconnFlag { get; set; }
21+
22+
[ProtoMember(15)] public string? TraceParent { get; set; }
23+
24+
[ProtoMember(16)] public string? Uid { get; set; }
25+
26+
[ProtoMember(18)] public uint? Imsi { get; set; }
27+
28+
[ProtoMember(19)] public uint? NetworkType { get; set; }
29+
30+
[ProtoMember(20)] public uint? IpStackType { get; set; }
31+
32+
[ProtoMember(21)] public uint? MsgType { get; set; }
33+
34+
[ProtoMember(22)] public string? TrpcRsp { get; set; }
35+
36+
[ProtoMember(23)] public Dictionary<string, string>? TransInfo { get; set; }
37+
38+
[ProtoMember(24)] public SsoSecureInfo? SecInfo { get; set; }
39+
40+
[ProtoMember(25)] public uint? SecSigFlag { get; set; }
41+
42+
[ProtoMember(26)] public uint? NtCoreVersion { get; set; }
43+
44+
[ProtoMember(27)] public uint? SsoRouteCost { get; set; }
45+
46+
[ProtoMember(28)] public uint? SsoIpOrigin { get; set; }
47+
48+
[ProtoMember(30)] public byte[]? PresureToken { get; set; }
49+
}

0 commit comments

Comments
 (0)