mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
I feel a little scammed
This commit is contained in:
parent
3bc1d10988
commit
ffedb2be90
16
.github/workflows/autoclose.yml
vendored
Normal file
16
.github/workflows/autoclose.yml
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
name: Issue Auto Closing
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
autoclose:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close Condition
|
||||
if: contains(toJson(github.event.issue.body), '### Game\r\n\r\nFortnite')
|
||||
uses: peter-evans/close-issue@v2
|
||||
with:
|
||||
comment: Fortnite related issues are not allowed here. Join the [discord server](https://fmodel.app/discord) and read the common errors channel instead.
|
||||
19
FModel/Framework/FRestRequest.cs
Normal file
19
FModel/Framework/FRestRequest.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using RestSharp;
|
||||
|
||||
namespace FModel.Framework;
|
||||
|
||||
public class FRestRequest : RestRequest
|
||||
{
|
||||
private const int _timeout = 3 * 1000;
|
||||
|
||||
public FRestRequest(string url, Method method = Method.Get) : base(url, method)
|
||||
{
|
||||
Timeout = _timeout;
|
||||
}
|
||||
|
||||
public FRestRequest(Uri uri, Method method = Method.Get) : base(uri, method)
|
||||
{
|
||||
Timeout = _timeout;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FModel.Framework;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
using RestSharp;
|
||||
using Serilog;
|
||||
|
|
@ -16,7 +17,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task<AesResponse> GetAesKeysAsync(CancellationToken token)
|
||||
{
|
||||
var request = new RestRequest("https://benbot.app/api/v2/aes")
|
||||
var request = new FRestRequest("https://benbot.app/api/v2/aes")
|
||||
{
|
||||
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; }
|
||||
};
|
||||
|
|
@ -32,7 +33,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task<MappingsResponse[]> GetMappingsAsync(CancellationToken token)
|
||||
{
|
||||
var request = new RestRequest("https://benbot.app/api/v1/mappings")
|
||||
var request = new FRestRequest("https://benbot.app/api/v1/mappings")
|
||||
{
|
||||
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; }
|
||||
};
|
||||
|
|
@ -48,7 +49,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task<Dictionary<string, Dictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en-US")
|
||||
{
|
||||
var request = new RestRequest("https://benbot.app/api/v1/hotfixes")
|
||||
var request = new FRestRequest("https://benbot.app/api/v1/hotfixes")
|
||||
{
|
||||
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; }
|
||||
};
|
||||
|
|
@ -65,7 +66,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task DownloadFileAsync(string fileLink, string installationPath)
|
||||
{
|
||||
var request = new RestRequest(fileLink);
|
||||
var request = new FRestRequest(fileLink);
|
||||
var data = _client.DownloadData(request);
|
||||
await File.WriteAllBytesAsync(installationPath, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EpicManifestParser.Objects;
|
||||
using FModel.Framework;
|
||||
using FModel.Settings;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
using RestSharp;
|
||||
|
|
@ -30,7 +31,7 @@ public class EpicApiEndpoint : AbstractApiProvider
|
|||
}
|
||||
}
|
||||
|
||||
var request = new RestRequest(_LAUNCHER_ASSETS);
|
||||
var request = new FRestRequest(_LAUNCHER_ASSETS);
|
||||
request.AddHeader("Authorization", $"bearer {UserSettings.Default.LastAuthResponse.AccessToken}");
|
||||
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
|
|
@ -44,7 +45,7 @@ public class EpicApiEndpoint : AbstractApiProvider
|
|||
|
||||
private async Task<AuthResponse> GetAuthAsync(CancellationToken token)
|
||||
{
|
||||
var request = new RestRequest(_OAUTH_URL, Method.Post);
|
||||
var request = new FRestRequest(_OAUTH_URL, Method.Post);
|
||||
request.AddHeader("Authorization", _BASIC_TOKEN);
|
||||
request.AddParameter("grant_type", "client_credentials");
|
||||
var response = await _client.ExecuteAsync<AuthResponse>(request, token).ConfigureAwait(false);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using AutoUpdaterDotNET;
|
||||
using FModel.Extensions;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
|
|
@ -34,7 +35,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
public async Task<News> GetNewsAsync(CancellationToken token, string game)
|
||||
{
|
||||
var request = new RestRequest($"https://api.fmodel.app/v1/news/{Constants.APP_VERSION}");
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/news/{Constants.APP_VERSION}");
|
||||
request.AddParameter("game", game);
|
||||
var response = await _client.ExecuteAsync<News>(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
|
|
@ -48,7 +49,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
public async Task<Info> GetInfosAsync(CancellationToken token, EUpdateMode updateMode)
|
||||
{
|
||||
var request = new RestRequest($"https://api.fmodel.app/v1/infos/{updateMode}");
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/infos/{updateMode}");
|
||||
var response = await _client.ExecuteAsync<Info>(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
return response.Data;
|
||||
|
|
@ -61,7 +62,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
public async Task<Backup[]> GetBackupsAsync(CancellationToken token, string gameName)
|
||||
{
|
||||
var request = new RestRequest($"https://api.fmodel.app/v1/backups/{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;
|
||||
|
|
@ -74,7 +75,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
public async Task<Game> GetGamesAsync(CancellationToken token, string gameName)
|
||||
{
|
||||
var request = new RestRequest($"https://api.fmodel.app/v1/games/{gameName}");
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/games/{gameName}");
|
||||
var response = await _client.ExecuteAsync<Game>(request, token).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
return response.Data;
|
||||
|
|
@ -87,7 +88,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
public async Task<CommunityDesign> GetDesignAsync(string designName)
|
||||
{
|
||||
var request = new RestRequest($"https://api.fmodel.app/v1/designs/{designName}");
|
||||
var request = new FRestRequest($"https://api.fmodel.app/v1/designs/{designName}");
|
||||
var response = await _client.ExecuteAsync<Community>(request).ConfigureAwait(false);
|
||||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
||||
return response.Data != null ? new CommunityDesign(response.Data) : null;
|
||||
|
|
@ -173,7 +174,7 @@ public class FModelApi : AbstractApiProvider
|
|||
|
||||
private void ShowChangelog(UpdateInfoEventArgs args)
|
||||
{
|
||||
var request = new RestRequest(args.ChangelogURL);
|
||||
var request = new FRestRequest(args.ChangelogURL);
|
||||
var response = _client.Execute(request);
|
||||
if (string.IsNullOrEmpty(response.Content)) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
using RestSharp;
|
||||
using System.Threading.Tasks;
|
||||
using FModel.Framework;
|
||||
|
||||
namespace FModel.ViewModels.ApiEndpoints;
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ public class FortniteApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task<PlaylistResponse> GetPlaylistAsync(string playlistId)
|
||||
{
|
||||
var request = new RestRequest($"https://fortnite-api.com/v1/playlists/{playlistId}");
|
||||
var request = new FRestRequest($"https://fortnite-api.com/v1/playlists/{playlistId}");
|
||||
var response = await _client.ExecuteAsync<PlaylistResponse>(request).ConfigureAwait(false);
|
||||
return response.Data;
|
||||
}
|
||||
|
|
@ -25,7 +26,7 @@ public class FortniteApiEndpoint : AbstractApiProvider
|
|||
|
||||
public bool TryGetBytes(Uri link, out byte[] data)
|
||||
{
|
||||
var request = new RestRequest(link);
|
||||
var request = new FRestRequest(link);
|
||||
data = _client.DownloadData(request);
|
||||
return data != null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using System.Runtime.InteropServices;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FModel.Framework;
|
||||
|
||||
namespace FModel.ViewModels.ApiEndpoints;
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ public class ValorantApiEndpoint : AbstractApiProvider
|
|||
|
||||
public async Task<VManifest> GetManifestAsync(CancellationToken token)
|
||||
{
|
||||
var request = new RestRequest(_URL);
|
||||
var request = new FRestRequest(_URL);
|
||||
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
|
||||
return new VManifest(response.RawBytes);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user