Skip to content

Commit d1e33b8

Browse files
authored
Merge pull request #10 from varthe/approve-on-no-match
Default overseerr behaviour on no match
2 parents a990fd4 + fe6e5fa commit d1e33b8

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ The configuration for Redirecterr is defined in `config.yaml`. Below is a breakd
6161
- **`overseerr_url`**: The base URL of your Overseerr instance.
6262
- **`overseerr_api_token`**: The API token for your Overseerr instance.
6363

64+
### Fallback Settings
65+
- **`approve_on_no_match`**: When no filters match, the request is approved automatically and handled by Overseerr according to its default settings. (Recommended)
6466
### Instances
6567

6668
Define your Radarr and Sonarr instances in this section. You can name the instances as needed.
@@ -96,6 +98,8 @@ Redirecterr processes filters sequentially and will apply the first matching fil
9698
overseerr_url: "https://my-overseerr-instance.com"
9799
overseerr_api_token: "YOUR_API_TOKEN"
98100
101+
approve_on_no_match: True
102+
99103
instances:
100104
radarr: # Custom instance name
101105
server_id: 0

configBuilder.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const schema = {
1818
type: "string",
1919
minLength: 1,
2020
},
21+
approve_on_no_match: {
22+
type: "boolean",
23+
},
2124
instances: {
2225
type: "object",
2326
patternProperties: {

main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const findMatchingInstances = (webhook, data, filters) => {
119119
})
120120

121121
if (!matchingFilter) {
122-
logger.warn("No matching filter found for the current webhook")
122+
logger.info("No matching filter found for the current webhook")
123123
return null
124124
}
125125

@@ -218,6 +218,11 @@ app.post("/webhook", async (req, res) => {
218218
const instances = findMatchingInstances(req.body, data, config.filters)
219219
const postData = getPostData(req.body)
220220
if (instances) await sendToInstances(instances, request.request_id, postData)
221+
else if (config.approve_on_no_match) {
222+
logger.info(`Approving unmatched request ID ${request.request_id}`)
223+
await approveRequest(request.request_id)
224+
}
225+
221226
return res.status(200).send()
222227
} catch (error) {
223228
const message = `Error handling webhook: ${error.message}`

0 commit comments

Comments
 (0)