Skip to content

Commit 40ed646

Browse files
Fix HTML tags in some Quests DisplayName. (#640)
* Fix HTML tags in some Quests DisplayName. * New Backups & Hotfixes API * fix backups being null --------- Co-authored-by: GhostScissors <79089473+GhostScissors@users.noreply.github.com>
1 parent bd2e924 commit 40ed646

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

FModel/Creator/Bases/FN/BaseQuest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ private void DrawTexts(SKCanvas c, int x, int y, int padding)
242242
{
243243
_informationPaint.TextSize = 25;
244244
_informationPaint.Typeface = Utils.Typefaces.Bundle;
245-
Utils.DrawMultilineText(c, DisplayName, Width - padding, 0, SKTextAlign.Left,
245+
246+
Utils.DrawMultilineText(c, Utils.RemoveHtmlTags(DisplayName).Replace(" ", " "), Width - padding, 0, SKTextAlign.Left,
246247
new SKRect(x, y + padding, maxX, Height - padding * 1.5f), _informationPaint, out _);
247248
}
248249

FModel/ViewModels/ApiEndpointViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class ApiEndpointViewModel
1717

1818
public FortniteApiEndpoint FortniteApi { get; }
1919
public ValorantApiEndpoint ValorantApi { get; }
20-
public FortniteCentralApiEndpoint CentralApi { get; }
20+
public DillyApiEndpoint DillyApi { get; }
2121
public EpicApiEndpoint EpicApi { get; }
2222
public FModelApiEndpoint FModelApi { get; }
2323
public GitHubApiEndpoint GitHubApi { get; }
@@ -27,7 +27,7 @@ public ApiEndpointViewModel()
2727
{
2828
FortniteApi = new FortniteApiEndpoint(_client);
2929
ValorantApi = new ValorantApiEndpoint(_client);
30-
CentralApi = new FortniteCentralApiEndpoint(_client);
30+
DillyApi = new DillyApiEndpoint(_client);
3131
EpicApi = new EpicApiEndpoint(_client);
3232
FModelApi = new FModelApiEndpoint(_client);
3333
GitHubApi = new GitHubApiEndpoint(_client);

FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs renamed to FModel/ViewModels/ApiEndpoints/DillyApiEndpoints.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,34 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44
using FModel.Framework;
5+
using FModel.ViewModels.ApiEndpoints.Models;
56
using RestSharp;
67
using Serilog;
78

89
namespace FModel.ViewModels.ApiEndpoints;
910

10-
public class FortniteCentralApiEndpoint : AbstractApiProvider
11+
public class DillyApiEndpoint : AbstractApiProvider
1112
{
12-
public FortniteCentralApiEndpoint(RestClient client) : base(client) { }
13+
private Backup[] _backups;
14+
15+
public DillyApiEndpoint(RestClient client) : base(client) { }
16+
17+
public async Task<Backup[]> GetBackupsAsync(CancellationToken token)
18+
{
19+
var request = new FRestRequest($"https://export-service-new.dillyapis.com/v1/backups");
20+
var response = await _client.ExecuteAsync<Backup[]>(request, token).ConfigureAwait(false);
21+
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
22+
return response.Data;
23+
}
24+
25+
public Backup[] GetBackups(CancellationToken token)
26+
{
27+
return _backups ??= GetBackupsAsync(token).GetAwaiter().GetResult();
28+
}
1329

1430
public async Task<IDictionary<string, IDictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
1531
{
16-
var request = new FRestRequest("https://fortnitecentral.genxgames.gg/api/v1/hotfixes")
32+
var request = new FRestRequest("https://api.fortniteapi.com/v1/cloudstorage/hotfixes")
1733
{
1834
Interceptors = [_interceptor]
1935
};

FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class FModelApiEndpoint : AbstractApiProvider
2626
private News _news;
2727
private Info _infos;
2828
private Donator[] _donators;
29-
private Backup[] _backups;
3029
private Game _game;
3130
private readonly IDictionary<string, CommunityDesign> _communityDesigns = new Dictionary<string, CommunityDesign>();
3231
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
@@ -60,19 +59,6 @@ public Donator[] GetDonators()
6059
return _donators ??= GetDonatorsAsync().GetAwaiter().GetResult();
6160
}
6261

63-
public async Task<Backup[]> GetBackupsAsync(CancellationToken token, string gameName)
64-
{
65-
var request = new FRestRequest($"https://api.fmodel.app/v1/backups/{gameName}");
66-
var response = await _client.ExecuteAsync<Backup[]>(request, token).ConfigureAwait(false);
67-
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
68-
return response.Data;
69-
}
70-
71-
public Backup[] GetBackups(CancellationToken token, string gameName)
72-
{
73-
return _backups ??= GetBackupsAsync(token, gameName).GetAwaiter().GetResult();
74-
}
75-
7662
public async Task<Game> GetGamesAsync(CancellationToken token, string gameName)
7763
{
7864
var request = new FRestRequest($"https://api.fmodel.app/v1/games/{gameName}");

FModel/ViewModels/ApiEndpoints/Models/FModelResponse.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ public class News
1919
[DebuggerDisplay("{" + nameof(FileName) + "}")]
2020
public class Backup
2121
{
22-
[J] public string GameName { get; private set; }
2322
[J] public string FileName { get; private set; }
24-
[J] public string DownloadUrl { get; private set; }
25-
[J] public long FileSize { get; private set; }
23+
[J] public string Url { get; private set; }
2624
}
2725

2826
public class Donator

FModel/ViewModels/BackupManagerViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public async Task Initialize()
4848
{
4949
await _threadWorkerView.Begin(cancellationToken =>
5050
{
51-
var backups = _apiEndpointView.FModelApi.GetBackups(cancellationToken, _gameName);
51+
var backups = _apiEndpointView.DillyApi.GetBackups(cancellationToken);
5252
if (backups == null) return;
5353

5454
Application.Current.Dispatcher.Invoke(() =>
5555
{
5656
foreach (var backup in backups) Backups.Add(backup);
57-
SelectedBackup = Backups.LastOrDefault();
57+
SelectedBackup = Backups.FirstOrDefault();
5858
});
5959
});
6060
}
@@ -93,7 +93,7 @@ public async Task Download()
9393
await _threadWorkerView.Begin(_ =>
9494
{
9595
var fullPath = Path.Combine(Path.Combine(UserSettings.Default.OutputDirectory, "Backups"), SelectedBackup.FileName);
96-
_apiEndpointView.DownloadFile(SelectedBackup.DownloadUrl, fullPath);
96+
_apiEndpointView.DownloadFile(SelectedBackup.Url, fullPath);
9797
SaveCheck(fullPath, SelectedBackup.FileName, "downloaded", "download");
9898
});
9999
}

FModel/ViewModels/CUE4ParseViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private Task LoadHotfixedLocalizedResources()
527527
if (!Provider.ProjectName.Equals("fortnitegame", StringComparison.OrdinalIgnoreCase) || HotfixedResourcesDone) return Task.CompletedTask;
528528
return Task.Run(() =>
529529
{
530-
var hotfixes = ApplicationService.ApiEndpointView.CentralApi.GetHotfixes(CancellationToken.None, Provider.GetLanguageCode(UserSettings.Default.AssetLanguage));
530+
var hotfixes = ApplicationService.ApiEndpointView.DillyApi.GetHotfixes(CancellationToken.None, Provider.GetLanguageCode(UserSettings.Default.AssetLanguage));
531531
if (hotfixes == null) return;
532532

533533
Provider.Internationalization.Override(hotfixes);

0 commit comments

Comments
 (0)