Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleYang0531 committed Jun 16, 2024
1 parent a5f94a5 commit 14f0afd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ app.all("*", async (req, res2) => {
while (inst.FS.readFile("/response_" + requestId) == "") await new Promise(r => setTimeout(r, 100));
var dat = inst.FS.readFile("/response_" + requestId, { encoding: 'utf8' });
parseRawResponse(dat, res2);
inst.db.close();
inst.connection.end();
} catch (error) {
let obj = {
error: true,
Expand Down
1 change: 1 addition & 0 deletions emain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void preload() {
log_init(log_target_type);
http_init();
loadConfig();
loadDefaultVariable();

/** 设置HTTP代码解释 */
http_code[100] = "Continue";
Expand Down
16 changes: 8 additions & 8 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ echo -e "${YELLOW}Compiling Sonolus Server using g++...${WHITE}"
g++ main.cpp -o sonolus\
-ldl -lpthread -lcrypto -lssl -ljsoncpp -std=c++14 -g -w \
-DENABLE_SONOLUS -DENABLE_MYSQL -lmysqlclient -DENABLE_SQLITE -lsqlite3 -DENABLE_CURL -lcurl -DENABLE_ZIP -lzip
# echo -e "${YELLOW}Compiling libsonolush using g++...${WHITE}"
# g++ plugins/libsonolush/libsonolush.cpp -o plugins/libsonolush.so \
# -g -std=c++17 -fPIC -shared\
# -DENABLE_SONOLUS -DENABLE_MYSQL -DENABLE_SQLITE -DENABLE_CURL -DENABLE_ZIP
# echo -e "${YELLOW}Compiling libonedrive using g++...${WHITE}"
# g++ plugins/libonedrive/libonedrive.cpp -o plugins/libonedrive.so \
# -ldl -lpthread -lcrypto -lssl -ljsoncpp -std=c++17 -fPIC -shared -g \
# -DENABLE_SONOLUS -DENABLE_MYSQL -DENABLE_SQLITE -DENABLE_CURL -DENABLE_ZIP
echo -e "${YELLOW}Compiling libsonolush using g++...${WHITE}"
g++ plugins/libsonolush/libsonolush.cpp -o plugins/libsonolush.so \
-g -std=c++17 -fPIC -shared -w\
-DENABLE_SONOLUS -DENABLE_MYSQL -DENABLE_SQLITE -DENABLE_CURL -DENABLE_ZIP
echo -e "${YELLOW}Compiling libonedrive using g++...${WHITE}"
g++ plugins/libonedrive/libonedrive.cpp -o plugins/libonedrive.so \
-ldl -lpthread -lcrypto -lssl -ljsoncpp -std=c++17 -fPIC -shared -g -w\
-DENABLE_SONOLUS -DENABLE_MYSQL -DENABLE_SQLITE -DENABLE_CURL -DENABLE_ZIP
echo -e "${YELLOW}Done.${WHITE}"
echo -e ""
echo -e "You can type \`./sonolus serve\` to start your server."
1 change: 1 addition & 0 deletions phigros
Submodule phigros added at c0a79a
4 changes: 2 additions & 2 deletions web/gui/ItemList.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ auto GUIList = [](client_conn conn, http_request request, param argv) {
sqlFilter += "title like \"%" + str_replace("\"", "\\\"", urldecode($_GET["keywords"])) + "%\"";
} else {
argvar args = argvar(); string filter = "";
string searchJson = readFile("./config/" + argv[0].substr(0, argv[0].size() - 1) + "_search.json"); Json::Value Searches;
Json::Value Searches = appConfig[argv[0] + ".searches"];
for (auto v : $_GET) $_GET[v.first] = str_replace("\"", "\\\"", urldecode(v.second));
json_decode(searchJson, Searches); int searchId = -1;
int searchId = -1;
for (int i = 0; i < Searches.size(); i++) if (Searches[i]["type"].asString() == $_GET["type"]) {
searchId = i; filter = Searches[i]["filter"].asString(); order = Searches[i]["order"].asString();
type = Searches[i]["title"].asString();
Expand Down
4 changes: 2 additions & 2 deletions web/sonolus/ItemList.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ auto SonolusList = [](client_conn conn, http_request request, param argv){
if ($_GET["type"] == "quick") sqlFilter += "title like \"%" + str_replace("\"", "\\\"", urldecode($_GET["keywords"])) + "%\"";
else {
argvar args = argvar(); string filter = "";
string searchJson = readFile("./config/" + argv[0].substr(0, argv[0].size() - 1) + "_search.json"); Json::Value Searches;
Json::Value Searches = appConfig[argv[0] + ".searches"];
for (auto v : $_GET) $_GET[v.first] = str_replace("\"", "\\\"", urldecode(v.second));
json_decode(searchJson, Searches); int searchId = -1;
int searchId = -1;

if ($_GET["type"] == "") { // 向下兼容 Sonolus 0.7.5-
if (Searches.size()) $_GET["type"] = Searches[0]["type"].asString();
Expand Down

0 comments on commit 14f0afd

Please sign in to comment.