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
0224d459
Commit
0224d459
authored
Mar 04, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cosmetics
parent
0be17ed1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
43 deletions
+69
-43
__init__.py
cps/__init__.py
+20
-3
admin.py
cps/admin.py
+1
-2
filter_list.js
cps/static/js/filter_list.js
+18
-6
main.js
cps/static/js/main.js
+6
-6
table.js
cps/static/js/table.js
+6
-6
uploadprogress.js
cps/static/js/uploadprogress.js
+18
-18
uploader.py
cps/uploader.py
+0
-2
No files found.
cps/__init__.py
View file @
0224d459
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# import logging
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# from logging.handlers import SMTPHandler, RotatingFileHandler
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# import os
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
# falgh1, grunjol, csitko, ytils, xybydy, trasba, vrabe,
# ruben-herold, marblepebble, JackED42, SiphonSquirrel,
# apetresc, nanu-c, mutschler
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
mimetypes
import
mimetypes
from
flask
import
Flask
,
request
,
g
from
flask
import
Flask
,
request
,
g
from
flask_login
import
LoginManager
from
flask_login
import
LoginManager
...
...
cps/admin.py
View file @
0224d459
...
@@ -39,10 +39,9 @@ from gdriveutils import is_gdrive_ready, gdrive_support, downloadFile, deleteDat
...
@@ -39,10 +39,9 @@ from gdriveutils import is_gdrive_ready, gdrive_support, downloadFile, deleteDat
import
helper
import
helper
from
werkzeug.security
import
generate_password_hash
from
werkzeug.security
import
generate_password_hash
try
:
try
:
from
urllib.parse
import
quote
from
imp
import
reload
from
imp
import
reload
except
ImportError
:
except
ImportError
:
from
urllib
import
quote
pass
feature_support
=
dict
()
feature_support
=
dict
()
try
:
try
:
...
...
cps/static/js/filter_list.js
View file @
0224d459
/* This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
* Copyright (C) 2018 OzzieIsaacs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var
direction
=
0
;
// Descending order
var
direction
=
0
;
// Descending order
...
@@ -8,7 +24,6 @@ $("#desc").click(function() {
...
@@ -8,7 +24,6 @@ $("#desc").click(function() {
var
list
=
$
(
'#list'
);
var
list
=
$
(
'#list'
);
var
listItems
=
list
.
children
(
".row"
);
var
listItems
=
list
.
children
(
".row"
);
list
.
append
(
listItems
.
get
().
reverse
());
list
.
append
(
listItems
.
get
().
reverse
());
console
.
log
(
"desc"
)
direction
=
0
;
direction
=
0
;
});
});
...
@@ -17,10 +32,9 @@ $("#asc").click(function() {
...
@@ -17,10 +32,9 @@ $("#asc").click(function() {
if
(
direction
===
1
)
{
if
(
direction
===
1
)
{
return
;
return
;
}
}
var
list
=
$
(
'#list'
);
var
list
=
$
(
"#list"
);
var
listItems
=
list
.
children
(
".row"
);
var
listItems
=
list
.
children
(
".row"
);
list
.
append
(
listItems
.
get
().
reverse
());
list
.
append
(
listItems
.
get
().
reverse
());
console
.
log
(
"asc"
)
direction
=
1
;
direction
=
1
;
});
});
...
@@ -31,12 +45,10 @@ $("#all").click(function() {
...
@@ -31,12 +45,10 @@ $("#all").click(function() {
});
});
$
(
".char"
).
click
(
function
()
{
$
(
".char"
).
click
(
function
()
{
console
.
log
(
this
.
innerText
);
var
character
=
this
.
innerText
;
var
character
=
this
.
innerText
;
// var listItems = ;
$
(
".row"
).
each
(
function
()
{
$
(
".row"
).
each
(
function
()
{
if
(
this
.
attributes
[
'data-id'
].
value
.
charAt
(
0
).
toUpperCase
()
!==
character
)
{
if
(
this
.
attributes
[
"data-id"
].
value
.
charAt
(
0
).
toUpperCase
()
!==
character
)
{
$
(
this
).
hide
();
$
(
this
).
hide
();
}
else
{
}
else
{
$
(
this
).
show
();
$
(
this
).
show
();
...
...
cps/static/js/main.js
View file @
0224d459
...
@@ -31,13 +31,13 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
...
@@ -31,13 +31,13 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
// Generic control/related handler to show/hide fields based on a select' value
// Generic control/related handler to show/hide fields based on a select' value
$
(
document
).
on
(
"change"
,
"select[data-control]"
,
function
()
{
$
(
document
).
on
(
"change"
,
"select[data-control]"
,
function
()
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
var
name
=
$this
.
data
(
"control"
);
var
name
=
$this
.
data
(
"control"
);
var
showOrHide
=
$this
.
val
();
var
showOrHide
=
$this
.
val
();
var
showOrHideLast
=
$
(
"#"
+
name
+
" option:last"
).
val
()
// var showOrHideLast = $("#" +
name + " option:last").val()
for
(
i
=
0
;
i
<
$
(
this
)[
0
].
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
$
(
this
)[
0
].
length
;
i
++
)
{
if
(
parseInt
(
$
(
this
)[
0
][
i
].
value
)
==
showOrHide
)
{
if
(
parseInt
(
$
(
this
)[
0
][
i
].
value
)
==
=
showOrHide
)
{
$
(
"[data-related=
\"
"
+
name
+
"-"
+
i
+
"
\"
]"
).
show
();
$
(
"[data-related=
\"
"
+
name
+
"-"
+
i
+
"
\"
]"
).
show
();
}
else
{
}
else
{
$
(
"[data-related=
\"
"
+
name
+
"-"
+
i
+
"
\"
]"
).
hide
();
$
(
"[data-related=
\"
"
+
name
+
"-"
+
i
+
"
\"
]"
).
hide
();
...
@@ -110,7 +110,7 @@ $(function() {
...
@@ -110,7 +110,7 @@ $(function() {
//animate : true, # ToDo: Reenable function
//animate : true, # ToDo: Reenable function
//extraScrollPx: 300
//extraScrollPx: 300
});
});
$loadMore
.
on
(
'append.infiniteScroll'
,
function
(
event
,
response
,
path
,
data
)
{
$loadMore
.
on
(
"append.infiniteScroll"
,
function
(
event
,
response
,
path
,
data
)
{
$
(
".pagination"
).
addClass
(
"hidden"
);
$
(
".pagination"
).
addClass
(
"hidden"
);
$
(
".load-more .row"
).
isotope
(
"appended"
,
$
(
data
),
null
);
$
(
".load-more .row"
).
isotope
(
"appended"
,
$
(
data
),
null
);
});
});
...
@@ -141,7 +141,7 @@ $(function() {
...
@@ -141,7 +141,7 @@ $(function() {
var
buttonText
=
$this
.
html
();
var
buttonText
=
$this
.
html
();
$this
.
html
(
"..."
);
$this
.
html
(
"..."
);
$
(
"#update_error"
).
addClass
(
"hidden"
);
$
(
"#update_error"
).
addClass
(
"hidden"
);
if
(
$
(
"#message"
).
length
){
if
(
$
(
"#message"
).
length
)
{
$
(
"#message"
).
alert
(
"close"
);
$
(
"#message"
).
alert
(
"close"
);
}
}
$
.
ajax
({
$
.
ajax
({
...
...
cps/static/js/table.js
View file @
0224d459
...
@@ -27,15 +27,15 @@ $(function() {
...
@@ -27,15 +27,15 @@ $(function() {
async
:
true
,
async
:
true
,
timeout
:
900
,
timeout
:
900
,
success
:
function
(
data
){
success
:
function
(
data
){
$
(
'#domain-table'
).
bootstrapTable
(
"load"
,
data
);
$
(
"#domain-table""
).bootstrapTable("
load
", data);
}
}
});
});
});
});
$("
#
domain
-
table
").bootstrapTable({
$("
#
domain
-
table
").bootstrapTable({
formatNoMatches: function () {
formatNoMatches: function () {
return "";
return "";
},
},
striped
:
false
striped: false
});
});
$("
#
btndeletedomain
").click(function() {
$("
#
btndeletedomain
").click(function() {
//get data-id attribute of the clicked element
//get data-id attribute of the clicked element
...
@@ -51,7 +51,7 @@ $(function() {
...
@@ -51,7 +51,7 @@ $(function() {
url: window.location.pathname + "
/
..
/
..
/
ajax
/
domainlist
",
url: window.location.pathname + "
/
..
/
..
/
ajax
/
domainlist
",
async: true,
async: true,
timeout: 900,
timeout: 900,
success
:
function
(
data
){
success:function(data)
{
$("
#
domain
-
table
").bootstrapTable("
load
", data);
$("
#
domain
-
table
").bootstrapTable("
load
", data);
}
}
});
});
...
@@ -65,11 +65,11 @@ $(function() {
...
@@ -65,11 +65,11 @@ $(function() {
});
});
});
});
function
TableActions
(
value
,
row
,
index
)
{
/*
function TableActions (value, row, index) {
return [
return [
"
<
a
class
=
\
"danger remove
\"
data-toggle=
\"
modal
\"
data-target=
\"
#DeleteDomain
\"
data-domain-id=
\"
"
+
row
.
id
"
<
a
class
=
\
"danger remove
\"
data-toggle=
\"
modal
\"
data-target=
\"
#DeleteDomain
\"
data-domain-id=
\"
"
+
row
.
id
+
"
\"
title=
\"
Remove
\"
>"
,
+
"
\"
title=
\"
Remove
\"
>"
,
"<i class=
\"
glyphicon glyphicon-trash
\"
></i>"
,
"<i class=
\"
glyphicon glyphicon-trash
\"
></i>"
,
"</a>"
"</a>"
].
join
(
""
);
].
join
(
""
);
}
}
*
/
cps/static/js/uploadprogress.js
View file @
0224d459
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
* Version 1.0.0
* Version 1.0.0
* Licensed under the MIT license.
* Licensed under the MIT license.
*/
*/
(
function
(
$
)
{
(
function
(
$
)
{
"use strict"
;
"use strict"
;
...
@@ -57,13 +58,13 @@
...
@@ -57,13 +58,13 @@
// Translate texts
// Translate texts
this
.
$modalTitle
.
text
(
this
.
options
.
modalTitle
)
this
.
$modalTitle
.
text
(
this
.
options
.
modalTitle
)
this
.
$modalFooter
.
children
(
"button"
).
text
(
this
.
options
.
modalFooter
)
this
.
$modalFooter
.
children
(
"button"
).
text
(
this
.
options
.
modalFooter
)
;
this
.
$modal
.
on
(
"hidden.bs.modal"
,
$
.
proxy
(
this
.
reset
,
this
));
this
.
$modal
.
on
(
"hidden.bs.modal"
,
$
.
proxy
(
this
.
reset
,
this
));
},
},
reset
:
function
()
{
reset
:
function
()
{
this
.
$modalTitle
.
text
(
this
.
options
.
modalTitle
)
this
.
$modalTitle
.
text
(
this
.
options
.
modalTitle
)
;
this
.
$modalFooter
.
hide
();
this
.
$modalFooter
.
hide
();
this
.
$modalBar
.
addClass
(
"progress-bar-success"
);
this
.
$modalBar
.
addClass
(
"progress-bar-success"
);
this
.
$modalBar
.
removeClass
(
"progress-bar-danger"
);
this
.
$modalBar
.
removeClass
(
"progress-bar-danger"
);
...
@@ -103,7 +104,7 @@
...
@@ -103,7 +104,7 @@
// HTTP 500 ends up here!?!
// HTTP 500 ends up here!?!
return
this
.
error
(
xhr
);
return
this
.
error
(
xhr
);
}
}
this
.
set
_p
rogress
(
100
);
this
.
set
P
rogress
(
100
);
var
url
;
var
url
;
var
contentType
=
xhr
.
getResponseHeader
(
"Content-Type"
);
var
contentType
=
xhr
.
getResponseHeader
(
"Content-Type"
);
...
@@ -132,25 +133,25 @@
...
@@ -132,25 +133,25 @@
// Replace the contents of the form, with the returned html
// Replace the contents of the form, with the returned html
if
(
xhr
.
status
===
422
)
{
if
(
xhr
.
status
===
422
)
{
var
newHtml
=
$
.
parseHTML
(
xhr
.
responseText
);
var
newHtml
=
$
.
parseHTML
(
xhr
.
responseText
);
this
.
replace
_fo
rm
(
newHtml
);
this
.
replace
For
rm
(
newHtml
);
this
.
$modal
.
modal
(
"hide"
);
this
.
$modal
.
modal
(
"hide"
);
}
}
// Write the error response to the document.
// Write the error response to the document.
else
{
else
{
var
responseText
=
xhr
.
responseText
;
// Handle no response error
// Handle no response error
if
(
contentType
)
{
if
(
contentType
)
{
var
responseText
=
xhr
.
responseText
;
if
(
contentType
.
indexOf
(
"text/plain"
)
!==
-
1
)
{
if
(
contentType
.
indexOf
(
"text/plain"
)
!==
-
1
)
{
responseText
=
"<pre>"
+
responseText
+
"</pre>"
;
responseText
=
"<pre>"
+
responseText
+
"</pre>"
;
}
}
document
.
write
(
xhr
.
responseText
);
document
.
write
(
responseText
);
}
}
}
}
},
},
set
_progress
:
function
(
percent
)
{
set
Progress
:
function
(
percent
)
{
var
txt
=
percent
+
"%"
;
var
txt
=
percent
+
"%"
;
if
(
percent
==
100
)
{
if
(
percent
==
=
100
)
{
txt
=
this
.
options
.
uploadedMsg
;
txt
=
this
.
options
.
uploadedMsg
;
}
}
this
.
$modalBar
.
attr
(
"aria-valuenow"
,
percent
);
this
.
$modalBar
.
attr
(
"aria-valuenow"
,
percent
);
...
@@ -158,21 +159,20 @@
...
@@ -158,21 +159,20 @@
this
.
$modalBar
.
css
(
"width"
,
percent
+
"%"
);
this
.
$modalBar
.
css
(
"width"
,
percent
+
"%"
);
},
},
progress
:
function
(
/*ProgressEvent*/
e
){
progress
:
function
(
/*ProgressEvent*/
e
)
{
var
percent
=
Math
.
round
((
e
.
loaded
/
e
.
total
)
*
100
);
var
percent
=
Math
.
round
((
e
.
loaded
/
e
.
total
)
*
100
);
this
.
set
_p
rogress
(
percent
);
this
.
set
P
rogress
(
percent
);
},
},
// replace
_f
orm replaces the contents of the current form
// replace
F
orm replaces the contents of the current form
// with the form in the html argument.
// with the form in the html argument.
// We use the id of the current form to find the new form in the html
// We use the id of the current form to find the new form in the html
replace
_f
orm
:
function
(
html
)
{
replace
F
orm
:
function
(
html
)
{
var
newForm
;
var
newForm
;
var
formId
=
this
.
$form
.
attr
(
"id"
);
var
formId
=
this
.
$form
.
attr
(
"id"
);
if
(
formId
!==
undefined
)
{
if
(
typeof
(
formId
)
!==
"undefined"
)
{
newForm
=
$
(
html
).
find
(
"#"
+
formId
);
newForm
=
$
(
html
).
find
(
"#"
+
formId
);
}
}
else
{
else
{
newForm
=
$
(
html
).
find
(
"form"
);
newForm
=
$
(
html
).
find
(
"form"
);
}
}
// add the filestyle again
// add the filestyle again
...
@@ -181,11 +181,11 @@
...
@@ -181,11 +181,11 @@
}
}
};
};
$
.
fn
.
uploadprogress
=
function
(
options
,
value
)
{
$
.
fn
.
uploadprogress
=
function
(
options
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
_options
=
$
.
extend
({},
$
.
fn
.
uploadprogress
.
defaults
,
options
);
var
_options
=
$
.
extend
({},
$
.
fn
.
uploadprogress
.
defaults
,
options
);
var
file
_p
rogress
=
new
UploadProgress
(
this
,
_options
);
var
file
P
rogress
=
new
UploadProgress
(
this
,
_options
);
file
_p
rogress
.
constructor
();
file
P
rogress
.
constructor
();
});
});
};
};
...
...
cps/uploader.py
View file @
0224d459
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
from
tempfile
import
gettempdir
from
tempfile
import
gettempdir
import
hashlib
import
hashlib
from
collections
import
namedtuple
from
collections
import
namedtuple
import
logging
import
os
import
os
from
flask_babel
import
gettext
as
_
from
flask_babel
import
gettext
as
_
import
comic
import
comic
...
@@ -31,7 +30,6 @@ try:
...
@@ -31,7 +30,6 @@ try:
except
ImportError
:
except
ImportError
:
lxmlversion
=
None
lxmlversion
=
None
# logger = logging.getLogger("uploader")
try
:
try
:
from
wand.image
import
Image
from
wand.image
import
Image
...
...
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