slashtechno / cloudflare-gateway-adblocking

Serverless ad blocking via Cloudflare Zero Trust gateway
https://pypi.org/project/cloudflare-gateway-adblocking/
MIT License
21 stars 6 forks source link

Can't use #8

Closed manhduonghn closed 1 year ago

manhduonghn commented 1 year ago

I installed cloudflare-gateway-adblocking on pypi but when I use command cloudflare-gateway-adblocking --account-id , it said Error

slashtechno commented 1 year ago

I installed cloudflare-gateway-adblocking on pypi but when I use command cloudflare-gateway-adblocking --account-id , it said Error

What error are you receiving? In addition to your account ID, you need to specify your access token.

Also, you need to use a subcommand. I assume you're trying to create the ad blocking rules. For this, you need to run cloudflare-gateway-adblocking upload, not just cloudflare-gateway-adblocking.

manhduonghn commented 1 year ago

Only use cloudflare-gateway-adblocking upload ? No need set cloudflare-gateway-adblocking --account-id

slashtechno commented 1 year ago

Only use cloudflare-gateway-adblocking upload ? No need set cloudflare-gateway-adblocking --account-id

You still need to set your account ID and token. This can be done either with command-line flags, environment variables, or a .env file

slashtechno commented 1 year ago

Considering you closed the issue, is it working now?

manhduonghn commented 1 year ago

I try to run on termux and Github codespace and it not work. Can't add account id

slashtechno commented 1 year ago

What error are you encountering?

manhduonghn commented 1 year ago

I was delete it but I try 7 times,it still fail when I command cloudflare-gateway-adblocking --account-id

slashtechno commented 1 year ago

In that case, you need to use the delete subcommand. You're also missing a Cloudflare token.

Your command should look like this: cloudflare-gateway-adblocking --account-id <account ID> --token <token> delete

slashtechno commented 1 year ago

Since you marked it as closed, did you resolve the issue?

manhduonghn commented 1 year ago

I will try it tomorrow

slashtechno commented 1 year ago

Okay, please leave the issue open for now. Closing the issue marks it as completed by default.

manhduonghn commented 1 year ago

#

IMG_20230813_091336 How to do that? I use Termux. Thanks

slashtechno commented 1 year ago

#

IMG_20230813_091336 How to do that? I use Termux. Thanks

To create the ad-block policy, you need to specify where your blocklist file/directory is with --blocklists <path>. This error is being raised as you have not specified a filepath which exists, and ./blocklists also doesn't exist.

manhduonghn commented 1 year ago

Still unknown to use. So sorry

slashtechno commented 1 year ago

Still unknown to use. So sorry

You need to download (or create) a blocklist in the format of a hosts file, and then specify the path to that file with --blocklists.

manhduonghn commented 1 year ago

Can I do it with my android phone?

slashtechno commented 1 year ago

Can I do it with my android phone?

Using Termux, you should be able to.

manhduonghn commented 1 year ago

cloudflare-gateway-adblocking --account-id () --token () upload --blocklists ./storage/emulated/0/Download/hosts.txt not work

manhduonghn commented 1 year ago

I think you make Github Action to run code is better. Everyone can do that

slashtechno commented 1 year ago

./storage/emulated/0/Download/hosts.txt

I think this should be /storage/emulated/0/Download/hosts.txt without the . before / since this isn't a relative path.

slashtechno commented 1 year ago

I think you make Github Action to run code is better. Everyone can do that

Github actions is meant more for CI/CD, which this is not.

manhduonghn commented 1 year ago

IMG_20230814_050600 It said that

slashtechno commented 1 year ago

IMG_20230814_050600 It said that

What scopes did you give to your token when generating it?

Make sure you're using the right account ID as well

manhduonghn commented 1 year ago

Yes, I use right ID user and my token is full permissions

manhduonghn commented 1 year ago

Screenshot_2023-08-14-05-24-43-314_org triple banana This token works when I use your tool

slashtechno commented 1 year ago

Screenshot_2023-08-14-05-24-43-314_org triple banana This token works when I use your tool

It also needs write/edit access to the scopes listed in the README

slashtechno commented 1 year ago

This is my token configuration:
Screenshot_20230813-182556.png

manhduonghn commented 1 year ago

I set permissions like that but it said IMG_20230814_054451

slashtechno commented 1 year ago

I set permissions like that but it said IMG_20230814_054451

Try deleting the policies and re-run. Make sure the hosts file you specified is not empty

manhduonghn commented 1 year ago

Screenshot_2023-08-14-08-37-51-063_com alif ide python Now I have this problem

manhduonghn commented 1 year ago

IMG_20230814_203339 Success, thanks so much

slashtechno commented 1 year ago

IMG_20230814_203339 Success, thanks so much

No problem, glad it's working now.

manhduonghn commented 1 year ago

But when I try Steven Black list. It failed Screenshot_2023-08-14-20-48-45-959_com termux

slashtechno commented 1 year ago

I think this has to do with a connection error. Try deleting and re-running it. I think that fixed it for me when I encountered a similar error.

manhduonghn commented 1 year ago

I will try

manhduonghn commented 1 year ago

I think this has to do with a connection error. Try deleting and re-running it. I think that fixed it for me when I encountered a similar error.

It's true

manhduonghn commented 1 year ago

I use this by Github Action. It's easier

manhduonghn commented 1 year ago

Screenshot_2023-08-15-23-52-11-124_com kiwibrowser browser

manhduonghn commented 1 year ago

I make this to use Github Action run your code and easier on Termux