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
199b1c48
Commit
199b1c48
authored
Jan 20, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed gdrive base uri handling (#431)
parent
e99e93db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
web.py
cps/web.py
+8
-3
No files found.
cps/web.py
View file @
199b1c48
...
@@ -1550,7 +1550,7 @@ def google_drive_callback():
...
@@ -1550,7 +1550,7 @@ def google_drive_callback():
@
admin_required
@
admin_required
def
watch_gdrive
():
def
watch_gdrive
():
if
not
config
.
config_google_drive_watch_changes_response
:
if
not
config
.
config_google_drive_watch_changes_response
:
address
=
'
%
sgdrive/watch/callback'
%
config
.
config_google_drive_calibre_url_base
address
=
'
%
s
/
gdrive/watch/callback'
%
config
.
config_google_drive_calibre_url_base
notification_id
=
str
(
uuid4
())
notification_id
=
str
(
uuid4
())
result
=
gdriveutils
.
watchChange
(
Gdrive
.
Instance
()
.
drive
,
notification_id
,
result
=
gdriveutils
.
watchChange
(
Gdrive
.
Instance
()
.
drive
,
notification_id
,
'web_hook'
,
address
,
gdrive_watch_callback_token
,
current_milli_time
()
+
604800
*
1000
)
'web_hook'
,
address
,
gdrive_watch_callback_token
,
current_milli_time
()
+
604800
*
1000
)
...
@@ -2492,6 +2492,8 @@ def configuration_helper(origin):
...
@@ -2492,6 +2492,8 @@ def configuration_helper(origin):
content
.
config_google_drive_client_secret
=
to_save
[
"config_google_drive_client_secret"
]
content
.
config_google_drive_client_secret
=
to_save
[
"config_google_drive_client_secret"
]
create_new_yaml
=
True
create_new_yaml
=
True
if
"config_google_drive_calibre_url_base"
in
to_save
:
if
"config_google_drive_calibre_url_base"
in
to_save
:
if
to_save
[
'config_google_drive_calibre_url_base'
]
.
endswith
(
'/'
):
to_save
[
'config_google_drive_calibre_url_base'
]
=
to_save
[
'config_google_drive_calibre_url_base'
][:
-
1
]
if
content
.
config_google_drive_calibre_url_base
!=
to_save
[
"config_google_drive_calibre_url_base"
]:
if
content
.
config_google_drive_calibre_url_base
!=
to_save
[
"config_google_drive_calibre_url_base"
]:
content
.
config_google_drive_calibre_url_base
=
to_save
[
"config_google_drive_calibre_url_base"
]
content
.
config_google_drive_calibre_url_base
=
to_save
[
"config_google_drive_calibre_url_base"
]
create_new_yaml
=
True
create_new_yaml
=
True
...
@@ -2503,8 +2505,9 @@ def configuration_helper(origin):
...
@@ -2503,8 +2505,9 @@ def configuration_helper(origin):
if
create_new_yaml
:
if
create_new_yaml
:
with
open
(
'settings.yaml'
,
'w'
)
as
f
:
with
open
(
'settings.yaml'
,
'w'
)
as
f
:
with
open
(
'gdrive_template.yaml'
,
'r'
)
as
t
:
with
open
(
'gdrive_template.yaml'
,
'r'
)
as
t
:
f
.
write
(
t
.
read
()
%
{
'client_id'
:
content
.
config_google_drive_client_id
,
'client_secret'
:
content
.
config_google_drive_client_secret
,
f
.
write
(
t
.
read
()
%
{
'client_id'
:
content
.
config_google_drive_client_id
,
"redirect_uri"
:
content
.
config_google_drive_calibre_url_base
+
'gdrive/callback'
})
'client_secret'
:
content
.
config_google_drive_client_secret
,
"redirect_uri"
:
content
.
config_google_drive_calibre_url_base
+
'/gdrive/callback'
})
if
"config_google_drive_folder"
in
to_save
:
if
"config_google_drive_folder"
in
to_save
:
if
content
.
config_google_drive_folder
!=
to_save
[
"config_google_drive_folder"
]:
if
content
.
config_google_drive_folder
!=
to_save
[
"config_google_drive_folder"
]:
content
.
config_google_drive_folder
=
to_save
[
"config_google_drive_folder"
]
content
.
config_google_drive_folder
=
to_save
[
"config_google_drive_folder"
]
...
@@ -3298,3 +3301,5 @@ def start_gevent():
...
@@ -3298,3 +3301,5 @@ def start_gevent():
app
.
logger
.
info
(
'Unable to listen on
\'\'
, trying on IPv4 only...'
)
app
.
logger
.
info
(
'Unable to listen on
\'\'
, trying on IPv4 only...'
)
gevent_server
=
WSGIServer
((
'0.0.0.0'
,
ub
.
config
.
config_port
),
app
)
gevent_server
=
WSGIServer
((
'0.0.0.0'
,
ub
.
config
.
config_port
),
app
)
gevent_server
.
serve_forever
()
gevent_server
.
serve_forever
()
except
:
pass
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