Coder Social home page Coder Social logo

locke69321 / orpheushook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from s0up4200/redactedhook

1.0 0.0 0.0 110 KB

RedactedHook is a webhook companion service for autobrr designed to check the names of uploaders, your ratio, and record labels associated with torrents on Redacted.

License: MIT License

Go 79.51% Makefile 6.31% Dockerfile 14.18%

orpheushook's Introduction

OrpheusHook

Still work in progress and docker is not built yet

OrpheusHook is a webhook companion service for autobrr designed to check the names of uploaders, your ratio, and record labels associated with torrents on Orpheus. It provides a simple and efficient way to validate if uploaders are blacklisted or whitelisted, to stop racing in case your ratio falls below a certain point, and to verify if a torrent's record label matches against a specified list.

Features

  • Verify if an uploader's name is on a provided whitelist or blacklist.
  • Check for record labels. Useful for grabbing torrents from a specific label.
  • Check if a user's ratio meets a specified minimum value (additional API hit if used with the other two).
  • Check the torrentSize (Useful for not hitting the API from both autobrr and orpheushook)
  • Easy to integrate with other applications via webhook.
  • Rate Limiter set to a maximum of 10 requests per 10 seconds to abide by RED rules.

It was made with autobrr in mind.

Getting Started

Warning

Remember that autobrr also checks the RED API if you have min/max sizes set. This will result in you hitting the API 2x. So for your own good, don't set size checks in your autobrr filter is you use OrpheusHook.

Prerequisites

To run OrpheusHook, you'll need:

  1. Go 1.20 or later installed (if building from source)
  2. Access to Orpheus

Installation

Docker

docker pull ghcr.io/locke69321/orpheushook:latest

docker compose

version: "3.7"
services:
  orpheushook:
    container_name: orpheushook
    image: ghcr.io/locke69321/orpheushook:latest
    user: 1000:1000
    environment:
      - SERVER_ADDRESS=0.0.0.0 # binds to 127.0.0.1 by default
      - SERVER_PORT=42135 # defaults to 42135
    ports:
      - "42135:42135"

Using precompiled binaries

Download the appropriate binary for your platform from the releases page.

Building from source

  1. Clone the repository:
git clone https://github.com/locke69321/OrpheusHook.git
  1. Navigate to the project directory:
cd OrpheusHook
  1. Build the project:
go build

or

make build
  1. Run the compiled binary:
./bin/OrpheusHook

Usage

To use OrpheusHook, send POST requests to the following endpoint:

Endpoint: http://127.0.0.1:42135/orpheus/hook
Method: POST
Expected HTTP Status: 200

You can check the ratio, uploader, size and record label in a single request or separately. Keep in mind that checking the ratio will result in an additional API hit on the RED API, as it's not part of the same endpoint as uploaders and record labels.

JSON Payload for everything:

{
  "user_id": USER_ID,
  "apikey": "API_KEY",
  "minratio": MINIMUM_RATIO,
  "torrent_id": {{.TorrentID}},
  "uploaders": "USER1,USER2,USER3",
  "mode": "blacklist/whitelist",
  "record_labels": "LABEL1,LABEL2,LABEL3"
}

JSON Payload for ratio check:

{
  "user_id": USER_ID,
  "apikey": "API_KEY",
  "minratio": MINIMUM_RATIO
}

JSON Payload for uploader and size check:

{
  "torrent_id": {{.TorrentID}},
  "apikey": "API_KEY",
  "uploaders": "USER1,USER2,USER3",
  "mode": "blacklist/whitelist",
  "maxsize": 340155737
}

JSON Payload for record label check:

{
  "torrent_id": {{.TorrentID}},
  "apikey": "API_KEY",
  "record_labels": "LABEL1,LABEL2,LABEL3"
}

user_id is the number in the URL when you visit your profile.

api_key is your Orpheus API key. Needs user and torrents privileges.

minsize is the minimum allowed size measured in bytes you want to grab.

maxsize is the max allowed size measured in bytes you want to grab.

uploaders is a comma-separated list of uploaders to check against.

mode is either blacklist or whitelist. If blacklist is used, the torrent will be stopped if the uploader is found in the list. If whitelist is used, the torrent will be stopped if the uploader is not found in the list.

record_labels is a comma-separated list of record labels to check against.

curl commands for easy testing

curl -X POST -H "Content-Type: application/json" -d '{"user_id": 3855, "apikey": "e1be0c8f.6a1d6f89de6e9f6a61e6edcbb6a3a32d", "minratio": 1.0}' http://127.0.0.1:42135/orpheus/hook
curl -X POST -H "Content-Type: application/json" -d '{"torrent_id": 3931392, "apikey": "e1be0c8f.6a1d6f89de6e9f6a61e6edcbb6a3a32d", "mode": "blacklist", "uploaders": "blacklisted_user1,blacklisted_user2,blacklisted_user3"}' http://127.0.0.1:42135/orpheus/hook
curl -X POST -H "Content-Type: application/json" -d '{"torrent_id": 3931392, "apikey": "e1be0c8f.6a1d6f89de6e9f6a61e6edcbb6a3a32d", "maxsize": 340155737}' http://127.0.0.1:42135/orpheus/hook

orpheushook's People

Contributors

s0up4200 avatar sconklin321 avatar

Stargazers

Schaka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.