mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Add auth options as flags

Open chrisbgp opened this issue 9 years ago • 2 comments
trafficstars

Feature request as it works much better with scripts/aliases:

Add --user= and --pass= for http and maybe other network protocols...Much easier than entering it in the URL directly.

chrisbgp avatar Jan 06 '16 22:01 chrisbgp

Would be nice to also have a configuration file to specify that for some (HTTP) targets, because modifying the URL every time you click a link gets a bit boring. :-)

synnack avatar Jul 06 '21 14:07 synnack

I found a workaround but only if you host your own http server and have full access to its config.

You can do something like this in ngnix for example:

in your host.conf

map_hash_bucket_size 256;
map $http_user_agent $auth {
    default 0;
    "randstring" 1;
}

location /yourlocation/ {
    if ($auth = 0) {
        return 403;
    }
    # do stuff here
    proxy_pass http://backend;
}

then in your mpv config

--user-agent=randstring

you can then watch video files without having to pass http basic auth credentials each time, the only downside I found so far is that you cannot specify in mpv config to use this user agent only for a specific host group, this will be used everywhere, so use a random string or whatever you like.

licentiapoetica avatar Feb 18 '24 00:02 licentiapoetica