diff --git a/README.md b/README.md index 6f20d35..6007571 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ Quasarr includes a solution to quickly and easily decrypt protected links. Just follow the link from the console output (or discord notification) and solve the CAPTCHA. Quasarr will confidently handle the rest. +**Warning: this project is still in the proof-of-concept stage. +It is only tested with Radarr and the three currently supported hostnames.** + # Instructions * Follow instructions to set up at least one hostname for Quasarr @@ -24,9 +27,6 @@ Quasarr will confidently handle the rest. * Use this API key: `quasarr` * As with other download clients, you must ensure the download path used by JDownloader is accessible to *arr. -**Warning: this project is still in the proof-of-concept stage. -It is only tested with Radarr and only two hostname are currently supported.** - # Setup `pip install quasarr` diff --git a/quasarr/__init__.py b/quasarr/__init__.py index 0572eca..88360e7 100644 --- a/quasarr/__init__.py +++ b/quasarr/__init__.py @@ -12,10 +12,10 @@ import time from quasarr.arr import api -from quasarr.persistence.config import Config, get_clean_hostnames -from quasarr.persistence.sqlite_database import DataBase +from quasarr.storage.config import Config, get_clean_hostnames +from quasarr.storage.sqlite_database import DataBase from quasarr.providers import shared_state, version -from quasarr.providers.setup import path_config, hostnames_config, nx_credentials_config, jdownloader_config +from quasarr.storage.setup import path_config, hostnames_config, nx_credentials_config, jdownloader_config def run(): @@ -45,7 +45,7 @@ def run(): config_path = "/config" if not arguments.internal_address: print( - "You must set the INTERNAL_ADDRESS variable to a locally reachable URL, e.g. http://localhost:8080") + "You must set the INTERNAL_ADDRESS variable to a locally reachable URL, e.g. http://192.168.1.1:8080") print("The local URL will be used by Radarr/Sonarr to connect to Quasarr") print("Stopping Quasarr...") sys.exit(1) diff --git a/quasarr/arr/__init__.py b/quasarr/arr/__init__.py index 14f094d..d7e0f9c 100644 --- a/quasarr/arr/__init__.py +++ b/quasarr/arr/__init__.py @@ -2,6 +2,7 @@ # Quasarr # Project by https://github.com/rix1337 +import json import re import traceback from base64 import urlsafe_b64decode @@ -25,30 +26,72 @@ def api(shared_state_dict, shared_state_lock): app = Bottle() - @app.route('/captcha') + @app.get('/captcha') def serve_captcha(): - protected = shared_state.get_db("protected").retrieve_all_titles() - if not protected: - return render_centered_html('
No protected packages found! CAPTCHA not needed.
') try: device = shared_state.values["device"] except KeyError: device = None if not device: - return render_centered_html('JDownloader connection not established.
') + return render_centered_html(f'''JDownloader connection not established.
+ {render_button("Back", "primary", {"onclick": "location.href='/'"})}''') + + protected = shared_state.get_db("protected").retrieve_all_titles() + if not protected: + return render_centered_html(f'''No protected packages found! CAPTCHA not needed.
+ {render_button("Back", "primary", {"onclick": "location.href='/'"})}''') + else: + package = protected[0] + package_id = package[0] + data = json.loads(package[1]) + title = data["title"] + links = data["links"] + password = data["password"] + + link_options = "" + if len(links) > 1: + for link in links: + if "filecrypt." in link[0]: + link_options += f'' + link_select = f'''