net-misc/bcloud: add vcodestr patch
This commit is contained in:
1 parent
23bbf5043f
commit
edfbbb5fef
2 files changed
+95
-2
No files matched your search
@@ -24,13 +24,17 @@ RDEPEND="${DEPEND}
|
||||
dev-python/cssselect
|
||||
x11-themes/gnome-icon-theme-symbolic
|
||||
dev-python/dbus-python[${PYTHON_USEDEP}]
|
||||
dev-python/keyring[${PYTHON_USEDEP}]
|
||||
dev-python/keyring[${PYTHON_USEDEP}]
|
||||
dev-python/pycrypto[${PYTHON_USEDEP}]
|
||||
x11-libs/libnotify
|
||||
"
|
||||
src_prepare() {
|
||||
epatch "${FILESDIR}"/${P}-fix-vcodestr.patch
|
||||
}
|
||||
|
||||
src_install() {
|
||||
python_foreach_impl python_domodule ${PN}
|
||||
dobin bcloud-gui
|
||||
insinto usr
|
||||
doins -r share
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
From f9034e1643e5a97f4736f2cb5cef86274a9cbe56 Mon Sep 17 00:00:00 2001
|
||||
From: LiuLang <gsushzhsosgsu@gmail.com>
|
||||
Date: Mon, 23 Jun 2014 16:30:30 +0800
|
||||
Subject: [PATCH] Fixed: failed to check vcodestr
|
||||
|
||||
---
|
||||
bcloud/SigninDialog.py | 6 ++++--
|
||||
bcloud/auth.py | 10 ++++------
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bcloud/SigninDialog.py b/bcloud/SigninDialog.py
|
||||
index 21d157f..4c91c19 100644
|
||||
--- a/bcloud/SigninDialog.py
|
||||
+++ b/bcloud/SigninDialog.py
|
||||
@@ -54,7 +54,6 @@ def __init__(self, parent, cookie, form):
|
||||
|
||||
def update_img(self, req_data, error=None):
|
||||
if error or not req_data:
|
||||
- self.refresh_vcode()
|
||||
return
|
||||
vcode_path = os.path.join(
|
||||
Config.get_tmp_path(self.form['username']),
|
||||
@@ -250,10 +249,13 @@ def on_get_wap_passport(info, error=None):
|
||||
form['username'] = username
|
||||
form['password'] = password
|
||||
cookie.load_list(cookie_str)
|
||||
- if 'vcodestr' in form:
|
||||
+ if len(form.get('vcodestr', '')):
|
||||
dialog = SigninVcodeDialog(self, cookie, form)
|
||||
dialog.run()
|
||||
dialog.destroy()
|
||||
+ if len(form.get('verifycode', '')) != 4:
|
||||
+ print('verifycode length is not 4!')
|
||||
+ return
|
||||
self.signin_button.set_label(_('Signin...'))
|
||||
gutil.async_call(auth.wap_signin, cookie, form,
|
||||
callback=on_wap_signin)
|
||||
diff --git a/bcloud/auth.py b/bcloud/auth.py
|
||||
index 01f936b..1bb8d76 100644
|
||||
--- a/bcloud/auth.py
|
||||
+++ b/bcloud/auth.py
|
||||
@@ -83,7 +83,6 @@ def get_wap_passport():
|
||||
|
||||
def wap_signin(cookie, form):
|
||||
'''进行WAP登录认证'''
|
||||
- print('wap_signin():', cookie, form)
|
||||
url = 'http://wappass.baidu.com/passport/login'
|
||||
req = net.urlopen_without_redirect(url, headers={
|
||||
'Cookie': cookie.header_output(),
|
||||
@@ -98,7 +97,10 @@ def wap_signin(cookie, form):
|
||||
def get_wap_signin_vcode(cookie, codeString):
|
||||
'''获取wap登录时的验证码'''
|
||||
url = 'http://wappass.baidu.com/cgi-bin/genimage?' + codeString
|
||||
- req = net.urlopen(url, headers={'Cookie': cookie.header_output()})
|
||||
+ req = net.urlopen(url, headers={
|
||||
+ 'Cookie': cookie.header_output(),
|
||||
+ 'Referer': 'http://wappass.badu.com',
|
||||
+ })
|
||||
if req:
|
||||
return req.data
|
||||
else:
|
||||
@@ -109,7 +111,6 @@ def refresh_signin_vcode(cookie, token, vcodetype):
|
||||
|
||||
vcodetype - 在调用check_login()时返回的vcodetype.
|
||||
'''
|
||||
- print('refresh_signin_vcode()', cookie, token, vcodetype)
|
||||
url = ''.join([
|
||||
const.PASSPORT_BASE,
|
||||
'v2/?reggetcodestr',
|
||||
@@ -119,11 +120,9 @@ def refresh_signin_vcode(cookie, token, vcodetype):
|
||||
'&fr=ligin',
|
||||
'&vcodetype=', vcodetype,
|
||||
])
|
||||
- print('url:', url)
|
||||
req = net.urlopen(url, headers={'Cookie': cookie.header_output()})
|
||||
if req:
|
||||
try:
|
||||
- print('req.data is:', req.data)
|
||||
return json.loads(req.data.decode('gbk'))
|
||||
except ValueError as e:
|
||||
print('Error occurs in refresh_signin_vcode()', e)
|
||||
@@ -140,7 +139,6 @@ def parse_bdstoken(content):
|
||||
bdstoken = ''
|
||||
bds_re = re.compile('BDSTOKEN\s*=\s*"([^"]+)"')
|
||||
bds_match = bds_re.search(content)
|
||||
- print('bds match:', bds_match)
|
||||
if bds_match:
|
||||
bdstoken = bds_match.group(1)
|
||||
return bdstoken
|
||||
Reference in new issue
Block a user