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
9fea5a55
Commit
9fea5a55
authored
4 years ago
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into Develop
parents
1a0bf45c
93e8c5be
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
13 deletions
+26
-13
db.py
cps/db.py
+1
-1
debug_info.py
cps/debug_info.py
+18
-7
gdriveutils.py
cps/gdriveutils.py
+2
-1
ub.py
cps/ub.py
+4
-3
updater.py
cps/updater.py
+1
-1
No files found.
cps/db.py
View file @
9fea5a55
...
@@ -584,7 +584,7 @@ class CalibreDB():
...
@@ -584,7 +584,7 @@ class CalibreDB():
if
not
cc_classes
:
if
not
cc_classes
:
try
:
try
:
cc
=
conn
.
execute
(
"SELECT id, datatype FROM custom_columns"
)
cc
=
conn
.
execute
(
text
(
"SELECT id, datatype FROM custom_columns"
)
)
cls
.
setup_db_cc_classes
(
cc
)
cls
.
setup_db_cc_classes
(
cc
)
except
OperationalError
as
e
:
except
OperationalError
as
e
:
log
.
debug_or_exception
(
e
)
log
.
debug_or_exception
(
e
)
...
...
This diff is collapsed.
Click to expand it.
cps/debug_info.py
View file @
9fea5a55
...
@@ -29,7 +29,7 @@ except ImportError:
...
@@ -29,7 +29,7 @@ except ImportError:
import
os
import
os
from
flask
import
send_file
from
flask
import
send_file
,
__version__
from
.
import
logger
,
config
from
.
import
logger
,
config
from
.about
import
collect_stats
from
.about
import
collect_stats
...
@@ -43,9 +43,15 @@ def assemble_logfiles(file_name):
...
@@ -43,9 +43,15 @@ def assemble_logfiles(file_name):
with
open
(
f
,
'r'
)
as
fd
:
with
open
(
f
,
'r'
)
as
fd
:
shutil
.
copyfileobj
(
fd
,
wfd
)
shutil
.
copyfileobj
(
fd
,
wfd
)
wfd
.
seek
(
0
)
wfd
.
seek
(
0
)
if
int
(
__version__
.
split
(
'.'
)[
0
])
<
2
:
return
send_file
(
wfd
,
return
send_file
(
wfd
,
as_attachment
=
True
,
as_attachment
=
True
,
attachment_filename
=
os
.
path
.
basename
(
file_name
))
attachment_filename
=
os
.
path
.
basename
(
file_name
))
else
:
return
send_file
(
wfd
,
as_attachment
=
True
,
download_name
=
os
.
path
.
basename
(
file_name
))
def
send_debug
():
def
send_debug
():
file_list
=
glob
.
glob
(
logger
.
get_logfile
(
config
.
config_logfile
)
+
'*'
)
file_list
=
glob
.
glob
(
logger
.
get_logfile
(
config
.
config_logfile
)
+
'*'
)
...
@@ -60,6 +66,11 @@ def send_debug():
...
@@ -60,6 +66,11 @@ def send_debug():
for
fp
in
file_list
:
for
fp
in
file_list
:
zf
.
write
(
fp
,
os
.
path
.
basename
(
fp
))
zf
.
write
(
fp
,
os
.
path
.
basename
(
fp
))
memory_zip
.
seek
(
0
)
memory_zip
.
seek
(
0
)
if
int
(
__version__
.
split
(
'.'
)[
0
])
<
2
:
return
send_file
(
memory_zip
,
return
send_file
(
memory_zip
,
as_attachment
=
True
,
as_attachment
=
True
,
attachment_filename
=
"Calibre-Web-debug-pack.zip"
)
attachment_filename
=
"Calibre-Web-debug-pack.zip"
)
else
:
return
send_file
(
memory_zip
,
as_attachment
=
True
,
download_name
=
"Calibre-Web-debug-pack.zip"
)
This diff is collapsed.
Click to expand it.
cps/gdriveutils.py
View file @
9fea5a55
...
@@ -34,6 +34,7 @@ try:
...
@@ -34,6 +34,7 @@ try:
except
ImportError
:
except
ImportError
:
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.exc
import
OperationalError
,
InvalidRequestError
from
sqlalchemy.exc
import
OperationalError
,
InvalidRequestError
from
sqlalchemy.sql.expression
import
text
try
:
try
:
from
apiclient
import
errors
from
apiclient
import
errors
...
@@ -168,7 +169,7 @@ class PermissionAdded(Base):
...
@@ -168,7 +169,7 @@ class PermissionAdded(Base):
def
migrate
():
def
migrate
():
if
not
engine
.
dialect
.
has_table
(
engine
.
connect
(),
"permissions_added"
):
if
not
engine
.
dialect
.
has_table
(
engine
.
connect
(),
"permissions_added"
):
PermissionAdded
.
__table__
.
create
(
bind
=
engine
)
PermissionAdded
.
__table__
.
create
(
bind
=
engine
)
for
sql
in
session
.
execute
(
"select sql from sqlite_master where type='table'"
):
for
sql
in
session
.
execute
(
text
(
"select sql from sqlite_master where type='table'"
)
):
if
'CREATE TABLE gdrive_ids'
in
sql
[
0
]:
if
'CREATE TABLE gdrive_ids'
in
sql
[
0
]:
currUniqueConstraint
=
'UNIQUE (gdrive_id)'
currUniqueConstraint
=
'UNIQUE (gdrive_id)'
if
currUniqueConstraint
in
sql
[
0
]:
if
currUniqueConstraint
in
sql
[
0
]:
...
...
This diff is collapsed.
Click to expand it.
cps/ub.py
View file @
9fea5a55
...
@@ -485,11 +485,12 @@ def migrate_registration_table(engine, session):
...
@@ -485,11 +485,12 @@ def migrate_registration_table(engine, session):
# Remove login capability of user Guest
# Remove login capability of user Guest
def
migrate_guest_password
(
engine
,
session
):
def
migrate_guest_password
(
engine
):
try
:
try
:
with
engine
.
connect
()
as
conn
:
with
engine
.
connect
()
as
conn
:
trans
=
conn
.
begin
()
conn
.
execute
(
text
(
"UPDATE user SET password='' where name = 'Guest' and password !=''"
))
conn
.
execute
(
text
(
"UPDATE user SET password='' where name = 'Guest' and password !=''"
))
session
.
commit
()
trans
.
commit
()
except
exc
.
OperationalError
:
except
exc
.
OperationalError
:
print
(
'Settings database is not writeable. Exiting...'
)
print
(
'Settings database is not writeable. Exiting...'
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
...
@@ -648,7 +649,7 @@ def migrate_Database(session):
...
@@ -648,7 +649,7 @@ def migrate_Database(session):
is
None
:
is
None
:
create_anonymous_user
(
session
)
create_anonymous_user
(
session
)
migrate_guest_password
(
engine
,
session
)
migrate_guest_password
(
engine
)
def
clean_database
(
session
):
def
clean_database
(
session
):
...
...
This diff is collapsed.
Click to expand it.
cps/updater.py
View file @
9fea5a55
...
@@ -210,7 +210,7 @@ class Updater(threading.Thread):
...
@@ -210,7 +210,7 @@ class Updater(threading.Thread):
def
moveallfiles
(
cls
,
root_src_dir
,
root_dst_dir
):
def
moveallfiles
(
cls
,
root_src_dir
,
root_dst_dir
):
new_permissions
=
os
.
stat
(
root_dst_dir
)
new_permissions
=
os
.
stat
(
root_dst_dir
)
log
.
debug
(
'Performing Update on OS-System:
%
s'
,
sys
.
platform
)
log
.
debug
(
'Performing Update on OS-System:
%
s'
,
sys
.
platform
)
change_permissions
=
(
sys
.
platform
==
"win32"
or
sys
.
platform
==
"darwin"
)
change_permissions
=
not
(
sys
.
platform
==
"win32"
or
sys
.
platform
==
"darwin"
)
for
src_dir
,
__
,
files
in
os
.
walk
(
root_src_dir
):
for
src_dir
,
__
,
files
in
os
.
walk
(
root_src_dir
):
dst_dir
=
src_dir
.
replace
(
root_src_dir
,
root_dst_dir
,
1
)
dst_dir
=
src_dir
.
replace
(
root_src_dir
,
root_dst_dir
,
1
)
if
not
os
.
path
.
exists
(
dst_dir
):
if
not
os
.
path
.
exists
(
dst_dir
):
...
...
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