Skip to content

Commit

Permalink
Humble Bundle authentication fix
Browse files Browse the repository at this point in the history
Humble Bundle game icons fix


Former-commit-id: 2ba374a
  • Loading branch information
tkashkin committed Jun 22, 2018
1 parent df0d8a8 commit 0f48ab3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions data/GameHub.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
opacity: 0.75;
border-radius: 4px;
transition: 100ms;
background-color: #999;
}

.gamecard.installed
Expand Down
6 changes: 6 additions & 0 deletions data/com.github.tkashkin.gamehub.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
</screenshots>

<releases>
<release version="0.3.1" date="2018-06-22">
<description>
<p>Humble Bundle authentication fix</p>
<p>Humble Bundle game icons fix</p>
</description>
</release>
<release version="0.3.0" date="2018-06-17">
<description>
<p>Humble Bundle support</p>
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
com.github.tkashkin.gamehub (0.3.1) xenial; urgency=low

* Humble Bundle authentication fix
* Humble Bundle game icons fix

-- tkashkin <[email protected]> Fri, 22 Jun 2018 18:03:16 +0300

com.github.tkashkin.gamehub (0.3.0) xenial; urgency=low

* Humble Bundle support
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.3.0')
project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.3.1')

i18n = import('i18n')
gnome = import('gnome')
Expand Down
2 changes: 1 addition & 1 deletion src/data/sources/humble/Humble.vala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace GameHub.Data.Sources.Humble
return true;
}

var wnd = new GameHub.UI.Windows.WebAuthWindow(this.name, @"https://www.humblebundle.com/login?goto=home", null, AUTH_COOKIE);
var wnd = new GameHub.UI.Windows.WebAuthWindow(this.name, "https://www.humblebundle.com/login?goto=home", "https://www.humblebundle.com/home/library", AUTH_COOKIE);

wnd.finished.connect(token =>
{
Expand Down
9 changes: 7 additions & 2 deletions src/ui/widgets/AutoSizeImage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ namespace GameHub.UI.Widgets
break;
}

var pixbuf = src.scale_simple(new_width, new_height, InterpType.BILINEAR);
Pixbuf pixbuf = src;

if(src.width != src.height)
{
pixbuf = src.scale_simple(new_width, new_height, InterpType.BILINEAR);
}

Granite.Drawing.Utilities.cairo_rounded_rectangle(ctx, 0, 0, new_width, new_height, 4);
cairo_set_source_pixbuf(ctx, pixbuf, 0, 0);
cairo_set_source_pixbuf(ctx, pixbuf, (new_width - pixbuf.width) / 2, (new_height - pixbuf.height) / 2);
ctx.clip();
ctx.paint();

Expand Down
11 changes: 6 additions & 5 deletions src/ui/windows/WebAuthWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace GameHub.UI.Windows

webview.get_settings().enable_mediasource = true;
webview.get_settings().enable_smooth_scrolling = true;

webview.user_content_manager.add_style_sheet(new UserStyleSheet(".account-bbm-wrapper{background:#333 !important}", UserContentInjectedFrames.TOP_FRAME, UserStyleLevel.USER, null, null));

webview.load_changed.connect(e => {
var uri = webview.get_uri();
Expand All @@ -44,13 +46,13 @@ namespace GameHub.UI.Windows
titlebar.tooltip_text = uri;

if(!is_finished && success_cookie_name != null)
{
{
webview.web_context.get_cookie_manager().get_cookies.begin(uri, null, (obj, res) => {
var cookies = webview.web_context.get_cookie_manager().get_cookies.end(res);
foreach(var cookie in cookies)
{
if(!is_finished && cookie.name == success_cookie_name && !cookie.value.contains("\""))
{
if(!is_finished && cookie.name == success_cookie_name && !cookie.value.contains("\"") && (success_url_prefix == null || uri.has_prefix(success_url_prefix)))
{
is_finished = true;
finished(cookie.value);
destroy();
Expand All @@ -59,8 +61,7 @@ namespace GameHub.UI.Windows
}
});
}

if(!is_finished && success_url_prefix != null && uri.has_prefix(success_url_prefix))
else if(!is_finished && success_url_prefix != null && uri.has_prefix(success_url_prefix))
{
is_finished = true;
finished(uri.substring(success_url_prefix.length));
Expand Down

0 comments on commit 0f48ab3

Please sign in to comment.