fix AllowDuplicateLogin

This commit is contained in:
linmeideli committed 2026-10-06 19:18:54 +08:00
1 parent 6fd771e0cf
commit 9dcd7c529c
6 files changed
+5 -104

No files matched your search

-94
View File
@@ -1,94 +0,0 @@
#!/usr/bin/env bash
# Builds every server RID, packs the NuGet packages and collects the results in ./release.
#
# Server archives follow the build.cake naming so the artifacts match what CI publishes:
# Empostor-Server_<version>_<rid>.zip (win-x64)
# Empostor-Server_<version>_<rid>.tar.gz (linux-*, osx-x64)
#
# Note: Git Bash here has no `zip` binary, only `unzip`, so the win-x64 zip is produced by the
# small dotnet helper in tools/zipdir. tar handles the .tar.gz side natively.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUT="$ROOT/release"
SERVER_PROJ="$ROOT/src/Empostor.Server/Empostor.Server.csproj"
API_PROJ="$ROOT/src/Empostor.Api/Empostor.Api.csproj"
SERVER_BIN="$ROOT/src/Empostor.Server/bin/Release/net8.0"
API_BIN="$ROOT/src/Empostor.Api/bin/Release"
# Version comes from the props file, the same source build.cake reads.
VERSION="$(sed -n 's:.*<VersionPrefix>\(.*\)</VersionPrefix>.*:\1:p' "$ROOT/src/Directory.Build.props" | head -1)"
if [ -z "$VERSION" ]; then
echo "error: could not read VersionPrefix from src/Directory.Build.props" >&2
exit 1
fi
# Windows is the only zip target; everything else is tar.gz.
RIDS_ZIP="win-x64"
RIDS_TGZ="linux-x64 linux-arm64 linux-arm osx-x64"
echo "==> Version $VERSION"
echo "==> Output $OUT"
rm -rf "$OUT"
mkdir -p "$OUT"
# ---------------------------------------------------------------- server
for rid in $RIDS_ZIP $RIDS_TGZ; do
echo "==> Publishing server ($rid)"
dotnet publish "$SERVER_PROJ" -c Release -r "$rid" --nologo -v minimal
done
# ---------------------------------------------------------------- api
echo "==> Packing Empostor.Api"
dotnet pack "$API_PROJ" -c Release --nologo -v minimal
# ---------------------------------------------------------------- collect
# Build the zip helper once up front: `dotnet run` swallows --nologo/-v as its own options, so
# the app arguments only survive when they follow a bare `--`.
echo "==> Building zip helper"
dotnet build "$ROOT/tools/zipdir/zipdir.csproj" -c Release --nologo -v quiet
# The publish step leaves a zip behind from an earlier build.cake run; use only the RID folders.
for rid in $RIDS_ZIP; do
dir="$SERVER_BIN/$rid/publish"
if [ ! -d "$dir" ]; then
echo "error: missing publish output $dir" >&2
exit 1
fi
echo "==> Zipping server ($rid)"
dotnet "$ROOT/tools/zipdir/bin/Release/net8.0/zipdir.dll" \
"$dir" "$OUT/Empostor-Server_${VERSION}_${rid}.zip"
done
for rid in $RIDS_TGZ; do
dir="$SERVER_BIN/$rid/publish"
if [ ! -d "$dir" ]; then
echo "error: missing publish output $dir" >&2
exit 1
fi
echo "==> Tarball server ($rid)"
# -C publishes the folder's contents, so the archive has no wrapping directory.
tar -czf "$OUT/Empostor-Server_${VERSION}_${rid}.tar.gz" -C "$dir" .
done
# Only the release build (no -dev / -ci suffix) is collected; the others are stale local output.
echo "==> Collecting NuGet packages"
shopt -s nullglob
found=0
for pkg in "$API_BIN"/Empostor.Api.*.nupkg "$API_BIN"/Empostor.Api.*.snupkg; do
name="$(basename "$pkg")"
case "$name" in
*-dev.nupkg|*-dev.snupkg|*-ci.*.nupkg|*-ci.*.snupkg) continue ;;
esac
cp -f "$pkg" "$OUT/"
found=1
done
shopt -u nullglob
if [ "$found" -eq 0 ]; then
echo "error: no release NuGet package found in $API_BIN" >&2
exit 1
fi
echo
echo "==> Done. Contents of release/:"
ls -lh "$OUT"
@@ -38,8 +38,6 @@ namespace Empostor.Api.Config
public bool EnableRateLimits { get; set; } = true;
public bool EnableDuplicateLoginCheck { get; set; } = true;
public bool ForbidProtocolExtensions { get; set; } = true;
public bool EnablePacketSizeChecks { get; set; } = true;
@@ -9,5 +9,7 @@ namespace Empostor.Api.Config
public bool AllowHostAuthority { get; set; } = false;
public bool AllowVersionMixing { get; set; } = false;
public bool AllowDuplicateLogin { get; set; } = true;
}
}
@@ -358,11 +358,6 @@ namespace Empostor.Server.Http
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "osx-" + arch : "linux-" + arch;
}
/// <summary>
/// Asset names always end with the RID — "Empostor-Server_2.0.0_win-x64.zip" for tagged
/// releases and "Empostor-Server-latest-win-x64.zip" for nightly — so a suffix match
/// covers both and skips unrelated files such as the nupkg or manifest.json.
/// </summary>
private static (string Name, string Url, long Size)? FindPlatformAsset(JsonElement release, string rid)
{
if (!release.TryGetProperty("assets", out var assets) || assets.ValueKind != JsonValueKind.Array)
@@ -187,7 +187,7 @@ namespace Empostor.Server.Net.State
}
var player = client.Player;
if (AntiCheat.Config.EnableDuplicateLoginCheck && IsDuplicateAccount(client))
if (_compatibilityConfig.AllowDuplicateLogin && IsDuplicateAccount(client))
{
_logger.LogWarning(
"#{Id} {Name} rejected: account {Puid} is already playing in this game",
+2 -2
View File
@@ -32,7 +32,6 @@
"EnableMeetingChecks": true,
"EnableVotingChecks": true,
"EnableRateLimits": true,
"EnableDuplicateLoginCheck": true,
"ForbidProtocolExtensions": true,
"EnablePacketSizeChecks": true,
"PacketSizeLimit": 1203
@@ -44,7 +43,8 @@
"Compatibility": {
"AllowFutureGameVersions": false,
"AllowHostAuthority": false,
"AllowVersionMixing": false
"AllowVersionMixing": false,
"AllowDuplicateLogin": true
},
"Debug": {
"GameRecorderEnabled": false,