mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
Fix HTML tags in some Quests DisplayName. (#640)
Some checks failed
FModel QA Builder / build (push) Has been cancelled
Some checks failed
FModel QA Builder / build (push) Has been cancelled
* 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>
This commit is contained in:
parent
bd2e924925
commit
40ed646dcd
|
|
@ -242,7 +242,8 @@ public class BaseQuest : BaseIcon
|
|||
{
|
||||
_informationPaint.TextSize = 25;
|
||||
_informationPaint.Typeface = Utils.Typefaces.Bundle;
|
||||
Utils.DrawMultilineText(c, DisplayName, Width - padding, 0, SKTextAlign.Left,
|
||||
|
||||
Utils.DrawMultilineText(c, Utils.RemoveHtmlTags(DisplayName).Replace(" ", " "), Width - padding, 0, SKTextAlign.Left,
|
||||
new SKRect(x, y + padding, maxX, Height - padding * 1.5f), _informationPaint, out _);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class ApiEndpointViewModel
|
|||
|
||||
public FortniteApiEndpoint FortniteApi { get; }
|
||||
public ValorantApiEndpoint ValorantApi { get; }
|
||||
public FortniteCentralApiEndpoint CentralApi { get; }
|
||||
public DillyApiEndpoint DillyApi { get; }
|
||||
public EpicApiEndpoint EpicApi { get; }
|
||||
public FModelApiEndpoint FModelApi { get; }
|
||||
public GitHubApiEndpoint GitHubApi { get; }
|
||||
|
|
@ -27,7 +27,7 @@ public class ApiEndpointViewModel
|
|||
{
|
||||
FortniteApi = new FortniteApiEndpoint(_client);
|
||||
ValorantApi = new ValorantApiEndpoint(_client);
|
||||
CentralApi = new FortniteCentralApiEndpoint(_client);
|
||||
DillyApi = new DillyApiEndpoint(_client);
|
||||
EpicApi = new EpicApiEndpoint(_client);
|
||||
FModelApi = new FModelApiEndpoint(_client);
|
||||
GitHubApi = new GitHubApiEndpoint(_client);
|
||||
|
|
|
|||
|
|
@ -2,18 +2,34 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FModel.Framework;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
using RestSharp;
|
||||
using Serilog;
|
||||
|
||||
namespace FModel.ViewModels.ApiEndpoints;
|
||||
|
||||
public class FortniteCentralApiEndpoint : AbstractApiProvider
|
||||
public class DillyApiEndpoint : AbstractApiProvider
|
||||
{
|
||||
public FortniteCentralApiEndpoint(RestClient client) : base(client) { }
|
||||
private Backup[] _backups;
|
||||
|
||||
public DillyApiEndpoint(RestClient client) : base(client) { }
|
||||
|
||||
public async Task<Backup[]> GetBackupsAsync(CancellationToken token)
|
||||
{
|
||||
var request = new FRestRequest($"https://export-service-new.dillyapis.com/v1/backups");
|
||||
var response = await _client.ExecuteAsync<Backup[]>(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
public Backup[] GetBackups(CancellationToken token)
|
||||
{
|
||||
return _backups ??= GetBackupsAsync(token).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public async Task<IDictionary<string, IDictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
|
||||
{
|
||||
var request = new FRestRequest("https://fortnitecentral.genxgames.gg/api/v1/hotfixes")
|
||||
var request = new FRestRequest("https://api.fortniteapi.com/v1/cloudstorage/hotfixes")
|
||||
{
|
||||
Interceptors = [_interceptor]
|
||||
};
|
||||
|
|
@ -26,7 +26,6 @@ public class FModelApiEndpoint : AbstractApiProvider
|
|||
private News _news;
|
||||
private Info _infos;
|
||||
private Donator[] _donators;
|
||||
private Backup[] _backups;
|
||||
private Game _game;
|
||||
private readonly IDictionary<string, CommunityDesign> _communityDesigns = new Dictionary<string, CommunityDesign>();
|
||||
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
|
||||
|
|
@ -60,19 +59,6 @@ public class FModelApiEndpoint : AbstractApiProvider
|
|||
return _donators ??= GetDonatorsAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public async Task<Backup[]> GetBackupsAsync(CancellationToken token, string gameName)
|
||||
{
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/backups/{gameName}");
|
||||
var response = await _client.ExecuteAsync<Backup[]>(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
public Backup[] GetBackups(CancellationToken token, string gameName)
|
||||
{
|
||||
return _backups ??= GetBackupsAsync(token, gameName).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public async Task<Game> GetGamesAsync(CancellationToken token, string gameName)
|
||||
{
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/games/{gameName}");
|
||||
|
|
|
|||
|
|
@ -19,10 +19,8 @@ public class News
|
|||
[DebuggerDisplay("{" + nameof(FileName) + "}")]
|
||||
public class Backup
|
||||
{
|
||||
[J] public string GameName { get; private set; }
|
||||
[J] public string FileName { get; private set; }
|
||||
[J] public string DownloadUrl { get; private set; }
|
||||
[J] public long FileSize { get; private set; }
|
||||
[J] public string Url { get; private set; }
|
||||
}
|
||||
|
||||
public class Donator
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ public class BackupManagerViewModel : ViewModel
|
|||
{
|
||||
await _threadWorkerView.Begin(cancellationToken =>
|
||||
{
|
||||
var backups = _apiEndpointView.FModelApi.GetBackups(cancellationToken, _gameName);
|
||||
var backups = _apiEndpointView.DillyApi.GetBackups(cancellationToken);
|
||||
if (backups == null) return;
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
foreach (var backup in backups) Backups.Add(backup);
|
||||
SelectedBackup = Backups.LastOrDefault();
|
||||
SelectedBackup = Backups.FirstOrDefault();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class BackupManagerViewModel : ViewModel
|
|||
await _threadWorkerView.Begin(_ =>
|
||||
{
|
||||
var fullPath = Path.Combine(Path.Combine(UserSettings.Default.OutputDirectory, "Backups"), SelectedBackup.FileName);
|
||||
_apiEndpointView.DownloadFile(SelectedBackup.DownloadUrl, fullPath);
|
||||
_apiEndpointView.DownloadFile(SelectedBackup.Url, fullPath);
|
||||
SaveCheck(fullPath, SelectedBackup.FileName, "downloaded", "download");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
if (!Provider.ProjectName.Equals("fortnitegame", StringComparison.OrdinalIgnoreCase) || HotfixedResourcesDone) return Task.CompletedTask;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var hotfixes = ApplicationService.ApiEndpointView.CentralApi.GetHotfixes(CancellationToken.None, Provider.GetLanguageCode(UserSettings.Default.AssetLanguage));
|
||||
var hotfixes = ApplicationService.ApiEndpointView.DillyApi.GetHotfixes(CancellationToken.None, Provider.GetLanguageCode(UserSettings.Default.AssetLanguage));
|
||||
if (hotfixes == null) return;
|
||||
|
||||
Provider.Internationalization.Override(hotfixes);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user