You are not logged in.

#426 2011-07-02 11:53:28

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

mason.larobina wrote:

Edit: also to disable scripts and plugins by default do:

require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false

That doesn't work here, scripts are allowed by default. I put these three lines into the rc.lua after webview.
Edit: For those, who want to test this plugin, I created a package https://aur.archlinux.org/packages.php?ID=50387

Last edited by Army (2011-07-02 12:12:34)

Offline

#427 2011-07-02 12:44:58

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 200
Website

Re: luakit browser framework (almost with jQuery!)

Army wrote:
mason.larobina wrote:

Edit: also to disable scripts and plugins by default do:

require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false

That doesn't work here, scripts are allowed by default. I put these three lines into the rc.lua after webview.
Edit: For those, who want to test this plugin, I created a package https://aur.archlinux.org/packages.php?ID=50387

These settings fight with the domain_props table, you need to make sure that there are no "enable_scripts" or "enable_plugins" entries in any of them.

Offline

#428 2011-07-02 13:07:57

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Hmmm, I have an empty domain_props line

% tail ~/.config/luakit/globals.lua
search_engines.default = search_engines.google
-- Use this instead to disable auto-searching
--search_engines.default = "%s"

-- Per-domain webview properties
-- See http://webkitgtk.org/reference/webkitgtk-WebKitWebSettings.html
domain_props = {
}

-- vim: et:sw=4:ts=8:sts=4:tw=80

but javascript is enabled by default. In ~/.config/luakit/rc.lua I have put these three lines just before the end of user script loading.

-- Add command completion
require "completion"

require "follow_selected"
require "go_input"
require "go_next_prev"
require "go_up"

-- Add noscript
require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false

-----------------------------
-- End user script loading --
-----------------------------

Do I have to do something in addition?

Offline

#429 2011-07-02 13:26:18

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 200
Website

Re: luakit browser framework (almost with jQuery!)

Army wrote:

Hmmm, I have an empty domain_props line

% tail ~/.config/luakit/globals.lua
search_engines.default = search_engines.google
-- Use this instead to disable auto-searching
--search_engines.default = "%s"

-- Per-domain webview properties
-- See http://webkitgtk.org/reference/webkitgtk-WebKitWebSettings.html
domain_props = {
}

-- vim: et:sw=4:ts=8:sts=4:tw=80

but javascript is enabled by default. In ~/.config/luakit/rc.lua I have put these three lines just before the end of user script loading.

-- Add command completion
require "completion"

require "follow_selected"
require "go_input"
require "go_next_prev"
require "go_up"

-- Add noscript
require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false

-----------------------------
-- End user script loading --
-----------------------------

Do I have to do something in addition?

Ok, found a few problems and cleaned up the script. I need to remember that scoping in Lua isn't like in Python.

Grab it here: https://gist.github.com/1026346

Let me know if there are any problems.

I've also added a bind to remove NoScript rules for a given domain with `,tr`.

Last edited by mason.larobina (2011-07-02 13:27:59)

Offline

#430 2011-07-02 13:33:12

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Ok, that looks better, thanks smile

Offline

#431 2011-07-04 09:25:02

r6
Member
From: Melbourne
Registered: 2008-07-02
Posts: 156

Re: luakit browser framework (almost with jQuery!)

I'm confused why :history opens in a new tab, when :bookmarks opens in the current tab.

Offline

#432 2011-07-04 13:26:15

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

I have a problem with the right-click menu. "Copy Link Location" doesn't put the link into the clipboard, but e.g. yy works. Do I have to use a clipboard manager for that?

Offline

#433 2011-07-04 13:43:26

bratmaxe
Member
From: Germany
Registered: 2010-11-07
Posts: 71

Re: luakit browser framework (almost with jQuery!)

Army wrote:

I have a problem with the right-click menu. "Copy Link Location" doesn't put the link into the clipboard, but e.g. yy works. Do I have to use a clipboard manager for that?

Works for me. The "Copy Link Location" puts it in the "real" clipboard, so you can paste it with e.g. ctrl-v while yy puts it in the primary selection to paste with e.g. mouse middle click.

Offline

#434 2011-07-04 20:23:16

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Oh damn, you're right, that solves it, thanks smile

Offline

#435 2011-07-05 10:57:06

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

I have one problem left: Is it still possible to allow cookies for specific sites only? This used to work with the domain_props, but this changed some time ago. If it can be done, please tell me how. Right now I configured luakit to allow cookies, but not of third parties and configured privoxy to allow cookies for some sites only, but I'd prefer to do all of this in the browser.

Offline

#436 2011-07-06 17:46:21

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 200
Website

Re: luakit browser framework (almost with jQuery!)

Army wrote:

I have one problem left: Is it still possible to allow cookies for specific sites only? This used to work with the domain_props, but this changed some time ago. If it can be done, please tell me how. Right now I configured luakit to allow cookies, but not of third parties and configured privoxy to allow cookies for some sites only, but I'd prefer to do all of this in the browser.

Could I get you to test a simpler version of the cookie blocking work I've just pushed to the simple-cookie-blocking branch. The syntax of the cookie.whitelist and cookie.blacklist has changed to a simple one domain glob per line format.

For example:

*tube.com
*google.*
ads.*
...

And you can change the default blocking/allowing action with:

cookies.default_allow = false

Don't be fooled by cookies from blocked domains still being added to the cookies.db, notice they will all have '0' in the expires field and will soon be collected by the `load_new_cookies` function in cookies.lua.

If this works well for people I'll add this version to the default kit.

Edit: also note this doesn't effect cookies that are already in your cookies.db, only new cookies.

Last edited by mason.larobina (2011-07-06 17:59:47)

Offline

#437 2011-07-06 18:26:36

sironitomas
Member
From: Cordoba, Argentina
Registered: 2009-11-28
Posts: 174
Website

Re: luakit browser framework (almost with jQuery!)

Hi. I wonder if there's an option to totally disable history.

Another thing. Can luakit+tor leak information through cookies or any other thing? I'm using privoxy as well.

Thanks.

Offline

#438 2011-07-06 19:01:43

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 200
Website

Re: luakit browser framework (almost with jQuery!)

sironitomas wrote:

Hi. I wonder if there's an option to totally disable history.

Yes, remove these lines:

require "history"
require "history_chrome"
sironitomas wrote:

Another thing. Can luakit+tor leak information through cookies or any other thing? I'm using privoxy as well.

Thanks.

Perhaps, for starters I would change the useragent to something generic and change the cookie accept policy to no third party with:

soup.set_property("accept-policy", cookie_policy.no_third_party)

In your globals.lua. Or filter which cookies to accept with the above cookie blocking lib. Or disable them entirely, it's up to you.

I really couldn't say more without looking at the raw http requests (which is possible, uzbl has had this option for a long time).

And http referrers still spring to mind, we haven't got an easy way to inspect/change/add soup navigation request headers yet.

Last edited by mason.larobina (2011-07-06 19:04:21)

Offline

#439 2011-07-07 15:43:19

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

mason.larobina wrote:

Could I get you to test a simpler version of the cookie blocking work I've just pushed to the simple-cookie-blocking branch.

Sure thing, I'm always happy to test new features! I also tested your first approach, but it didn't work, it didn't (dis)allow cookies. I'll dig into it and tell you if it's
1. working
2. fool proof (if it's working for me, it is wink )

edit: Works! smile This solution is really great imo, the syntax is totally easy to understand, it only blocks cookies if the user configures it that way, perfect!

Last edited by Army (2011-07-07 17:09:28)

Offline

#440 2011-07-08 23:05:25

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Ok, something different, which doesn't work here: Downloading e.g. a pdf file shows me the pdf file if I type :downloads and hit Enter. In the download list I get the option to open the pdf file selecting it with j and k and opening it with o. Doing this (hitting "o") doesn't do anything. So I started luakit from a terminal looking at messages. This is what comes when I hit "o":

W: luakit: luaH_dofunction:104: error while running function
stack traceback:
    /usr/share/luakit/lib/downloads.lua:189: in function </usr/share/luakit/lib/downloads.lua:183>
error: /usr/share/luakit/lib/downloads.lua:189: bad argument #2 to 'format' (string expected, got nil)

In case that wouldn't happen, how does luakit know which application to use for pdf files? Looking into the downloads.lua, but not really understanding what's going on in there, I guess luakit does it according to mimetypes. Right?

Last edited by Army (2011-07-08 23:06:05)

Offline

#441 2011-07-09 18:16:02

Vain
Member
Registered: 2008-10-19
Posts: 179
Website

Re: luakit browser framework (almost with jQuery!)

Hi,

nice to see that noscript and cookie blocking made it into "develop". smile IMHO, these are very important features.

Yet there's one thing missing: adblock. I found that you and Chris van Dijk already implemented that once (see this fork -- I, personally, use a variant of it) but obviously it never got merged into main luakit. I wonder why. Not enough users asking for it? smile

Well, here's one more vote for adblock. smile

Offline

#442 2011-07-10 16:17:16

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: luakit browser framework (almost with jQuery!)

@Vain: I'm glad to hear somebody likes what I was working on. Thanks. smile

As to the reason why it isn't merged in yet, mostly it's because I never finished it -- unfortunately RL got in the way and I had to stop hacking luakit temporarily.  I do however plan to finish it off once things die down a bit, with any luck this should be in a couple more weeks. In the mean time I have no objections to somebody else picking up where I left off.

Actually I use the version that's in my github repo daily, and have never had any issues with it (performance or otherwise).  I also have a semi-working adblocker written in LPeg, however I still need to clean it up and profile it to see if it is worth using LPeg over lua string patterns (the other alternative is of course writing it in C, I don't think that it will be necessary though).

Offline

#443 2011-07-10 18:16:13

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

@quigybo, should your adblock plugin work with the develop branch? I tried it, there are no error messages, but ads aren't blocked.

Offline

#444 2011-07-11 12:52:02

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: luakit browser framework (almost with jQuery!)

@Army: do you have a filter list?

Offline

#445 2011-07-11 17:24:25

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Yes I do

% tail ~/.local/share/luakit/easylist.txt
@@||viamichelin.pt/static/advert/afsquery/afsquery.js
@@||viamichelin.pt^*/rentacar.js
@@||video1.italiaoggi.it/movie/movie/adserver_$object,object-subrequest
@@||video1.milanofinanza.it/movie/movie/adserver_$object,object-subrequest
@@||videonuz.ensonhaber.com/player/hdflvplayer/xml/ads.xml?$object-subrequest
@@||videos.lanacion.com.ar^*/xml/publicidad/$object
! *** easylist_adult/adult_whitelist.txt ***
@@||eskimotube.com/advertisements.php?$script
@@||fucktube.com/work/videoad.php?
@@||skimtube.com/advertisements.php?

Well well, fucktube ... Funny things out there!
Oh and I put

-- Add adblock
require "adblock"

into my rc.lua, the plugin is installed via pacman right now.

% pacman -Ql luakit-adblock-git
luakit-adblock-git /usr/
luakit-adblock-git /usr/share/
luakit-adblock-git /usr/share/luakit/
luakit-adblock-git /usr/share/luakit/lib/
luakit-adblock-git /usr/share/luakit/lib/adblock.lua

Last edited by Army (2011-07-11 17:29:51)

Offline

#446 2011-07-13 00:29:19

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: luakit browser framework (almost with jQuery!)

@Army: first of all you can double check if adblock is actually doing anything with the following:

luakit -v 2>&1 | grep '^adblock'

Secondly, as I mentioned before it isn't quite finished, and one thing that isn't implemented yet is 'element hiding' -- that is, hiding an element instead of blocking the request completely. These are the rules containing '##' in Adblock Plus-compatible filter lists (more info), and implementing them will require writing some javascript. So keep in mind that it currently only blocks some types of ads, and not everything that Adblock Plus blocks.

And to answer your previous question, I just rebased it onto the current develop branch (c2def2a9) and it still worked fine here.

Offline

#447 2011-07-13 07:05:03

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Ok, it looks like there's something wrong, running your command doesn't output anything here. Shortening it to "luakit -v" produces

% luakit -v
D: luakit: luaH_loadrc:451: Loading rc: /home/army/.config/luakit/rc.lua

Starting it with a deleted ~/.config/luakit (to make sure my configs don't cause any errors) shows

% luakit -v
D: luakit: luaH_loadrc:451: Loading rc: /etc/xdg/luakit/rc.lua

So are you sure this is supposed to show anything?

Offline

#448 2011-07-13 08:38:44

examon
Member
Registered: 2011-05-07
Posts: 208

Re: luakit browser framework (almost with jQuery!)

Hi guys! I started to use luakit some days ago and I really like it. One thing I've problem with is, that I can't setup 'downloading without asking'.

I set default download location with:

downloads.default_dir = os.getenv("HOME") .. "/down"

and this works ok. Now I wanted to set 'download without asking' so I added next block of code under 'default download location' code.

downloads.default_dir = os.getenv("HOME") .. "/down"
downloads.add_signal("download-location", function (uri, file)
    if not file or file == "" then
        file = (string.match(uri, "/([^/]+)$") 
            or string.match(uri, "^%w+://(.+)") 
            or string.gsub(uri, "/", "_")
            or "untitled")
    end 
    return downloads.default_dir .. "/" .. file
end)

I was following 'FAQ' at luakit.org but 'downloading without asking' doesn't work.

Thanks for help

Offline

#449 2011-07-13 19:14:55

TheBrayn
Member
Registered: 2011-07-13
Posts: 1

Re: luakit browser framework (almost with jQuery!)

mason.larobina wrote:

Ok, found a few problems and cleaned up the script. I need to remember that scoping in Lua isn't like in Python.

Grab it here: https://gist.github.com/1026346

Let me know if there are any problems.

I've also added a bind to remove NoScript rules for a given domain with `,tr`.

This script isn't really working as I expect it to work.
I would like to have something like noscript for firefox where you can choose domains that may execute js and not just allow/block everything on a site.
I think there are some webkit limitations but Chromium has Notscript so I guess it is possible somehow.

Offline

#450 2011-07-16 15:16:18

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 200
Website

Re: luakit browser framework (almost with jQuery!)

examon wrote:

Hi guys! I started to use luakit some days ago and I really like it. One thing I've problem with is, that I can't setup 'downloading without asking'.

I set default download location with:

downloads.default_dir = os.getenv("HOME") .. "/down"

and this works ok. Now I wanted to set 'download without asking' so I added next block of code under 'default download location' code.

downloads.default_dir = os.getenv("HOME") .. "/down"
downloads.add_signal("download-location", function (uri, file)
    if not file or file == "" then
        file = (string.match(uri, "/([^/]+)$") 
            or string.match(uri, "^%w+://(.+)") 
            or string.gsub(uri, "/", "_")
            or "untitled")
    end 
    return downloads.default_dir .. "/" .. file
end)

I was following 'FAQ' at luakit.org but 'downloading without asking' doesn't work.

Thanks for help

That should work, and you added it below the `require "downloads"` line in your rc.lua? And are you sure the correct rc.lua is being loaded? (run `luakit -v 2>&1 | grep "luaH_loadrc"`)

Offline

Board footer

Powered by FluxBB