Merge pull request #1005 from tcely/patch-12

Add Proof-of-Origin Token plugin framework
This commit is contained in:
meeb 2025-05-18 22:05:55 +10:00 committed by GitHub
commit 6fa142bec3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 1 deletions

View File

@ -24,3 +24,5 @@ yt-dlp = {extras = ["default", "curl-cffi"], version = "*"}
emoji = "*"
brotli = "*"
html5lib = "*"
yt-dlp-get-pot = "*"
bgutil-ytdlp-pot-provider = "*"

View File

@ -5,6 +5,8 @@ worker_processes auto;
worker_cpu_affinity auto;
pid /run/nginx.pid;
env YT_POT_BGUTIL_BASE_URL;
events {
worker_connections 1024;
}
@ -135,4 +137,7 @@ http {
}
}
# Proof-of-Origin Token Server
include /etc/nginx/token_server.conf;
}

View File

@ -0,0 +1,29 @@
upstream token_server {
server 127.0.0.2:4416 down;
}
server {
# Ports
listen 4416;
listen [::]:4416;
# Server domain name
server_name _;
set_by_lua_block $pot_url {
local default = 'http://token_server'
local url = os.getenv('YT_POT_BGUTIL_BASE_URL')
if not url then
return default
end
if #url and url:find('://') then
return url
end
return default
}
location / {
proxy_pass $pot_url;
}
}

View File

@ -2,4 +2,15 @@
cd /
https="${TUBESYNC_POT_HTTPS:+https}"
ip_address="${TUBESYNC_POT_IPADDR:-${POTSERVER_PORT_4416_TCP_ADDR}}"
: "${TUBESYNC_POT_PORT:=${POTSERVER_PORT_4416_TCP_PORT}}"
port="${TUBESYNC_POT_PORT:+:}${TUBESYNC_POT_PORT}"
if [ -n "${ip_address}" ]
then
YT_POT_BGUTIL_BASE_URL="${https:-http}://${ip_address}${port}"
export YT_POT_BGUTIL_BASE_URL
fi
exec /usr/bin/openresty -c /etc/nginx/nginx.conf -e stderr

View File

@ -8,7 +8,7 @@ CONFIG_BASE_DIR = BASE_DIR
DOWNLOADS_BASE_DIR = BASE_DIR
VERSION = '0.15.2'
VERSION = '0.15.3'
SECRET_KEY = ''
DEBUG = False
ALLOWED_HOSTS = []