wyebadblock/README.md

107 lines
2.6 KiB
Markdown
Raw Normal View History

2017-07-17 08:10:19 +00:00
# wyebadblock
2018-01-01 13:52:12 +00:00
An adblock extension for [wyeb](https://github.com/jun7/wyeb), also webkit2gtk browsers.
2017-07-17 08:18:17 +00:00
most of code of this are from https://github.com/GNOME/epiphany/tree/master/embed/web-extension
2018-05-19 15:51:50 +00:00
wyebad is shared by clients, So even nowadays, browsers spawn procs for each windows,
wyebad keeps single server proc that makes less memory and less cpu times.
Don't worry, wyeb wills quit automatically when there is no client and 30 secs past.
2017-07-17 08:18:17 +00:00
2018-05-20 10:02:35 +00:00
For exsample, while epiphay's webproc uses 240M RAM for
[a page](http://simple-adblock.com/faq/testing-your-adblocker/), wyeb uses 160M for the same page.
2018-05-20 10:10:27 +00:00
Of course the adblock uses 80M but not gain.
2018-05-20 10:02:35 +00:00
2017-07-17 08:18:17 +00:00
### usage:
2018-02-05 13:23:08 +00:00
2018-01-19 02:11:17 +00:00
make
2018-02-05 13:38:21 +00:00
sudo make install
2017-07-17 08:18:17 +00:00
then
2018-01-17 12:02:54 +00:00
copy **easylist.txt** to ~/.config/wyebadblock/
2017-07-17 08:18:17 +00:00
2018-01-11 06:57:12 +00:00
wyebadblock only checks 'easylist.txt'
2017-07-17 08:18:17 +00:00
2018-05-19 15:51:50 +00:00
Testing element hiding is not supported though,
2018-01-19 02:16:52 +00:00
You can check if it works on http://simple-adblock.com/faq/testing-your-adblocker/
2018-01-19 02:11:17 +00:00
2018-01-11 06:57:12 +00:00
### Disabling
2018-01-02 01:07:34 +00:00
Setting chars(whatever) to the env value $DISABLE_ADBLOCK disables adblock.
For source code:
2018-01-20 12:12:30 +00:00
set string "adblock:false;" as the user data of the
2018-01-02 01:07:34 +00:00
webkit_web_context_set_web_extensions_initialization_user_data;
Runtime:
g_object_set_data(G_OBJECT(webkitwebpage), "adblock", GINT_TO_POINTER('n'));
2018-01-02 01:07:34 +00:00
2018-01-01 13:56:19 +00:00
---
2018-01-01 13:52:12 +00:00
2018-01-19 02:16:52 +00:00
2018-01-11 06:57:12 +00:00
## For webkit2gtk browsers
2018-01-01 13:53:19 +00:00
On Arch Linux
2018-05-21 05:18:03 +00:00
### epiphany
sudo ln -s /usr/lib/wyebrowser/adblock.so /usr/lib64/epiphany/web-extensions
This lacks epiphany's functionalities about adblock (e.g. can't disable), but saves RAM and CPU.
Make sure while you keep enable epiphany's one, it is working too.
### surf
sudo mkdir usr/local/lib/surf
2018-03-22 03:11:17 +00:00
sudo ln -s /usr/lib/wyebrowser/adblock.so /usr/local/lib/surf
2018-01-01 13:52:12 +00:00
2018-02-04 06:07:14 +00:00
See vimb below to manage the link by pacman
2018-01-01 13:52:12 +00:00
### vimb
2018-03-22 03:11:17 +00:00
sudo ln -s /usr/lib/wyebrowser/adblock.so /usr/lib/vimb
2018-01-19 02:11:17 +00:00
2018-03-18 12:06:00 +00:00
There is a PKGBUILD file. see the 'PKGBULDs' dir.
2018-01-01 13:52:12 +00:00
2018-05-20 06:45:32 +00:00
### luakit
2018-05-21 05:18:03 +00:00
sudo ln -s /usr/lib/wyebrowser/adblock.so /lib/luakit
2018-05-20 06:45:32 +00:00
2018-01-01 13:52:12 +00:00
### lariza
mkdir -p ~/.config/lariza/web_extensions
2018-03-22 03:11:17 +00:00
ln -s /usr/lib/wyebrowser/adblock.so ~/.config/lariza/web_extensions
2018-01-03 04:06:29 +00:00
2018-01-19 02:11:17 +00:00
2018-02-04 06:07:14 +00:00
### Others
webkit2gtk loads extensions in a dir designated by each apps.
So we have to know which dir is the dir.
2018-02-04 05:51:40 +00:00
search 'webkit_web_context_set_web_extensions_directory' in source code
and make link from the dir to the wyebadblock as above.
2018-01-19 02:16:52 +00:00
---
2018-01-19 02:11:17 +00:00
## Element Hiding
2018-05-19 15:51:50 +00:00
Per domain CSS hider rule is not supported
2018-01-19 02:11:17 +00:00
2018-05-19 15:51:50 +00:00
wyebab -css > user.css
2018-01-19 02:11:17 +00:00
And add the user.css to your browser as user css.
2018-05-19 15:51:50 +00:00
For wyeb, just copy the user.css to the conf dir.
2018-05-20 09:32:51 +00:00
Make sure the huge css takes mamory a lot.
2018-05-19 15:51:50 +00:00
## Shell
wyebab
Reads stdin outputs to stdout.
blank + enter quits.
wyebab requst_uri + ' ' + page_uri
2018-05-21 05:19:45 +00:00
Outputs result and
2018-05-19 15:51:50 +00:00
Keeps server 30 sec