diff --git a/README.md b/README.md index 27fcd32..cabf479 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,12 @@ Or with docker but building the container manually. ```sh docker build -t yt-dlp-webui . docker run -d -p 3033:3033 -v :/downloads yt-dlp-webui + +docker run -d -p 3033:3033 \ + -v :/downloads \ + -v :/config \ # optional + yt-dlp-webui + ``` If you opt to add RPC authentication... @@ -115,9 +121,11 @@ docker run -d \ -p 3033:3033 \ -e JWT_SECRET randomsecret -v /path/to/downloads:/downloads \ + -v /path/for/config:/config \ # optional marcobaobao/yt-dlp-webui \ --auth \ - --secret your_rpc_secret + --user your_username \ + --pass your_pass ``` If you wish for limiting the download queue size... @@ -163,8 +171,10 @@ Usage yt-dlp-webui: Port where server will listen at (default 3033) -qs int Download queue size (default 8) - -secret string - Secret required for auth + -user string + Username required for auth + -pass string + Password required for auth ``` ### Config file @@ -181,7 +191,9 @@ downloaderPath: /usr/local/bin/yt-dlp # Optional settings require_auth: true -rpc_secret: my_random_secret +username: my_username +password: my_random_secret + queue_size: 4 ``` diff --git a/frontend/src/views/Login.tsx b/frontend/src/views/Login.tsx index e81e7de..ba0851b 100644 --- a/frontend/src/views/Login.tsx +++ b/frontend/src/views/Login.tsx @@ -33,22 +33,32 @@ const Title = styled(Typography)({ }) export default function Login() { - const [secret, setSecret] = useState('') + const [username, setUsername] = useState('') + const [password, setPassword] = useState('') + const [formHasError, setFormHasError] = useState(false) const url = useRecoilValue(serverURL) const navigate = useNavigate() + const navigateAndReload = () => { + navigate('/') + window.location.reload() + } + const login = async () => { const res = await fetch(`${url}/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ secret }) + body: JSON.stringify({ + username, + password, + }) }) - res.ok ? navigate('/') : setFormHasError(true) + res.ok ? navigateAndReload() : setFormHasError(true) } return ( @@ -62,17 +72,23 @@ export default function Login() { Authentication token will expire after 30 days. - In order to enable RPC authentication append the --auth + In order to enable RPC authentication append the --auth, <br /> - and --secret [secret] flags. + --user [username] and --pass [password] flags. setSecret(e.currentTarget.value)} + onChange={e => setUsername(e.currentTarget.value)} + /> + setPassword(e.currentTarget.value)} />