Skip to content

Commit f0d8559

Browse files
author
cedya77
committed
feat: allow enabling rating posters with custom url patterns
Update frontend and backend checks to allow users to enable rating posters for catalogs and searches when a custom poster URL pattern is configured, even if RPDB or Top Poster API keys are not provided.
1 parent 935941e commit f0d8559

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

addon/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,10 +3179,11 @@ addon.get("/stremio/:userUUID/catalog/:type/:id/:extra?.json", async function (r
31793179
}
31803180
const actualType = catalogConfig ? catalogConfig.type : type;
31813181

3182-
// Check if user has either RPDB or Top Poster API key
3182+
// Check if user has either RPDB, Top Poster API key, or a custom poster pattern
31833183
const hasRatingPosterKey =
31843184
(config.apiKeys?.rpdb && config.apiKeys.rpdb.trim().length > 0) ||
3185-
(config.apiKeys?.topPoster && config.apiKeys.topPoster.trim().length > 0);
3185+
(config.apiKeys?.topPoster && config.apiKeys.topPoster.trim().length > 0) ||
3186+
(config.customPosterUrlPattern && config.customPosterUrlPattern.trim().length > 0);
31863187

31873188
if (catalogConfig && !hasRatingPosterKey) {
31883189
catalogConfig.enableRatingPosters = false;

configure/src/components/sections/CatalogsSettings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ const MDBListSettingsDialog = ({ catalog, isOpen, onClose }: { catalog: CatalogC
481481
Choose which genre set to use for this specific list.
482482
</p>
483483
</div>
484-
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster) && (
484+
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster || config.customPosterUrlPattern) && (
485485
<div className="space-y-2">
486486
<div className="flex items-center justify-between">
487487
<div className="space-y-0.5">
@@ -1002,7 +1002,7 @@ const LetterboxdSettingsDialog = ({ catalog, isOpen, onClose }: { catalog: Catal
10021002
How long to cache this catalog before refreshing. Range: 2 hours to 7 days.
10031003
</p>
10041004
</div>
1005-
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster) && (
1005+
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster || config.customPosterUrlPattern) && (
10061006
<div className="space-y-2">
10071007
<div className="flex items-center justify-between">
10081008
<div className="space-y-0.5">
@@ -1266,7 +1266,7 @@ const CustomManifestSettingsDialog = ({ catalog, isOpen, onClose }: { catalog: C
12661266
Number of items per page for this catalog. Default: 100. This should match the imported addon's page size for accurate pagination.
12671267
</p>
12681268
</div>
1269-
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster) && (
1269+
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster || config.customPosterUrlPattern) && (
12701270
<div className="space-y-2">
12711271
<div className="flex items-center justify-between">
12721272
<div className="space-y-0.5">
@@ -1975,7 +1975,7 @@ const SortableCatalogItem = ({ catalog, onEditDiscover, onCustomize }: {
19751975
<TooltipContent><p>{catalog.showInHome && catalog.enabled ? 'Featured on Home Board' : 'Not on Home Board'}</p></TooltipContent>
19761976
</Tooltip>
19771977

1978-
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster) && (
1978+
{(config.apiKeys?.rpdb || config.apiKeys?.topPoster || config.customPosterUrlPattern) && (
19791979
<Tooltip>
19801980
<TooltipTrigger asChild>
19811981
<Button
@@ -3576,7 +3576,7 @@ function CatalogsSettingsContent({
35763576
onSetDisplayType={handleBulkSetDisplayType}
35773577
onResetDisplayType={handleBulkResetDisplayType}
35783578
onFindReplaceType={handleBulkFindReplaceType}
3579-
hasRatingPostersKey={!!config.apiKeys?.rpdb || !!config.apiKeys?.topPoster}
3579+
hasRatingPostersKey={!!config.apiKeys?.rpdb || !!config.apiKeys?.topPoster || !!config.customPosterUrlPattern}
35803580
isLoading={isLoading}
35813581
loadingAction={loadingAction}
35823582
/>

configure/src/components/sections/SearchSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export function SearchSettings() {
430430

431431
// Check if TVDB key and rating poster keys are available
432432
const hasTvdbKey = !!config.apiKeys?.tvdb?.trim() || hasBuiltInTvdb;
433-
const hasRPDBKey = !!config.apiKeys?.rpdb || !!config.apiKeys?.topPoster;
433+
const hasRPDBKey = !!config.apiKeys?.rpdb || !!config.apiKeys?.topPoster || !!config.customPosterUrlPattern;
434434
const isTraktSearchEnabled = traktSearchEnabled;
435435
const movieSearchProviders = allSearchProviders.filter(p => {
436436
if ((p.value === 'trakt.search' || p.value === 'trakt.people.search') && !isTraktSearchEnabled) {

0 commit comments

Comments
 (0)