Skip to content

Commit

Permalink
fixed authentication error
Browse files Browse the repository at this point in the history
fixed some useless thing such as API endpoints
  • Loading branch information
FoxWorn3365 committed Nov 6, 2024
1 parent a5bbe28 commit 3f82577
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
18 changes: 11 additions & 7 deletions UncomplicatedCustomDiscordIntegration/Events/PlayerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using PlayerRoles;
using System;
using System.Linq;
using System.Threading.Tasks;
using UncomplicatedDiscordIntegration;
using UncomplicatedDiscordIntegration.API.Features;
using UncomplicatedDiscordIntegration.Enums;
Expand Down Expand Up @@ -241,16 +242,19 @@ public void OnChangingRole(ChangingRoleEventArgs ev)

public void OnVerified(VerifiedEventArgs ev)
{
if (Plugin.Instance.Config.UseWatchlist)
Task.Run(delegate
{
WatchlistEntry entry = WatchlistManager.GetSync(ev.Player.UserId);
if (entry is not null)
if (Plugin.Instance.Config.UseWatchlist)
{
Plugin.Instance.HandleLogMessage(new(ChannelType.Watchlist, string.Format(Plugin.Instance.Translation.WatchlistedUserJoined, ev.Player.Nickname, ev.Player.UserId, entry.Reason)));
foreach (Player player in Player.List.Where(p => p.CheckPermission("udi.broadcast") || p.RemoteAdminAccess))
player.Broadcast(7, string.Format(Plugin.Instance.Translation.WatchlistedUserJoined, ev.Player.Nickname, ev.Player.UserId, entry.Reason));
WatchlistEntry entry = WatchlistManager.GetSync(ev.Player.UserId);
if (entry is not null)
{
Plugin.Instance.HandleLogMessage(new(ChannelType.Watchlist, string.Format(Plugin.Instance.Translation.WatchlistedUserJoined, ev.Player.Nickname, ev.Player.UserId, entry.Reason)));
foreach (Player player in Player.List.Where(p => p.CheckPermission("udi.broadcast") || p.RemoteAdminAccess))
player.Broadcast(7, string.Format(Plugin.Instance.Translation.WatchlistedUserJoined, ev.Player.Nickname, ev.Player.UserId, entry.Reason));
}
}
}
});

if (Plugin.Instance.Config.EventsToLog.PlayerJoined && (!ev.Player.DoNotTrack || !Plugin.Instance.Config.ShouldRespectDoNotTrack))
Plugin.Instance.HandleLogMessage(new(ChannelType.GameEvents, string.Format(Plugin.Instance.Translation.HasJoinedTheGame, ev.Player.Nickname, Plugin.Instance.Config.ShouldLogUserIds ? ev.Player.UserId : Plugin.Instance.Translation.Redacted, Plugin.Instance.Config.ShouldLogIPAddresses ? ev.Player.IPAddress : Plugin.Instance.Translation.Redacted)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal class HttpManager
/// <summary>
/// Gets the UCS APIs endpoint
/// </summary>
public string Endpoint { get; } = "https://ucs.fcosma.it/api/v2";
public string Endpoint { get; } = "https://api.ucserver.it/v2";

/// <summary>
/// Gets the CreditTag storage for the plugin, downloaded from our central server
Expand Down Expand Up @@ -160,7 +160,7 @@ public void LoadCreditTags()
Credits = [];
try
{
Dictionary<string, Dictionary<string, string>> Data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(RetriveString(HttpGetRequest("https://ucs.fcosma.it/api/credits.json")));
Dictionary<string, Dictionary<string, string>> Data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(RetriveString(HttpGetRequest($"{Endpoint}/credits.json")));

foreach (KeyValuePair<string, Dictionary<string, string>> kvp in Data.Where(kvp => kvp.Value.ContainsKey("role") && kvp.Value.ContainsKey("color") && kvp.Value.ContainsKey("override")))
{
Expand Down Expand Up @@ -229,7 +229,7 @@ public bool IsLatestVersion()

public async Task<string> TryGetNickname(string steamid)
{
return await HttpClient.GetStringAsync($"https://ucs.fcosma.it/api/steam/nickname?id={steamid}");
return await HttpClient.GetStringAsync($"{Endpoint}/steam/nickname?id={steamid}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class WatchlistManager
{
public static HttpClient HttpClient => Plugin.Instance.httpManager.HttpClient;

public readonly static string Endpoint = "https://ucs.fcosma.it/api/foxbase/v1";
public readonly static string Endpoint = "https://api.ucserver.it/foxbase/v1";

public static bool CanProceed => Plugin.Instance.Config.UCDInternalWatchlistIdAccess is not null && Plugin.Instance.Config.UCDInternalWatchlistIdAccess != string.Empty;

Expand Down

0 comments on commit 3f82577

Please sign in to comment.