Idk, dev work goin on
This commit is contained in:
@@ -10,7 +10,7 @@ namespace WinWARP.Core.Services.Implementations;
|
||||
|
||||
public class SubscriptionDbService : ISubscriptionDbService
|
||||
{
|
||||
private IDbContextFactory<AppDbContext> _dbContextFactory;
|
||||
private readonly IDbContextFactory<AppDbContext> _dbContextFactory;
|
||||
|
||||
public SubscriptionDbService(IDbContextFactory<AppDbContext> dbContextFactory)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WinWARP.Core.Helper;
|
||||
using WinWARP.Core.Models.Entities;
|
||||
using WinWARP.Core.Services.Interfaces;
|
||||
|
||||
namespace WinWARP.Core.Services.Implementations;
|
||||
|
||||
public class SubscriptionFetcher : ISubscriptionFetcher
|
||||
{
|
||||
public bool IsUrlValid(string subscriptionUrl)
|
||||
{
|
||||
Uri? validatedUri;
|
||||
if (!Uri.TryCreate(subscriptionUrl, UriKind.Absolute, out validatedUri))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return validatedUri.Scheme == Uri.UriSchemeHttp ||
|
||||
validatedUri.Scheme == Uri.UriSchemeHttps;
|
||||
}
|
||||
|
||||
public async Task<Subscription> FetchAsync(string subscriptionUrl)
|
||||
{
|
||||
// TODO: Implement the actual fetching logic here, e.g., using HttpClient to get the subscription data from the URL.
|
||||
await Task.Delay(10); // Simulate an asynchronous operation
|
||||
return new Subscription
|
||||
{
|
||||
DefaultTitle = "Default Subscription",
|
||||
Link = subscriptionUrl,
|
||||
Servers = [new() { DefaultTitle = "Default Server", Region = "NO", Title = "Not default title" }]
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user