mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Enforce SOCKS proxy setting in search engine plugins
Previously it require each plugin to import helpers.py to setup SOCKS proxy. Now it is enforced by default for all plugins. Also added a function for plugins to ignore/restore the socket to default state. PR #22554.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.48
|
||||
# VERSION: 1.49
|
||||
|
||||
# Author:
|
||||
# Fabien Devaux <fab AT gnux DOT info>
|
||||
@@ -46,6 +46,16 @@ from multiprocessing import Pool, cpu_count
|
||||
from os import path
|
||||
from typing import Optional
|
||||
|
||||
# qbt tend to run this script in 'isolate mode' so append the current path manually
|
||||
current_path = str(pathlib.Path(__file__).parent.resolve())
|
||||
if current_path not in sys.path:
|
||||
sys.path.append(current_path)
|
||||
|
||||
import helpers
|
||||
|
||||
# enable SOCKS proxy for all plugins by default
|
||||
helpers.enable_socks_proxy(True)
|
||||
|
||||
THREADED: bool = True
|
||||
try:
|
||||
MAX_THREADS: int = cpu_count()
|
||||
@@ -182,11 +192,6 @@ def run_search(search_params: tuple[type[Engine], str, Category]) -> bool:
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main() -> int:
|
||||
# qbt tend to run this script in 'isolate mode' so append the current path manually
|
||||
current_path = str(pathlib.Path(__file__).parent.resolve())
|
||||
if current_path not in sys.path:
|
||||
sys.path.append(current_path)
|
||||
|
||||
# https://docs.python.org/3/library/sys.html#sys.exit
|
||||
class ExitCode(Enum):
|
||||
OK = 0
|
||||
|
||||
Reference in New Issue
Block a user