Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to block certain domains from being imported with url #6537

Open
Xudros opened this issue Aug 6, 2024 · 6 comments
Open

Ability to block certain domains from being imported with url #6537

Xudros opened this issue Aug 6, 2024 · 6 comments

Comments

@Xudros
Copy link

Xudros commented Aug 6, 2024

Describe the problem to be solved

I'm currently in need of a way to block certain domains that I don't want to be imported to my instance through the URL import.

Describe the solution you would like

I was trying to make a plugin but as I'm very inexperienced with this I cant do it alone, my idea is that when someone imports a URL, it takes the start of it like "https://example.com" scans until the end and stops right before it gets a third / or a : as that's what is normally after the domain, and compares it to a list you'll be able to make in settings, I have parts of a plugin made for it but as I don't know how to use the hooks in peertube to get the URL or even the right hook to try and use for when they upload a URL or even if I should be using hooks but I'm assuming so, if someone can point me in the right direction for the plugin I can do my best, or if this becomes a new feature in an update awesome!

@Chocobozzz
Copy link
Owner

Hi,

I think an "allowlist" of URL host would be a better solution than a "blocklist", because with a blocklist a user can easily setup a domain name that redirects to a blocked URL.

@Xudros
Copy link
Author

Xudros commented Aug 7, 2024

That is a much better idea, and would work perfectly for my case too. I completely forgot about redirecting when I was trying to do this

@Xudros
Copy link
Author

Xudros commented Aug 9, 2024

What hooks should I use to get the url when uploaded, and then block?

@Chocobozzz
Copy link
Owner

filter:api.video.pre-import-url.accept.result I think

@Xudros
Copy link
Author

Xudros commented Aug 10, 2024

apparently I suck at JavaScript. I cant figure out the structure that the plugin needs, https://github.com/Xudros/peertube-plugin-auto-block-domain this is what I have right now and its pretty much just a cobbled together mess.

@Xudros
Copy link
Author

Xudros commented Aug 18, 2024

I figured it out, the plugin is published for anyone also wanting this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants