mirror of
https://github.com/jellyfin/jellyfin-plugin-opensubtitles.git
synced 2024-11-22 21:59:52 +00:00
10.9
This commit is contained in:
parent
24d30df23e
commit
6d8ee4eb7a
@ -15,7 +15,7 @@ namespace Jellyfin.Plugin.OpenSubtitles.API
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
[Authorize(Policy = "DefaultAuthorization")]
|
||||
[Authorize]
|
||||
public class OpenSubtitlesController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -19,7 +19,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jellyfin.Common" Version="10.*-*" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -82,10 +82,7 @@ namespace Jellyfin.Plugin.OpenSubtitles
|
||||
/// <inheritdoc />
|
||||
public async Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
await Login(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
@ -39,10 +39,7 @@ namespace Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler
|
||||
/// <returns>logout status.</returns>
|
||||
public static async Task<bool> LogOutAsync(LoginInfo user, string apiKey, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(user.Token))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user.Token), "Token is null or empty");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(user.Token);
|
||||
|
||||
var headers = new Dictionary<string, string> { { "Authorization", user.Token } };
|
||||
|
||||
@ -60,10 +57,7 @@ namespace Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler
|
||||
/// <returns>The encapsulated user info.</returns>
|
||||
public static async Task<ApiResponse<EncapsulatedUserInfo>> GetUserInfo(LoginInfo user, string apiKey, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(user.Token))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user.Token), "Token is null or empty");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(user.Token);
|
||||
|
||||
var headers = new Dictionary<string, string> { { "Authorization", user.Token } };
|
||||
|
||||
@ -82,10 +76,7 @@ namespace Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler
|
||||
/// <returns>The subtitle download info.</returns>
|
||||
public static async Task<ApiResponse<SubtitleDownloadInfo>> GetSubtitleLinkAsync(int file, LoginInfo user, string apiKey, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(user.Token))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user.Token), "Token is null or empty");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(user.Token);
|
||||
|
||||
var headers = new Dictionary<string, string> { { "Authorization", user.Token } };
|
||||
|
||||
|
@ -53,11 +53,7 @@ namespace Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler
|
||||
throw new ArgumentException("Provided API key is blank", nameof(apiKey));
|
||||
}
|
||||
|
||||
if (!headers.ContainsKey("Api-Key"))
|
||||
{
|
||||
headers.Add("Api-Key", apiKey);
|
||||
}
|
||||
|
||||
headers.TryAdd("Api-Key", apiKey);
|
||||
if (_hRemaining == 0)
|
||||
{
|
||||
await Task.Delay(1000 * _hReset, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -2,8 +2,8 @@ name: "Open Subtitles"
|
||||
guid: "4b9ed42f-5185-48b5-9803-6ff2989014c4"
|
||||
imageUrl: "https://repo.jellyfin.org/releases/plugin/images/jellyfin-plugin-opensubtitles.png"
|
||||
version: 19
|
||||
targetAbi: "10.8.10.0"
|
||||
framework: "net6.0"
|
||||
targetAbi: "10.9.0.0"
|
||||
framework: "net8.0"
|
||||
owner: "jellyfin"
|
||||
overview: "Download subtitles for your media"
|
||||
description: "Download subtitles from the internet to use with your media files."
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user