How to Edit The User Rules Externally?

murat57

New Member
It's some kind of XY Problem. I'll try to keep it short but probably it won't.

I am using a forum that uses Xenforo. Xenforo has 1000 hard coded ignore limit. I want to exceed that. I don't want to see people. Also I don't want to see some peoples avatars, I'm OK with their messages. My main problem is this.

My first solution is this. I made a custom browser extension with Manifest V3. It currently adds 2 buttons (message and avatar) next to report button of each message. And makes a JavaScript string that some other blocker extension understand. And looks like it's kinda general thing so, I believe AdGuard uses same thing too. But the catch is I can't apply the filter. It had support for .txt file URL's but it doesn't update it instantly. You have to do it manually or wait for the automatic time which is hours long between fetches.

Just in case to confirm it works with AdGuard, the filter is something like this. As you can see down in the photo the authors data-user-id is unique. My extension gets that and turns into;
forum.adguard.com##a[data-user-id="3968"]:upward(article)

1679233638673.png


I made a connection in that blocker extensions background.html. I think I can do that too. Other ones community didn't help much. I hope I can get help from here.

If you have any alternative idea [like hiding those ones in my extension (which I tried but couldn't figure it out on my own)] feel free to share.

I produce a filter list for the user rules part. I make that with a custom browser extension. I want to be able to add (actually edit the same line if possible) that into the user rules programmatically/automatically.

Thanks for your help.
 

Alex302

Filters Developer
Staff member
Administrator
Hi
You can use for example GitHub for this urpose, and import URL (url of the RAW file) as custom filter.
 

murat57

New Member
What do you mean? My Google Drive file is public. Putting it on Github won't change anything If I understand you correctly.
And looks like putting a files URL doesn't make it work in AdGuard.

Could I express myself well?
I can produce JavaScript string in my own/custom Chrome extension that contains things like; forum.adguard.com##:is(a[data-user-id="176525"],a[data-user-id="544518"],a[data-user-id="618635"],a[data-user-id="560819",a[data-user-id="449711"]):upward(article). I want to put it into (I believe extension ID is same for everyone) this (chrome-extension://bgnkhhnnamicmpeenaelnjfhikgbkllg/pages/options.html#user-filter) page. Is there a way to do it.

I'm expecting something like "add a listener to get your filter string and call messageHandler.putIntoFilters(your_string);". I don't expect that easy but I believe there should be a way.

If you meant I can put .txt file URL's into that page and it reads (which I tried and it didn't, maybe I did something wrong but the other extension worked perfect in same situation) from there. Does it update it? How am I going to tell that the file has changed, something has added.
Let's say the content of the file is this.
Code:
forum.adguard.com##:is(a[data-user-id="176525"],a[data-user-id="544518"],a[data-user-id="618635"],a[data-user-id="560819",a[data-user-id="449711"]):upward(article)
And I want to ignore you. So I changed the file from the Drive automatically via Drive API into this.
Code:
forum.adguard.com##:is(a[data-user-id="176525"],a[data-user-id="544518"],a[data-user-id="618635"],a[data-user-id="560819",a[data-user-id="449711"],a[data-user-id="2015"]):upward(article)
How will AdGuard know that I changed the file? If it checks constantly that means lots of unnecessary CPU cycles. If it's some other way, please let me know.

I also made a public Github file and gave the link. Still not working. BTW Github is a bad place to have the file. It doesn't update the raw file instantly. It takes about 2 minutes to update the raw file. And this is just Github part.
 
Last edited:

Alex302

Filters Developer
Staff member
Administrator
My Google Drive file is public. Putting it on Github won't change anything If I understand you correctly.
And looks like putting a files URL doesn't make it work in AdGuard.
Because AdGuard does not has google drive tools:)

You can use https://gist.github.com/
like https://gist.github.com/Alex-302/39e71755de9c3bedbd950fe77ffbb2d6
But use RAW version for import: https://gist.githubusercontent.com/Alex-302/39e71755de9c3bedbd950fe77ffbb2d6/raw/4a4659708ef749ef09e5c1a5429e4389ae93e97c/gistfile1.txt
 

murat57

New Member
How am I going to edit it with JavaScript?

Also I changed my idea. I forked the original repo. Inspected and figured how the data is kept (read/written). Edited the files, added a listener. Now I have 2 extensions. One that acts like a usual blocker and the other one does my job and sends the data to blocker.
I used a different blocker other than AdGuard. I believe you don't want me to say the name. And the code it obvious, thats why I don't share it. I can, if you like though.
 

Alex302

Filters Developer
Staff member
Administrator
I've got here because of error about importing custom filter with Google Drive link in desktop Adguard.
But I was able to use Google Drive link in mobile Adguard...
Why does this difference exist?
Maybe they give not a file, but a web page, where a file can be downloaded.
I use a local server (NAS) with a simplest web-server for these purposes.
 
Top