Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
986d4c99
Commit
986d4c99
authored
Dec 08, 2020
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix oauth ub session
parent
f677dcb1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12740 additions
and
893 deletions
+12740
-893
gdriveutils.py
cps/gdriveutils.py
+1
-1
oauth_bb.py
cps/oauth_bb.py
+14
-13
Calibre-Web TestSummary_Linux.html
test/Calibre-Web TestSummary_Linux.html
+12725
-879
No files found.
cps/gdriveutils.py
View file @
986d4c99
...
@@ -89,7 +89,7 @@ class Singleton:
...
@@ -89,7 +89,7 @@ class Singleton:
except
AttributeError
:
except
AttributeError
:
self
.
_instance
=
self
.
_decorated
()
self
.
_instance
=
self
.
_decorated
()
return
self
.
_instance
return
self
.
_instance
except
ImportError
as
e
:
except
(
ImportError
,
NameError
)
as
e
:
log
.
debug
(
e
)
log
.
debug
(
e
)
return
None
return
None
...
...
cps/oauth_bb.py
View file @
986d4c99
...
@@ -100,25 +100,26 @@ def logout_oauth_user():
...
@@ -100,25 +100,26 @@ def logout_oauth_user():
if
ub
.
oauth_support
:
if
ub
.
oauth_support
:
oauthblueprints
=
[]
oauthblueprints
=
[]
if
not
g
.
ubsession
.
query
(
ub
.
OAuthProvider
)
.
count
():
oauth_session
=
ub
.
Scoped_Session
()
if
not
oauth_session
.
query
(
ub
.
OAuthProvider
)
.
count
():
oauthProvider
=
ub
.
OAuthProvider
()
oauthProvider
=
ub
.
OAuthProvider
()
oauthProvider
.
provider_name
=
"github"
oauthProvider
.
provider_name
=
"github"
oauthProvider
.
active
=
False
oauthProvider
.
active
=
False
g
.
ub
session
.
add
(
oauthProvider
)
oauth_
session
.
add
(
oauthProvider
)
try
:
try
:
g
.
ub
session
.
commit
()
oauth_
session
.
commit
()
except
OperationalError
:
except
OperationalError
:
g
.
ub
session
.
rollback
()
oauth_
session
.
rollback
()
oauthProvider
=
ub
.
OAuthProvider
()
oauthProvider
=
ub
.
OAuthProvider
()
oauthProvider
.
provider_name
=
"google"
oauthProvider
.
provider_name
=
"google"
oauthProvider
.
active
=
False
oauthProvider
.
active
=
False
g
.
ub
session
.
add
(
oauthProvider
)
oauth_
session
.
add
(
oauthProvider
)
try
:
try
:
g
.
ub
session
.
commit
()
oauth_
session
.
commit
()
except
OperationalError
:
except
OperationalError
:
g
.
ub
session
.
rollback
()
oauth_
session
.
rollback
()
oauth_ids
=
g
.
ub
session
.
query
(
ub
.
OAuthProvider
)
.
all
()
oauth_ids
=
oauth_
session
.
query
(
ub
.
OAuthProvider
)
.
all
()
ele1
=
dict
(
provider_name
=
'github'
,
ele1
=
dict
(
provider_name
=
'github'
,
id
=
oauth_ids
[
0
]
.
id
,
id
=
oauth_ids
[
0
]
.
id
,
active
=
oauth_ids
[
0
]
.
active
,
active
=
oauth_ids
[
0
]
.
active
,
...
@@ -148,7 +149,7 @@ if ub.oauth_support:
...
@@ -148,7 +149,7 @@ if ub.oauth_support:
scope
=
element
[
'scope'
]
scope
=
element
[
'scope'
]
)
)
element
[
'blueprint'
]
=
blueprint
element
[
'blueprint'
]
=
blueprint
element
[
'blueprint'
]
.
backend
=
OAuthBackend
(
ub
.
OAuth
,
g
.
ub
session
,
str
(
element
[
'id'
]),
element
[
'blueprint'
]
.
backend
=
OAuthBackend
(
ub
.
OAuth
,
oauth_
session
,
str
(
element
[
'id'
]),
user
=
current_user
,
user_required
=
True
)
user
=
current_user
,
user_required
=
True
)
app
.
register_blueprint
(
blueprint
,
url_prefix
=
"/login"
)
app
.
register_blueprint
(
blueprint
,
url_prefix
=
"/login"
)
if
element
[
'active'
]:
if
element
[
'active'
]:
...
@@ -192,7 +193,7 @@ if ub.oauth_support:
...
@@ -192,7 +193,7 @@ if ub.oauth_support:
session
[
provider_id
+
"_oauth_token"
]
=
token
session
[
provider_id
+
"_oauth_token"
]
=
token
# Find this OAuth token in the database, or create it
# Find this OAuth token in the database, or create it
query
=
g
.
ub
session
.
query
(
ub
.
OAuth
)
.
filter_by
(
query
=
oauth_
session
.
query
(
ub
.
OAuth
)
.
filter_by
(
provider
=
provider_id
,
provider
=
provider_id
,
provider_user_id
=
provider_user_id
,
provider_user_id
=
provider_user_id
,
)
)
...
@@ -207,11 +208,11 @@ if ub.oauth_support:
...
@@ -207,11 +208,11 @@ if ub.oauth_support:
token
=
token
,
token
=
token
,
)
)
try
:
try
:
g
.
ub
session
.
add
(
oauth_entry
)
oauth_
session
.
add
(
oauth_entry
)
g
.
ub
session
.
commit
()
oauth_
session
.
commit
()
except
Exception
as
e
:
except
Exception
as
e
:
log
.
exception
(
e
)
log
.
exception
(
e
)
g
.
ub
session
.
rollback
()
oauth_
session
.
rollback
()
# Disable Flask-Dance's default behavior for saving the OAuth token
# Disable Flask-Dance's default behavior for saving the OAuth token
# Value differrs depending on flask-dance version
# Value differrs depending on flask-dance version
...
...
test/Calibre-Web TestSummary_Linux.html
View file @
986d4c99
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment