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
89bddead
Commit
89bddead
authored
Nov 03, 2018
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'http_error/beautify-http-errors'
parents
38c180a9
60e9d01d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
+60
-0
style.css
cps/static/css/style.css
+16
-0
http_error.html
cps/templates/http_error.html
+26
-0
web.py
cps/web.py
+18
-0
No files found.
cps/static/css/style.css
View file @
89bddead
...
@@ -5,6 +5,22 @@
...
@@ -5,6 +5,22 @@
src
:
local
(
'Grand Hotel'
),
local
(
'GrandHotel-Regular'
),
url("fonts/GrandHotel-Regular.ttf")
format
(
'truetype'
);
src
:
local
(
'Grand Hotel'
),
local
(
'GrandHotel-Regular'
),
url("fonts/GrandHotel-Regular.ttf")
format
(
'truetype'
);
}
}
html
.http-error
{
margin
:
0
;
height
:
100%
;
}
.http-error
body
{
margin
:
0
;
height
:
100%
;
display
:
table
;
width
:
100%
;
}
.http-error
body
>
div
{
display
:
table-cell
;
vertical-align
:
middle
;
text-align
:
center
;
}
body
{
background
:
#f2f2f2
}
body
h2
{
font-weight
:
normal
;
color
:
#444
}
body
{
background
:
#f2f2f2
}
body
h2
{
font-weight
:
normal
;
color
:
#444
}
body
{
margin-bottom
:
40px
;}
body
{
margin-bottom
:
40px
;}
a
{
color
:
#45b29d
}
a
:hover
{
color
:
#444
;}
a
{
color
:
#45b29d
}
a
:hover
{
color
:
#444
;}
...
...
cps/templates/http_error.html
0 → 100644
View file @
89bddead
<!DOCTYPE html>
<html
class=
"http-error"
lang=
"{{ g.user.locale }}"
>
<head>
<title>
{{ instance }} | HTTP Error ({{ error_code }})
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
>
<!-- Bootstrap -->
<link
rel=
"apple-touch-icon"
sizes=
"140x140"
href=
"{{ url_for('static', filename='favicon.ico') }}"
>
<link
rel=
"shortcut icon"
href=
"{{ url_for('static', filename='favicon.ico') }}"
>
<link
href=
"{{ url_for('static', filename='css/libs/bootstrap.min.css') }}"
rel=
"stylesheet"
media=
"screen"
>
<link
href=
"{{ url_for('static', filename='css/style.css') }}"
rel=
"stylesheet"
media=
"screen"
>
{% if g.user.get_theme == 1 %}
<link
href=
"{{ url_for('static', filename='css/caliBlur-style.css') }}"
rel=
"stylesheet"
media=
"screen"
>
{% endif %}
</head>
<body>
<div
class=
"container text-center"
>
<h1>
{{ error_code }}
</h1>
<h3>
{{ error_name }}
</h3>
<a
href=
"{{url_for('index')}}"
title=
"{{ _('Back to home') }}"
>
{{_('Back to home')}}
</a>
</div>
</body>
</html>
cps/web.py
View file @
89bddead
...
@@ -9,6 +9,8 @@ from flask import (Flask, render_template, request, Response, redirect,
...
@@ -9,6 +9,8 @@ from flask import (Flask, render_template, request, Response, redirect,
abort
,
Markup
)
abort
,
Markup
)
from
flask
import
__version__
as
flaskVersion
from
flask
import
__version__
as
flaskVersion
from
werkzeug
import
__version__
as
werkzeugVersion
from
werkzeug
import
__version__
as
werkzeugVersion
from
werkzeug.exceptions
import
default_exceptions
from
jinja2
import
__version__
as
jinja2Version
from
jinja2
import
__version__
as
jinja2Version
import
cache_buster
import
cache_buster
import
ub
import
ub
...
@@ -131,6 +133,21 @@ mimetypes.add_type('application/x-cbt', '.cbt')
...
@@ -131,6 +133,21 @@ mimetypes.add_type('application/x-cbt', '.cbt')
mimetypes
.
add_type
(
'image/vnd.djvu'
,
'.djvu'
)
mimetypes
.
add_type
(
'image/vnd.djvu'
,
'.djvu'
)
app
=
(
Flask
(
__name__
))
app
=
(
Flask
(
__name__
))
# custom error page
def
error_http
(
error
):
return
render_template
(
'http_error.html'
,
error_code
=
error
.
code
,
error_name
=
error
.
name
,
instance
=
config
.
config_calibre_web_title
),
error
.
code
# http error handling
for
ex
in
default_exceptions
:
# new routine for all client errors, server errors stay
if
ex
<
500
:
app
.
register_error_handler
(
ex
,
error_http
)
app
.
wsgi_app
=
ReverseProxied
(
app
.
wsgi_app
)
app
.
wsgi_app
=
ReverseProxied
(
app
.
wsgi_app
)
cache_buster
.
init_cache_busting
(
app
)
cache_buster
.
init_cache_busting
(
app
)
...
@@ -171,6 +188,7 @@ def is_gdrive_ready():
...
@@ -171,6 +188,7 @@ def is_gdrive_ready():
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
get_main_dir
,
'gdrive_credentials'
))
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
get_main_dir
,
'gdrive_credentials'
))
@
babel
.
localeselector
@
babel
.
localeselector
def
get_locale
():
def
get_locale
():
# if a user is logged in, use the locale from the user settings
# if a user is logged in, use the locale from the user settings
...
...
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