Skip to content

Commit

Permalink
更新单源搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
NatsumiXD committed Mar 5, 2023
1 parent 74592e1 commit 26fbeee
Show file tree
Hide file tree
Showing 13 changed files with 2,686 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ storage
nginx/logs/nginx.pid
config.py
head/config.py
file-uploads/3d2a41ad-8e5b-466a-b961-8d887235937b
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

746 changes: 745 additions & 1 deletion .idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified head/__pycache__/server.cpython-311.pyc
Binary file not shown.
38 changes: 37 additions & 1 deletion head/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def add_cookie():
login_url = res.post(url + "getBookSource", json=json1).json()["data"]
header = str(login_url["header"])[0:len(login_url["header"])-1]
print(header)
header = header + '\n' + f'"Cookie": "{s_cookie}"' + "}"
header = header + ',\n' + f'"Cookie": "{s_cookie}"' + "}"
login1 = login_url
login1["header"] = header
res.post(url + "saveBookSource", json=login1)
Expand Down Expand Up @@ -433,3 +433,39 @@ def multi_search_key():
data.append(j)

return temp("multi_search_book.html", data=data)


@app.route("/single_search/")
def single_sources_index():
bookSourceGroup = get_BookSources_list()
return temp("single_search_book.html", bookSourceGroup=bookSourceGroup)

@app.route("/single_search/id/<int:group_id>")
def single_sources_id(group_id):
bookSourceGroup = get_BookSources_list()
bookSourceGroup = bookSourceGroup[group_id][0]
s_list = []
bookSource = res.get(url + "getBookSources").json()["data"]
for i in bookSource:
if str(i["bookSourceGroup"]) == bookSourceGroup:
s_list.append((i["bookSourceName"], i["bookSourceGroup"], f'/single_search/search/{i["bookSourceUrl"]}'))
return temp("getBookSources_id.html", bookSourceGroup=bookSourceGroup, s_list=s_list)

@app.route("/single_search/search/<path:p>")
def search_sources_get(p):
get_url = get_book_url("/single_search/search/")

bookSource = res.get(url + "getBookSources").json()["data"]
return temp("single_search.html", get_url=get_url)

@app.route("/single_search/key/<path:p>")
def single_list(p):
url1 = get_book_url("/single_search/key/")

info=url1.split("?key=")
json1 = {
"key": info[1],
"bookSourceUrl": info[0]
}
data = res.post(url + "searchBook", json=json1).json()["data"]
return temp("multi_search_book.html", data=data)
4 changes: 3 additions & 1 deletion head/templates/multi_search.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<form name="input" action="/multi_search/key/" method="get">
输入关键字: <input type="text" name="key">
<input type="submit" value="搜索">
</form>
</form>

<a href="/single_search">单源搜索</a>
6 changes: 6 additions & 0 deletions head/templates/single_search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<form name="input" action="/single_search/key/{{get_url}}" method="get">
输入关键字: <input type="text" name="key">
<input type="submit" value="搜索">
</form>

<a href="/search">多源搜索</a>
90 changes: 90 additions & 0 deletions head/templates/single_search_book.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>书源</title>
<style>
.jz {
text-align:center
}
.divvvv {
height:200;
width:auto;
text-align:center;
display:flex;
flex-direction:row;
flex-wrap:wrap;
justify-content:space-evenly;
align-items:center
}
.wb {
display:block;
color:antiquewhite;
height:20;
width:auto
}
.xu-light {
border:0;
border-top:2px dotted#a2a9b6
}
.cssbutton {
margin-top:32px;
height:40px
}
.cssbutton a {
text-decoration:none;
background:#2f435e;
color:#f2f2f2;
padding:10px 30px 10px
30px;
font-size:16rem;
font-family:Arial,Helvetica,Verdana,sans-serif;
font-weight:bold;
border-radius:3px;
-webkit-transition:all linear 0.30s;
-moz-transition:all linear
0.30s;
transition:all linear 0.30s
}
.cssbutton a:hover {
background:#385f9e
}
.xu-line {
border:0;
border-top:2px
dotted#a2a9b6
}
.bookcard{
border:3px solid rgb(95, 81, 81);
border-radius:5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.027);
}

.bookcard-text{
border:3px solid rgb(255, 255, 255);
}
.jiange{
border:3px solid white;
}
</style>
</head>
<body>
<div class="jz">
<h1>单源搜索,选择分组</h1>
</div>
<div class="wb"></div>

<div class="divvvv">

{%for i in bookSourceGroup %}
<div class="jiange" onclick="window.location.href='{{ i[1] }}';">
<div class="bookcard">
<div class="bookcard-text">
<a class="jz bookcard-text-c">{{ i[0] }}</a>
</div>
</div>
<div class="wb"></div>
</div>
{% endfor %}
</div>
</body>
</html>
3 changes: 2 additions & 1 deletion nginx/conf/proxy/127.0.0.1_1000.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
server {
# listen 80;
listen 1000;
server_name 127.0.0.1;
listen [::]:1000;
server_name 0.0.0.0;
location / {
proxy_pass http://127.0.0.1:5000/;
proxy_http_version 1.1;
Expand Down
3 changes: 2 additions & 1 deletion nginx/conf/proxy/127.0.0.1_80.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
server {
listen 80;
listen [::]:80;
# listen 1000;
server_name 127.0.0.1;
server_name 0.0.0.0;
location / {
proxy_pass http://127.0.0.1:5000/;
proxy_http_version 1.1;
Expand Down
Loading

0 comments on commit 26fbeee

Please sign in to comment.