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
b07a97c1
Commit
b07a97c1
authored
Jan 30, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'webp/comic-webp' into master
parents
41e7d65e
123493ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
kthoom.js
cps/static/js/kthoom.js
+19
-4
web.py
cps/web.py
+1
-1
No files found.
cps/static/js/kthoom.js
View file @
b07a97c1
...
@@ -141,9 +141,24 @@ var createURLFromArray = function(array, mimeType) {
...
@@ -141,9 +141,24 @@ var createURLFromArray = function(array, mimeType) {
kthoom
.
ImageFile
=
function
(
file
)
{
kthoom
.
ImageFile
=
function
(
file
)
{
this
.
filename
=
file
.
filename
;
this
.
filename
=
file
.
filename
;
var
fileExtension
=
file
.
filename
.
split
(
"."
).
pop
().
toLowerCase
();
var
fileExtension
=
file
.
filename
.
split
(
"."
).
pop
().
toLowerCase
();
this
.
mimeType
=
fileExtension
===
"png"
?
"image/png"
:
switch
(
fileExtension
)
{
(
fileExtension
===
"jpg"
||
fileExtension
===
"jpeg"
)
?
"image/jpeg"
:
case
"jpg"
:
fileExtension
===
"gif"
?
"image/gif"
:
fileExtension
===
"svg"
?
"image/xml+svg"
:
undefined
;
case
"jpeg"
:
this
.
mimeType
=
"image/jpeg"
;
break
;
case
"gif"
:
this
.
mimeType
=
"iamge/gif"
;
break
;
case
"svg"
:
this
.
mimeType
=
"image/svg+xml"
;
break
;
case
"webp"
:
this
.
mimeType
=
"image/webp"
;
break
;
default
:
this
.
mimeType
=
undefined
;
break
;
}
if
(
this
.
mimeType
!==
undefined
)
{
if
(
this
.
mimeType
!==
undefined
)
{
this
.
dataURI
=
createURLFromArray
(
file
.
fileData
,
this
.
mimeType
);
this
.
dataURI
=
createURLFromArray
(
file
.
fileData
,
this
.
mimeType
);
this
.
data
=
file
;
this
.
data
=
file
;
...
@@ -331,7 +346,7 @@ function setImage(url) {
...
@@ -331,7 +346,7 @@ function setImage(url) {
$
(
"#mainText"
).
innerHTML
(
"<iframe style=
\"
width:100%;height:700px;border:0
\"
src=
\"
data:text/html,"
+
escape
(
xhr
.
responseText
)
+
"
\"
></iframe>"
);
$
(
"#mainText"
).
innerHTML
(
"<iframe style=
\"
width:100%;height:700px;border:0
\"
src=
\"
data:text/html,"
+
escape
(
xhr
.
responseText
)
+
"
\"
></iframe>"
);
};
};
xhr
.
send
(
null
);
xhr
.
send
(
null
);
}
else
if
(
!
/
(
jpg|jpeg|png|gif
)
$/
.
test
(
imageFiles
[
currentImage
].
filename
)
&&
imageFiles
[
currentImage
].
data
.
uncompressedSize
<
10
*
1024
)
{
}
else
if
(
!
/
(
jpg|jpeg|png|gif
|webp
)
$/
.
test
(
imageFiles
[
currentImage
].
filename
)
&&
imageFiles
[
currentImage
].
data
.
uncompressedSize
<
10
*
1024
)
{
xhr
.
open
(
"GET"
,
url
,
true
);
xhr
.
open
(
"GET"
,
url
,
true
);
xhr
.
onload
=
function
()
{
xhr
.
onload
=
function
()
{
$
(
"#mainText"
).
css
(
"display"
,
""
);
$
(
"#mainText"
).
css
(
"display"
,
""
);
...
...
cps/web.py
View file @
b07a97c1
...
@@ -264,7 +264,7 @@ def get_comic_book(book_id, book_format, page):
...
@@ -264,7 +264,7 @@ def get_comic_book(book_id, book_format, page):
else:
else:
b64 = extract(page).encode('base64')
b64 = extract(page).encode('base64')
ext = names[page].rpartition('.')[-1]
ext = names[page].rpartition('.')[-1]
if ext not in ('png', 'gif', 'jpg', 'jpeg'):
if ext not in ('png', 'gif', 'jpg', 'jpeg'
, 'webp'
):
ext = 'png'
ext = 'png'
extractedfile="data:image/" + ext + ";base64," + b64
extractedfile="data:image/" + ext + ";base64," + b64
fileData={"name": names[page], "page":page, "last":len(names)-1, "content": extractedfile}
fileData={"name": names[page], "page":page, "last":len(names)-1, "content": extractedfile}
...
...
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