From 96118307e379adc564e7053cf8140f810ab90875 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Wed, 6 Apr 2022 01:56:11 +0000 Subject: [PATCH] Search functions FossilOrigin-Name: 07dbe62f67eb6f452bf899c0387cd2f2f00abf9fae2597f884249611165de52b --- src/main.c | 1 + src/query.c | 1 + src/query.h | 1 + src/search.c | 24 ++++++++++++++++++++++++ src/search.h | 26 ++++++++++++++++++++++++++ static/search.html | 15 ++++++--------- 6 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 src/search.c create mode 100644 src/search.h diff --git a/src/main.c b/src/main.c index 24401f4..db73c05 100644 --- a/src/main.c +++ b/src/main.c @@ -84,6 +84,7 @@ int main(void) { "/login", content_login }, { "/test", content_test }, { "/user/:/action/:", content_account_action }, + { "/search", content_search }, { "/@:", content_account }, { "/status/create", content_status_create }, { "/status/:/interact", status_interact }, diff --git a/src/query.c b/src/query.c index ccb0af3..4e24899 100644 --- a/src/query.c +++ b/src/query.c @@ -35,6 +35,7 @@ char* read_query_data(struct get_values* query) // BEGIN Query references struct key_value_refs refs[] = { { "offset", &(query->offset) }, + { "q", &(query->q) }, }; // END Query references diff --git a/src/query.h b/src/query.h index 39f8b87..f894b13 100644 --- a/src/query.h +++ b/src/query.h @@ -50,6 +50,7 @@ struct query_values struct get_values { char* offset; + char* q; }; char* read_query_data(struct get_values* query); diff --git a/src/search.c b/src/search.c new file mode 100644 index 0000000..edc4be0 --- /dev/null +++ b/src/search.c @@ -0,0 +1,24 @@ +/* + * Treebird - Lightweight frontend for Pleroma + * Copyright (C) 2022 Nekobit + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "search.h" + +void content_search(struct session* ssn, mastodont_t* api, char** data) +{ + +} diff --git a/src/search.h b/src/search.h new file mode 100644 index 0000000..56423eb --- /dev/null +++ b/src/search.h @@ -0,0 +1,26 @@ +/* + * Treebird - Lightweight frontend for Pleroma + * Copyright (C) 2022 Nekobit + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef SEARCH_H +#define SEARCH_H +#include +#include "session.h" + +void content_search(struct session* ssn, mastodont_t* api, char** data); + +#endif /* SEARCH_H */ diff --git a/static/search.html b/static/search.html index fe009d4..d106fc6 100644 --- a/static/search.html +++ b/static/search.html @@ -1,30 +1,27 @@
-
+