Skip to content

Cookie helper and force reload#11

Open
schuellerf wants to merge 11 commits intolmartinking:masterfrom
schuellerf:master
Open

Cookie helper and force reload#11
schuellerf wants to merge 11 commits intolmartinking:masterfrom
schuellerf:master

Conversation

@schuellerf
Copy link

Hi!
Thanks for your nice work so far!
if you're interested, I quickly implemented a helper to create a cookie file (e.g. during a login)
and also implemented reloading on connection problems or just on a regular basis

Hmm - I just remembered I need to document that for some session cookies you need to create the cookie file and then start the screensaver with "-cookie-file-readonly" otherwise they are gone again...

Regards

btw. I'll implement a "splitview" to show multiple URLs soonish :)
Then your program perfectly fits our needs...

for copying if the programs section is missing - the backslash is missing
for me I think python-gtk2 was ok (but it says GTK3 below)
* act more like a real screen _saver_

percentage calculation is still wrong
Copy link
Owner

@lmartinking lmartinking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few concerns about the code as it is.

You can also achieve different frames by having a wrapper HTML page using iframes.

Here's an example:

<html>
	<head>
        <title>Dual View</title>

        <style>
        html body { padding: 0; margin: 0; overflow: hidden; }
        .top { height: 50%; width: 100%; }
        .bottom { height: 50%; width: 100%; }
        iframe { border: 1px solid black; margin: 0; padding: 0; }
        </style>
	</head>

    <body>
        <iframe class="top" src="http://abc.net.au" name="hn-view"></iframe>
        <iframe class="bottom" src="http://bing.com" name="slash-view"></iframe>
    </body>
</html>

gi.require_version('Soup', '2.4')
from gi.repository import Gtk, Gdk, GdkX11, GObject, Soup, WebKit

cookie_jar="/home/schueller/.webscreensaver-cookies"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd need to parameterise this :-)

sw = Gtk.ScrolledWindow()
sw.add(view)

#win = Gtk.Window(Gtk.WindowType.TOPLEVEL)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove dead code

win.add(sw)
win.show_all()

#cookiejar = Soup.CookieJar.new()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

expiry = "-1" if c.get_expires() is None else c.get_expires()
if type(expiry) is Soup.Date:
expiry = expiry.to_time_t()
jar.write("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\n".format(c.get_domain(), not c.get_secure(), c.get_path(), c.get_secure(), expiry, c.get_name(), c.get_value()))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're writing a CSV/TSV, why not use the CSV writer? Or:

jar.write("\t".join([c.get_domain(), ....]))

@@ -1,34 +1,152 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks python 2.7 support...

win_id = long(int(win_id, 16))
win_id = int(win_id, 16)
if sys.version_info.major < 3:
win_id = long(win_id)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Python is fairly flexible with casting around integer (or integer-like) types...

@lmartinking
Copy link
Owner

Hi @schuellerf, i have done some spring cleaning and got webscreensaver updated to use WebKit2.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants