POL_GoG_checklogin

Informations

Creator Message
Ground0

Information

This installer has been approved by the team.

Informations

Platforms:
Downloads: 10336
Wine: System

Feedbacks

Description

It checks if a login cookie exists and if it exists try if the session is still valid. If this still true set GOG_LOGIN to Ok else where to False

Source code

#!/usr/bin/env playonlinux-bash
 
# CHANGELOG
# [Ground0] (2016-02-18 08:15)
#   Initial Version
#
# Date : (2016-02-18 08:15)
# Last revision : (2016-02-18 08:15)
# Distribution used to test : OpenSUSE Tumbleweed / openSUSE Leap 42.1 / OS X 10.11.2
# Author : René Linder rene.linder@lihaso.ch
# Script licence : GPL v.2
# Depend :
 
#############################################
#
# Login Check function
#
# The Cookie:
#
 
COOKIES_FINAL="$POL_USER_ROOT/tmp/gog_cookie_logedin"
 
#
# Check if the session Cookie is exsist.
#
 
[ ! -f "$COOKIES_FINAL" ] && unset GOG_LOGIN && POL_Debug_Message "No GOG Cookie exists" && break
fi
 
#
# Check if the session Cookie is valid.
#
# Call  to https://www.gog.com/userData.json to recheck the cookie
USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"
 
$POL_WGET https://www.gog.com/userData.json -O- --keep-session-cookies --save-cookies=$COOKIES_FINAL --load-cookies=$COOKIES_FINAL --referer=https://www.gog.com/ --user-agent="$USER_AGENT"
 
#
# If the Session is still valid gog-al still exists else where it is now removed.
#
 
AUTH_SESSION="$(awk '$6 == "gog-al" { print $7 }' $COOKIES_FINAL)"
[ "$AUTH_SESSION" != "" ] && GOG_LOGIN="Ok" && POL_Debug_Message "GoG Session cookie exists and is valid" && break
 
POL_Debug_Message "GoG Session cookie exists but is not valid"
unset GOG_LOGIN
break

Contributions

Filters:

Contribute
Member Message
Ground0 Thursday 18 February 2016 at 16:55
Ground0

Information

This update has been approved by the team.

Differences

@@ -0,0 +1,47 @@
+#!/usr/bin/env playonlinux-bash
+ 
+# CHANGELOG
+# [Ground0] (2016-02-18 08:15)
+#   Initial Version
+#
+# Date : (2016-02-18 08:15)
+# Last revision : (2016-02-18 08:15)
+# Distribution used to test : OpenSUSE Tumbleweed / openSUSE Leap 42.1 / OS X 10.11.2
+# Author : René Linder rene.linder@lihaso.ch
+# Script licence : GPL v.2
+# Depend :
+ 
+#############################################
+#
+# Login Check function
+#
+# The Cookie:
+#
+ 
+COOKIES_FINAL="$POL_USER_ROOT/tmp/gog_cookie_logedin"
+ 
+#
+# Check if the session Cookie is exsist.
+#
+ 
+[ ! -f "$COOKIES_FINAL" ] && unset GOG_LOGIN && POL_Debug_Message "No GOG Cookie exists" && break
+fi
+ 
+#
+# Check if the session Cookie is valid.
+#
+# Call  to https://www.gog.com/userData.json to recheck the cookie
+USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"
+ 
+$POL_WGET https://www.gog.com/userData.json -O- --keep-session-cookies --save-cookies=$COOKIES_FINAL --load-cookies=$COOKIES_FINAL --referer=https://www.gog.com/ --user-agent="$USER_AGENT"
+ 
+#
+# If the Session is still valid gog-al still exists else where it is now removed.
+#
+ 
+AUTH_SESSION="$(awk '$6 == "gog-al" { print $7 }' $COOKIES_FINAL)"
+[ "$AUTH_SESSION" != "" ] && GOG_LOGIN="Ok" && POL_Debug_Message "GoG Session cookie exists and is valid" && break
+ 
+POL_Debug_Message "GoG Session cookie exists but is not valid"
+unset GOG_LOGIN
+break
\ No newline at end of file

New source code

#!/usr/bin/env playonlinux-bash
 
# CHANGELOG
# [Ground0] (2016-02-18 08:15)
#   Initial Version
#
# Date : (2016-02-18 08:15)
# Last revision : (2016-02-18 08:15)
# Distribution used to test : OpenSUSE Tumbleweed / openSUSE Leap 42.1 / OS X 10.11.2
# Author : René Linder rene.linder@lihaso.ch
# Script licence : GPL v.2
# Depend :
 
#############################################
#
# Login Check function
#
# The Cookie:
#
 
COOKIES_FINAL="$POL_USER_ROOT/tmp/gog_cookie_logedin"
 
#
# Check if the session Cookie is exsist.
#
 
[ ! -f "$COOKIES_FINAL" ] && unset GOG_LOGIN && POL_Debug_Message "No GOG Cookie exists" && break
fi
 
#
# Check if the session Cookie is valid.
#
# Call  to https://www.gog.com/userData.json to recheck the cookie
USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"
 
$POL_WGET https://www.gog.com/userData.json -O- --keep-session-cookies --save-cookies=$COOKIES_FINAL --load-cookies=$COOKIES_FINAL --referer=https://www.gog.com/ --user-agent="$USER_AGENT"
 
#
# If the Session is still valid gog-al still exists else where it is now removed.
#
 
AUTH_SESSION="$(awk '$6 == "gog-al" { print $7 }' $COOKIES_FINAL)"
[ "$AUTH_SESSION" != "" ] && GOG_LOGIN="Ok" && POL_Debug_Message "GoG Session cookie exists and is valid" && break
 
POL_Debug_Message "GoG Session cookie exists but is not valid"
unset GOG_LOGIN
break

Replies

Ground0 Thursday 18 February 2016 at 8:21
Ground0

Warning

This update has not been approved yet by the team.
Use it at your own risk

Differences

@@ -0,0 +1,47 @@
+#!/usr/bin/env playonlinux-bash
+
+# CHANGELOG
+# [Ground0] (2016-02-18 08:15)
+#   Initial Version
+#
+# Date : (2016-02-18 08:15)
+# Last revision : (2016-02-18 08:15)
+# Distribution used to test : OpenSUSE Tumbleweed / openSUSE Leap 42.1 / OS X 10.11.2
+# Author : René Linder rene.linder@lihaso.ch
+# Script licence : GPL v.2
+# Depend :
+
+#############################################
+#
+# Login Check function 
+#
+# The Cookie:
+#
+
+COOKIES_FINAL="$POL_USER_ROOT/tmp/gog_cookie_logedin"
+
+#
+# Check if the session Cookie is exsist.
+#
+
+[ ! -f "$COOKIES_FINAL" ] && GOG_LOGIN="False" && POL_Debug_Message "No GOG Cookie exists" && break
+fi
+
+#
+# Check if the session Cookie is valid.
+#
+# Call  to https://www.gog.com/userData.json to recheck the cookie
+USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"
+
+$POL_WGET https://www.gog.com/userData.json -O- --keep-session-cookies --save-cookies=$COOKIES_FINAL --load-cookies=$COOKIES_FINAL --referer=https://www.gog.com/ --user-agent="$USER_AGENT"
+
+#
+# If the Session is still valid gog-al still exists else where it is now removed.
+# 
+
+AUTH_SESSION="$(awk '$6 == "gog-al" { print $7 }' $COOKIES_FINAL)"
+[ "$AUTH_SESSION" != "" ] && GOG_LOGIN="Ok" && POL_Debug_Message "GoG Session cookie exists and is valid" && break
+
+POL_Debug_Message "GoG Session cookie exists but is not valid"
+GOG_LOGIN="False"
+break

New source code

#!/usr/bin/env playonlinux-bash

# CHANGELOG
# [Ground0] (2016-02-18 08:15)
#   Initial Version
#
# Date : (2016-02-18 08:15)
# Last revision : (2016-02-18 08:15)
# Distribution used to test : OpenSUSE Tumbleweed / openSUSE Leap 42.1 / OS X 10.11.2
# Author : René Linder rene.linder@lihaso.ch
# Script licence : GPL v.2
# Depend :

#############################################
#
# Login Check function 
#
# The Cookie:
#

COOKIES_FINAL="$POL_USER_ROOT/tmp/gog_cookie_logedin"

#
# Check if the session Cookie is exsist.
#

[ ! -f "$COOKIES_FINAL" ] && GOG_LOGIN="False" && POL_Debug_Message "No GOG Cookie exists" && break
fi

#
# Check if the session Cookie is valid.
#
# Call  to https://www.gog.com/userData.json to recheck the cookie
USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"

$POL_WGET https://www.gog.com/userData.json -O- --keep-session-cookies --save-cookies=$COOKIES_FINAL --load-cookies=$COOKIES_FINAL --referer=https://www.gog.com/ --user-agent="$USER_AGENT"

#
# If the Session is still valid gog-al still exists else where it is now removed.
# 

AUTH_SESSION="$(awk '$6 == "gog-al" { print $7 }' $COOKIES_FINAL)"
[ "$AUTH_SESSION" != "" ] && GOG_LOGIN="Ok" && POL_Debug_Message "GoG Session cookie exists and is valid" && break

POL_Debug_Message "GoG Session cookie exists but is not valid"
GOG_LOGIN="False"
break

Replies