diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 222fc7a..de5e145 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -12,14 +12,16 @@ env:
jobs:
build:
+ permissions:
+ id-token: write # enable GitHub OIDC token issuance for this job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
- fetch-depth: 100
+ fetch-depth: 30
- name: Determine version
run: |
- git fetch --depth=100 --tags
+ git fetch --depth=30 --tags
DESCR_TAG=$(git describe --tags)
COMMITS=${DESCR_TAG#*-}
COMMITS=${COMMITS%-*}
@@ -29,19 +31,32 @@ jobs:
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 "VERSION=$VERSION" >> $GITHUB_ENV
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 8.0.x
+
+ # - name: Setup .NET
+ # uses: actions/setup-dotnet@v4
+ # with:
+ # dotnet-version: 8.0.x
- 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
# uses: actions/upload-artifact@v4
# with:
# name: packages
# path: packages/*.nupkg
+
+ - name: NuGet login (OIDC → temp API key)
+ uses: NuGet/login@v1
+ id: login
+ with:
+ user: ${{ secrets.NUGET_USER }}
- 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
env:
JSON: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 052eafb..7bdbcd1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -21,7 +21,8 @@ jobs:
build:
runs-on: ubuntu-latest
permissions:
- contents: write # For git tag
+ contents: write # For git tag
+ id-token: write # enable GitHub OIDC token issuance for this job
steps:
- uses: actions/checkout@v4
with:
@@ -37,19 +38,35 @@ jobs:
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 "VERSION=$VERSION" >> $GITHUB_ENV
+
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- 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
# uses: actions/upload-artifact@v4
# with:
# name: packages
# path: packages/*.nupkg
+
+ - name: NuGet login (OIDC → temp API key)
+ uses: NuGet/login@v1
+ id: login
+ with:
+ user: ${{ secrets.NUGET_USER }}
- 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
run: |
git tag $VERSION
diff --git a/src/Client.cs b/src/Client.cs
index be24bf3..dc054e0 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -1477,7 +1477,7 @@ namespace WTelegram
writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted)
writer.Write(msgId); // int64 message_id
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
BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length
}
@@ -1629,7 +1629,7 @@ namespace WTelegram
got503 = true;
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)
{
diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj
index 906cc13..bda3719 100644
--- a/src/WTelegramClient.csproj
+++ b/src/WTelegramClient.csproj
@@ -17,7 +17,7 @@
Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216
Release Notes:
-$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))
+$(ReleaseNotes)
Copyright © Olivier Marcoux 2021-2025
MIT
https://wiz0u.github.io/WTelegramClient
@@ -27,7 +27,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%
git
Telegram;MTProto;Client;Api;UserBot
README.md
- $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))
+ $(ReleaseNotes)
NETSDK1138;CS0419;CS1573;CS1591
TRACE;OBFUSCATION;MTPG