alexta69 / metube

Self-hosted YouTube downloader (web UI for youtube-dl / yt-dlp)
GNU Affero General Public License v3.0
3.95k stars 259 forks source link

[feature] set a public url for hosting #429

Closed vaaski closed 1 month ago

vaaski commented 2 months ago

I want my MeTube instance to be only accessible in the local network, but the output folder gets served by caddy publicly. Could you add a environment variable for a public host url? So that the links in the UI don't point to /downloads/video.mp4 but https://example.com/video.mp4?

Thanks a bunch

PikuZheng commented 2 months ago

it depends caddy i think maybe rewrite?

redir 302 {/downloads http://url/{uri}}
vaaski commented 2 months ago

@PikuZheng I think you're misunderstanding what I'm trying to describe. My request has essentially nothing to do with caddy specifically, it's just what I use to serve the output folder of MeTube. What I want is a faster way to get that link instead of the relative local network one.

To give a more detailed example: I access my MeTube instance over http://homeserver:8069 and the download folder gets served at https://public.example.com - that part already works. But when I copy a link from the MeTube UI, it's relative to my local address e.g. http://homeserver:8069/downloads/video.mp4, but I want it like https://public.example.com/video.mp4.

My request is a simple option to set a public URL prefix that changes the links in the UI, and it seems like the URL_PREFIX variable serves a different purpose.

If you're open to contributions I'll have a look into adding it myself as it should be a relatively simple option, just let me know.

PikuZheng commented 2 months ago

sorry my misunderstanding.

PikuZheng commented 2 months ago

Unfortunately the url prefix needs to be defined statically before compilation https://github.com/alexta69/metube/blob/637f456de3ce463405465c6ba05784d92b68ee8d/ui/src/app/app.component.ts#L236

and there are difficulties in dynamically reading docker env with angular. so a better way is to modify this line to your own uri and then recompile it or modify it from the browser using something like TamperMonkey

vaaski commented 2 months ago

I am looking at implementing this similar to the metube_theme variable. I'll open a PR in a bit.

EDIT: It seems like I could just use the DownloadsService configuration object.