Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ jobs:

- name: Get Previous Release
id: previous-release
continue-on-error: true
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -409,13 +410,17 @@ jobs:
github-token: ${{ github.token }}
result-encoding: string
script: |
const { data } = await github.rest.repos.generateReleaseNotes({
const previousTag = '${{ steps.previous-release.outputs.tag_name }}';
const params = {
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: 'v${{ needs.build.outputs.version }}',
target_commitish: '${{ github.sha }}',
previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}',
})
};
if (previousTag) {
params.previous_tag_name = previousTag;
}
const { data } = await github.rest.repos.generateReleaseNotes(params);
return data.body

- name: Create Release
Expand Down
25 changes: 24 additions & 1 deletion src/NzbDrone.Host/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using DryIoc;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -103,6 +104,8 @@ public void ConfigureServices(IServiceCollection services)
{
options.DefaultExpirationTimeSpan = TimeSpan.FromMinutes(cacheTtl);
options.SizeLimit = cacheSize * 1024 * 1024;
options.AddPolicy("NewznabQuery", builder =>
builder.With(context => !IsRssRequest(context.HttpContext.Request)));
});

services
Expand Down Expand Up @@ -293,9 +296,9 @@ public void Configure(IApplicationBuilder app,

app.UseRouting();
app.UseCors();
app.UseOutputCache();
app.UseAuthentication();
app.UseAuthorization();
app.UseOutputCache();
app.UseResponseCompression();
app.Properties["host.AppName"] = BuildInfo.AppName;

Expand Down Expand Up @@ -348,5 +351,25 @@ private void EnsureSingleInstance(bool isService, IStartupContext startupContext
instancePolicy.PreventStartIfAlreadyRunning();
}
}

private static bool IsRssRequest(HttpRequest request)
{
var query = request.Query;
var requestType = query["t"].ToString();

if (requestType is not ("search" or "tvsearch" or "movie" or "music" or "book"))
{
return false;
}

string[] searchParams =
{
"q", "imdbid", "tmdbid", "tvdbid", "rid", "tvmazeid", "traktid", "doubanid",
"season", "ep", "album", "artist", "label", "track", "year", "genre",
"author", "title", "publisher"
};

return searchParams.All(param => string.IsNullOrWhiteSpace(query[param].ToString()));
}
}
}
2 changes: 1 addition & 1 deletion src/Prowlarr.Api.V1/Indexers/NewznabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public NewznabController(IndexerFactory indexerFactory,

[HttpGet("/api/v1/indexer/{id:int}/newznab")]
[HttpGet("{id:int}/api")]
[OutputCache]
[OutputCache(PolicyName = "NewznabQuery")]
public async Task<IActionResult> GetNewznabResponse(int id, [FromQuery] NewznabRequest request)
{
var requestType = request.t;
Expand Down
Loading