Skip to content

Commit

Permalink
Move server to Rdx; Rdx v1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Decimation committed Feb 4, 2025
1 parent 836246c commit 13606fc
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 297 deletions.
3 changes: 3 additions & 0 deletions SmartImage.Lib/Engines/Impl/Search/IqdbEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ private async Task<IDocument> GetDocumentAsync(SearchQuery query, CancellationTo
// goto ret;

}
else {
// Debugger.Break();
}

response?.Dispose();

Expand Down
9 changes: 9 additions & 0 deletions SmartImage.Lib/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SmartImage.Lib/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,7 @@
<data name="Url_GitHubApi" xml:space="preserve">
<value>https://api.github.com/repos/Decimation/SmartImage/releases</value>
</data>
<data name="Err_Content" xml:space="preserve">
<value>Invalid content: missing data</value>
</data>
</root>
28 changes: 28 additions & 0 deletions SmartImage.Lib/Results/Data/DefaultCookiesProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Author: Deci | Project: SmartImage.Lib | Name: DefaultCookiesProvider.cs
// Date: 2025/02/04 @ 12:02:26

using Kantan.Net.Web;

namespace SmartImage.Lib.Results.Data;

public class DefaultCookiesProvider : ICookiesProvider
{

public List<IBrowserCookie> Cookies { get; }

public DefaultCookiesProvider()
{
Cookies = new List<IBrowserCookie>();
}

public ValueTask<IList<IBrowserCookie>> GetOrLoadCookiesAsync(CancellationToken ct = default)
{
return ValueTask.FromResult<IList<IBrowserCookie>>(Cookies);
}

public void Dispose()
{
Cookies.Clear();
}

}
3 changes: 1 addition & 2 deletions SmartImage.Lib/Results/Data/ICookiesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ public interface ICookiesProvider : IDisposable

public ValueTask<IList<IBrowserCookie>> GetOrLoadCookiesAsync(CancellationToken ct = default);

public static ICookiesProvider Default { get; set; }

public static ICookiesProvider GetProvider()
{
if (BaseOSIntegration.Integration.IsFirefoxInstalled) {
return new BrowserCookiesProvider(new FirefoxCookieReader());
}

return null;
return new DefaultCookiesProvider();
}

}
7 changes: 4 additions & 3 deletions SmartImage.Lib/SearchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,14 @@ public async ValueTask LoadEnginesAsync(CancellationToken token = default)
if (Config.ReadCookies) {

try {
await ((BrowserCookiesProvider) ICookiesProvider.Default).OpenAsync();
Config.CookiesProvider = ICookiesProvider.GetProvider();

await ((BrowserCookiesProvider) Config.CookiesProvider).OpenAsync();
}
catch (Exception e) {
Trace.WriteLine($"{e}");
Config.ReadCookies = false;
ICookiesProvider.Default.Dispose();
Config.CookiesProvider.Dispose();
}
}

Expand All @@ -324,7 +326,6 @@ public async ValueTask LoadEnginesAsync(CancellationToken token = default)

if (Config.FlareSolverr && !FlareSolverrClient.Value.IsInitialized) {


var ok = FlareSolverrClient.Value.Configure(Config.FlareSolverrApiUrl);

if (!ok) {
Expand Down
3 changes: 1 addition & 2 deletions SmartImage.Lib/SearchConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public bool ReadCookies
// TODO: cookies.txt support
// TODO: specify cookies source

[CBN]
public ICookiesProvider CookiesProvider { get; set; } = ICookiesProvider.Default;
public ICookiesProvider CookiesProvider { get; set; }

/// <remarks>
///
Expand Down
7 changes: 5 additions & 2 deletions SmartImage.Lib/SearchQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ public async Task<Url> UploadAsync(BaseUploadEngine engine = null, CancellationT

string fu;

if (Source.IsFile)
if (Source.IsFile) {
fu = Source.ValueString;
else
}
else {
fu = Source.WriteToFile();
Trace.WriteLine($"Wrote to file {fu}");
}

engine ??= BaseUploadEngine.Default;

Expand Down
224 changes: 0 additions & 224 deletions SmartImage.Lib/SearchServer.cs

This file was deleted.

Loading

0 comments on commit 13606fc

Please sign in to comment.