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
3719b7e4
Commit
3719b7e4
authored
Apr 29, 2016
by
janeczku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ANON_BROWSE configuration option
parent
554bc6aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
+19
-11
config.ini.example
config.ini.example
+1
-0
config.py
cps/config.py
+3
-4
web.py
cps/web.py
+2
-2
readme.md
readme.md
+13
-5
No files found.
config.ini.example
View file @
3719b7e4
...
@@ -10,3 +10,4 @@ TITLE_REGEX = ^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+
...
@@ -10,3 +10,4 @@ TITLE_REGEX = ^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+
DEVELOPMENT = 0
DEVELOPMENT = 0
PUBLIC_REG = 0
PUBLIC_REG = 0
UPLOADING = 0
UPLOADING = 0
ANON_BROWSE = 0
cps/config.py
View file @
3719b7e4
...
@@ -60,7 +60,7 @@ TITLE_REGEX = check_setting_str(CFG, 'Advanced', 'TITLE_REGEX', '^(A|The|An|Der|
...
@@ -60,7 +60,7 @@ TITLE_REGEX = check_setting_str(CFG, 'Advanced', 'TITLE_REGEX', '^(A|The|An|Der|
DEVELOPMENT
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'DEVELOPMENT'
,
0
))
DEVELOPMENT
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'DEVELOPMENT'
,
0
))
PUBLIC_REG
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'PUBLIC_REG'
,
0
))
PUBLIC_REG
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'PUBLIC_REG'
,
0
))
UPLOADING
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'UPLOADING'
,
0
))
UPLOADING
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'UPLOADING'
,
0
))
ANO
_SHOW_BOOKS
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'ANO_SHOW_BOOKS
'
,
0
))
ANO
N_BROWSE
=
bool
(
check_setting_int
(
CFG
,
'Advanced'
,
'ANON_BROWSE
'
,
0
))
SYS_ENCODING
=
"UTF-8"
SYS_ENCODING
=
"UTF-8"
...
@@ -79,8 +79,7 @@ configval["DEVELOPMENT"] = DEVELOPMENT
...
@@ -79,8 +79,7 @@ configval["DEVELOPMENT"] = DEVELOPMENT
configval
[
"TITLE_REGEX"
]
=
TITLE_REGEX
configval
[
"TITLE_REGEX"
]
=
TITLE_REGEX
configval
[
"PUBLIC_REG"
]
=
PUBLIC_REG
configval
[
"PUBLIC_REG"
]
=
PUBLIC_REG
configval
[
"UPLOADING"
]
=
UPLOADING
configval
[
"UPLOADING"
]
=
UPLOADING
configval
[
"ANO_SHOW_BOOKS"
]
=
ANO_SHOW_BOOKS
configval
[
"ANON_BROWSE"
]
=
ANON_BROWSE
def
save_config
(
configval
):
def
save_config
(
configval
):
new_config
=
ConfigObj
()
new_config
=
ConfigObj
()
...
@@ -97,7 +96,7 @@ def save_config(configval):
...
@@ -97,7 +96,7 @@ def save_config(configval):
new_config
[
'Advanced'
][
'DEVELOPMENT'
]
=
int
(
configval
[
"DEVELOPMENT"
])
new_config
[
'Advanced'
][
'DEVELOPMENT'
]
=
int
(
configval
[
"DEVELOPMENT"
])
new_config
[
'Advanced'
][
'PUBLIC_REG'
]
=
int
(
configval
[
"PUBLIC_REG"
])
new_config
[
'Advanced'
][
'PUBLIC_REG'
]
=
int
(
configval
[
"PUBLIC_REG"
])
new_config
[
'Advanced'
][
'UPLOADING'
]
=
int
(
configval
[
"UPLOADING"
])
new_config
[
'Advanced'
][
'UPLOADING'
]
=
int
(
configval
[
"UPLOADING"
])
new_config
[
'Advanced'
][
'ANO
_SHOW_BOOKS'
]
=
int
(
configval
[
"ANO_SHOW_BOOKS
"
])
new_config
[
'Advanced'
][
'ANO
N_BROWSE'
]
=
int
(
configval
[
"ANON_BROWSE
"
])
new_config
.
write
()
new_config
.
write
()
return
"Saved"
return
"Saved"
...
...
cps/web.py
View file @
3719b7e4
...
@@ -100,7 +100,7 @@ def requires_basic_auth_if_no_ano(f):
...
@@ -100,7 +100,7 @@ def requires_basic_auth_if_no_ano(f):
@
wraps
(
f
)
@
wraps
(
f
)
def
decorated
(
*
args
,
**
kwargs
):
def
decorated
(
*
args
,
**
kwargs
):
auth
=
request
.
authorization
auth
=
request
.
authorization
if
config
.
ANO
_SHOW_BOOKS
!=
1
:
if
config
.
ANO
N_BROWSE
!=
1
:
if
not
auth
or
not
check_auth
(
auth
.
username
,
auth
.
password
):
if
not
auth
or
not
check_auth
(
auth
.
username
,
auth
.
password
):
return
authenticate
()
return
authenticate
()
return
f
(
*
args
,
**
kwargs
)
return
f
(
*
args
,
**
kwargs
)
...
@@ -148,7 +148,7 @@ def url_for_other_page(page):
...
@@ -148,7 +148,7 @@ def url_for_other_page(page):
app
.
jinja_env
.
globals
[
'url_for_other_page'
]
=
url_for_other_page
app
.
jinja_env
.
globals
[
'url_for_other_page'
]
=
url_for_other_page
def
login_required_if_no_ano
(
func
):
def
login_required_if_no_ano
(
func
):
if
config
.
ANO
_SHOW_BOOKS
==
1
:
if
config
.
ANO
N_BROWSE
==
1
:
return
func
return
func
return
login_required
(
func
)
return
login_required
(
func
)
...
...
readme.md
View file @
3719b7e4
...
@@ -21,19 +21,27 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d
...
@@ -21,19 +21,27 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d
-
Support for reading eBooks directly in the browser
-
Support for reading eBooks directly in the browser
-
Upload new books in PDF format
-
Upload new books in PDF format
-
Support for Calibre custom columns
-
Support for Calibre custom columns
-
Fine grained per-user permissions
## Quick start
## Quick start
1.
Rename
`config.ini.example`
to
`config.ini`
and set DB_ROOT to the path of the folder where your Calibre library (metadata.db) lives
1.
Rename
`config.ini.example`
to
`config.ini`
and set
`DB_ROOT`
to the path of the folder where your Calibre library (metadata.db) lives
2.
To enable public user registration set PUBLIC_REG to 1
2.
Execute the command:
`python cps.py`
3.
To enable uploading of PDF books set UPLOADING to 1
3.
Point your browser to
`http://localhost:8083`
or
`http://localhost:8083/feed`
for the OPDS catalog
4.
Execute the command:
`python cps.py`
5.
Point your browser to
`http://localhost:8083`
or
`http://localhost:8083/feed`
for the OPDS catalog
**Default admin login:**
**Default admin login:**
*Username:*
admin
*Username:*
admin
*Password:*
admin123
*Password:*
admin123
## Runtime Configuration Options
`PUBLIC_REG`
Set to 1 to enable public user registration.
`ANON_BROWSE`
Set to 1 to allow not logged in users to browse the catalog.
`UPLOADING`
Set to 1 to enable PDF uploading. This requires the imagemagick library to be installed.
## Requirements
## Requirements
Python 2.7+
Python 2.7+
...
...
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