mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Delete alt-session on AUTH_KEY_UNREGISTERED for renegociation
This commit is contained in:
parent
4ccfddd22e
commit
9ec2f31f72
31
.github/workflows/dev.yml
vendored
31
.github/workflows/dev.yml
vendored
|
|
@ -12,14 +12,16 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
permissions:
|
||||||
|
id-token: write # enable GitHub OIDC token issuance for this job
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 100
|
fetch-depth: 30
|
||||||
- name: Determine version
|
- name: Determine version
|
||||||
run: |
|
run: |
|
||||||
git fetch --depth=100 --tags
|
git fetch --depth=30 --tags
|
||||||
DESCR_TAG=$(git describe --tags)
|
DESCR_TAG=$(git describe --tags)
|
||||||
COMMITS=${DESCR_TAG#*-}
|
COMMITS=${DESCR_TAG#*-}
|
||||||
COMMITS=${COMMITS%-*}
|
COMMITS=${COMMITS%-*}
|
||||||
|
|
@ -29,19 +31,32 @@ jobs:
|
||||||
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
||||||
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v4
|
# - name: Setup .NET
|
||||||
with:
|
# uses: actions/setup-dotnet@v4
|
||||||
dotnet-version: 8.0.x
|
# with:
|
||||||
|
# dotnet-version: 8.0.x
|
||||||
- name: Pack
|
- name: Pack
|
||||||
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
|
run: |
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//\"/%22}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
|
||||||
|
dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages
|
||||||
# - name: Upload artifact
|
# - name: Upload artifact
|
||||||
# uses: actions/upload-artifact@v4
|
# uses: actions/upload-artifact@v4
|
||||||
# with:
|
# with:
|
||||||
# name: packages
|
# name: packages
|
||||||
# path: packages/*.nupkg
|
# path: packages/*.nupkg
|
||||||
|
|
||||||
|
- name: NuGet login (OIDC → temp API key)
|
||||||
|
uses: NuGet/login@v1
|
||||||
|
id: login
|
||||||
|
with:
|
||||||
|
user: ${{ secrets.NUGET_USER }}
|
||||||
- name: Nuget push
|
- name: Nuget push
|
||||||
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
- name: Deployment Notification
|
- name: Deployment Notification
|
||||||
env:
|
env:
|
||||||
JSON: |
|
JSON: |
|
||||||
|
|
|
||||||
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
|
|
@ -22,6 +22,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # For git tag
|
contents: write # For git tag
|
||||||
|
id-token: write # enable GitHub OIDC token issuance for this job
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -37,19 +38,35 @@ jobs:
|
||||||
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
||||||
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 8.0.x
|
||||||
- name: Pack
|
- name: Pack
|
||||||
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
|
run: |
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//|/%0A}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES// - /%0A- }
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES// /%0A%0A}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//\"/%22}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
|
||||||
|
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
|
||||||
|
dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages
|
||||||
# - name: Upload artifact
|
# - name: Upload artifact
|
||||||
# uses: actions/upload-artifact@v4
|
# uses: actions/upload-artifact@v4
|
||||||
# with:
|
# with:
|
||||||
# name: packages
|
# name: packages
|
||||||
# path: packages/*.nupkg
|
# path: packages/*.nupkg
|
||||||
|
|
||||||
|
- name: NuGet login (OIDC → temp API key)
|
||||||
|
uses: NuGet/login@v1
|
||||||
|
id: login
|
||||||
|
with:
|
||||||
|
user: ${{ secrets.NUGET_USER }}
|
||||||
- name: Nuget push
|
- name: Nuget push
|
||||||
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
- name: Git tag
|
- name: Git tag
|
||||||
run: |
|
run: |
|
||||||
git tag $VERSION
|
git tag $VERSION
|
||||||
|
|
|
||||||
|
|
@ -1477,7 +1477,7 @@ namespace WTelegram
|
||||||
writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted)
|
writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted)
|
||||||
writer.Write(msgId); // int64 message_id
|
writer.Write(msgId); // int64 message_id
|
||||||
writer.Write(0); // int32 message_data_length (to be patched)
|
writer.Write(0); // int32 message_data_length (to be patched)
|
||||||
Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}...");
|
Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}");
|
||||||
writer.WriteTLObject(msg); // bytes message_data
|
writer.WriteTLObject(msg); // bytes message_data
|
||||||
BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length
|
BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length
|
||||||
}
|
}
|
||||||
|
|
@ -1629,7 +1629,7 @@ namespace WTelegram
|
||||||
got503 = true;
|
got503 = true;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
else if (code == 401 && message == "SESSION_REVOKED" && !IsMainDC) // need to renegociate alt-DC auth
|
else if (code == 401 && !IsMainDC && message is "SESSION_REVOKED" or "AUTH_KEY_UNREGISTERED") // need to renegociate alt-DC auth
|
||||||
{
|
{
|
||||||
lock (_session)
|
lock (_session)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216
|
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216
|
||||||
|
|
||||||
Release Notes:
|
Release Notes:
|
||||||
$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
|
$(ReleaseNotes)</Description>
|
||||||
<Copyright>Copyright © Olivier Marcoux 2021-2025</Copyright>
|
<Copyright>Copyright © Olivier Marcoux 2021-2025</Copyright>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageProjectUrl>https://wiz0u.github.io/WTelegramClient</PackageProjectUrl>
|
<PackageProjectUrl>https://wiz0u.github.io/WTelegramClient</PackageProjectUrl>
|
||||||
|
|
@ -27,7 +27,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<PackageTags>Telegram;MTProto;Client;Api;UserBot</PackageTags>
|
<PackageTags>Telegram;MTProto;Client;Api;UserBot</PackageTags>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<PackageReleaseNotes>$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</PackageReleaseNotes>
|
<PackageReleaseNotes>$(ReleaseNotes)</PackageReleaseNotes>
|
||||||
<NoWarn>NETSDK1138;CS0419;CS1573;CS1591</NoWarn>
|
<NoWarn>NETSDK1138;CS0419;CS1573;CS1591</NoWarn>
|
||||||
<DefineConstants>TRACE;OBFUSCATION;MTPG</DefineConstants>
|
<DefineConstants>TRACE;OBFUSCATION;MTPG</DefineConstants>
|
||||||
<!--<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>-->
|
<!--<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>-->
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue