Skip to content

Commit f69f976

Browse files
author
LittleYang0531
committed
Patch 2
1 parent 14f0afd commit f69f976

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

config/database.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,5 @@
22
{
33
"database": "sqlite",
44
"sqlite.dbfile": "sonolus.db"
5-
},
6-
{
7-
"database": "mysql",
8-
"mysql.hostname": "127.0.0.1",
9-
"mysql.port": 3306,
10-
"mysql.username": "root",
11-
"mysql.password": "root",
12-
"mysql.database": "sonolus"
135
}
146
]

modules/encrypt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ bool ecdsa_sha256_verify(string msg, string sig, string pemKey) {
208208

209209
// 引号编码
210210
string quote_encode(string source) {
211-
return str_replace("\"", "\"\"", source);
211+
return str_replace("\"", "\"\"", str_replace("\n", "\\n", source));
212212
}
213213

214214
#endif

phigros

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit c0a79a00bccf0df8da25db2c045b697288af74a2
1+
Subproject commit 9148670d12d6930fdaa2bd63945a1853ed9f715c

web/gui/ItemDetails.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
quickGUICommunity(request, argv[0], argv[1], argList, detailsIcon); \
1313
string detailsSection = ""; \
1414
argvar args = item.fetchParamList(); \
15-
for (auto v : args) args[v.first] = str_replace("\"", "\\\"", v.second); \
15+
for (auto v : args) args[v.first] = quote_encode(v.second); \
1616
for (int i = 0; i < appConfig[argv[0] + ".details.sections"].size(); i++) { \
1717
auto section = appConfig[argv[0] + ".details.sections"][i]; \
1818
detailsSection += "<a style=\"height:0px;margin:0px;\" name=\"" + section["title"].asString() + "\"></a>"; \

web/sonolus/ItemCreate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ auto SonolusCreate = [](client_conn conn, http_request request, param argv){
55
auto $_POST = argvar();
66
if (request.postdata[0] == '{') request.postdata = json_decode(request.postdata)["value"].asString();
77
$_POST = postParam(request);
8+
for (auto v : $_POST) $_POST[v.first] = urldecode(v.second);
9+
for (auto v : $_POST) $_POST[v.first] = quote_encode(v.second);
810
int raws = 0;
911
int id = $_POST["id"] == "" ? -1 : atoi($_POST["id"].c_str());
1012
string name = $_POST["name"];

web/sonolus/ItemDetails.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
appConfig[defineToString(name2)".enableComment"].asBool() || \
1313
appConfig[defineToString(name2)".enableRating"].asBool(); \
1414
argvar args = item.fetchParamList(); \
15-
for (auto v : args) args[v.first] = str_replace("\"", "\\\"", v.second); \
15+
for (auto v : args) args[v.first] = quote_encode(v.second); \
1616
for (int i = 0; i < appConfig[defineToString(name2)".details.sections"].size(); i++) { \
1717
auto obj = appConfig[defineToString(name2)".details.sections"][i]; \
1818
string filter = obj["filter"].asString(), \
@@ -24,7 +24,7 @@
2424
name2##List(filter, order, 1, appConfig[defineToString(name2)".pageSize.recommends"].asInt()) \
2525
).toJsonObject()); \
2626
} \
27-
auto recommended = name2##List("author = \"" + item.author + "\"", "id DESC", 1, 5); \
27+
auto recommended = name2##List("author = \"" + quote_encode(item.author) + "\"", "id DESC", 1, 5); \
2828
ItemDetails["recommended"].resize(0); \
2929
for (int i = 0; i < recommended.size(); i++) ItemDetails["recommended"].append(recommended[i].toJsonObject()); \
3030
}

0 commit comments

Comments
 (0)