feat: add support for proxies to use with IRC and Indexers (#1421)

* feat: add support for proxies

* fix(http): release handler

* fix(migrations): define proxy early

* fix(migrations): pg proxy

* fix(proxy): list update delete

* fix(proxy): remove log and imports

* feat(irc): use proxy

* feat(irc): tests

* fix(web): update imports for ProxyForms.tsx

* fix(database): migration

* feat(proxy): test

* feat(proxy): validate proxy type

* feat(proxy): validate and test

* feat(proxy): improve validate and test

* feat(proxy): fix db schema

* feat(proxy): add db tests

* feat(proxy): handle http errors

* fix(http): imports

* feat(proxy): use proxy for indexer downloads

* feat(proxy): indexerforms select proxy

* feat(proxy): handle torrent download

* feat(proxy): skip if disabled

* feat(proxy): imports

* feat(proxy): implement in Feeds

* feat(proxy): update helper text indexer proxy

* feat(proxy): add internal cache
This commit is contained in:
ze0s 2024-09-02 11:10:45 +02:00 committed by GitHub
parent 472d327308
commit bc0f4cc055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 2533 additions and 371 deletions

View file

@ -14,6 +14,20 @@ CREATE TABLE users
UNIQUE (username)
);
CREATE TABLE proxy
(
id SERIAL PRIMARY KEY,
enabled BOOLEAN,
name TEXT NOT NULL,
type TEXT NOT NULL,
addr TEXT NOT NULL,
auth_user TEXT,
auth_pass TEXT,
timeout INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE indexer
(
id SERIAL PRIMARY KEY,
@ -24,8 +38,11 @@ CREATE TABLE indexer
enabled BOOLEAN,
name TEXT NOT NULL,
settings TEXT,
use_proxy BOOLEAN DEFAULT FALSE,
proxy_id INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (proxy_id) REFERENCES proxy(id) ON DELETE SET NULL,
UNIQUE (identifier)
);
@ -51,8 +68,11 @@ CREATE TABLE irc_network
bot_mode BOOLEAN DEFAULT FALSE,
connected BOOLEAN,
connected_since TIMESTAMP,
use_proxy BOOLEAN DEFAULT FALSE,
proxy_id INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (proxy_id) REFERENCES proxy(id) ON DELETE SET NULL,
UNIQUE (server, port, nick)
);
@ -900,5 +920,39 @@ ADD COLUMN months TEXT;
ALTER TABLE filter
ADD COLUMN days TEXT;
`,
`CREATE TABLE proxy
(
id SERIAL PRIMARY KEY,
enabled BOOLEAN,
name TEXT NOT NULL,
type TEXT NOT NULL,
addr TEXT NOT NULL,
auth_user TEXT,
auth_pass TEXT,
timeout INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE indexer
ADD COLUMN proxy_id INTEGER;
ALTER TABLE indexer
ADD COLUMN use_proxy BOOLEAN DEFAULT FALSE;
ALTER TABLE indexer
ADD FOREIGN KEY (proxy_id) REFERENCES proxy
ON DELETE SET NULL;
ALTER TABLE irc_network
ADD COLUMN proxy_id INTEGER;
ALTER TABLE irc_network
ADD COLUMN use_proxy BOOLEAN DEFAULT FALSE;
ALTER TABLE irc_network
ADD FOREIGN KEY (proxy_id) REFERENCES proxy
ON DELETE SET NULL;
`,
}