Search functions

FossilOrigin-Name: 07dbe62f67eb6f452bf899c0387cd2f2f00abf9fae2597f884249611165de52b
This commit is contained in:
me@ow.nekobit.net 2022-04-06 01:56:11 +00:00
parent 1f0272899a
commit 96118307e3
6 changed files with 59 additions and 9 deletions

View file

@ -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 },

View file

@ -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

View file

@ -50,6 +50,7 @@ struct query_values
struct get_values
{
char* offset;
char* q;
};
char* read_query_data(struct get_values* query);

24
src/search.c Normal file
View file

@ -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 <https://www.gnu.org/licenses/>.
*/
#include "search.h"
void content_search(struct session* ssn, mastodont_t* api, char** data)
{
}

26
src/search.h Normal file
View file

@ -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 <https://www.gnu.org/licenses/>.
*/
#ifndef SEARCH_H
#define SEARCH_H
#include <mastodont.h>
#include "session.h"
void content_search(struct session* ssn, mastodont_t* api, char** data);
#endif /* SEARCH_H */

View file

@ -1,30 +1,27 @@
<table class="search-tabs ui-table">
<tr>
<td class="search-tab btn">
<form action="%s/search" method="get">
<form action="%s/search/statuses" method="get">
<label class="pointer">
<input type="hidden" name="t" value="statuses">
<input type="hidden" name="query" value="%s">
<input type="hidden" name="q" value="%s">
<span class="search-tab-btn">Statuses</span>
<input type="submit" class="hidden">
</label>
</form>
</td>
<td class="nav-prev btn">
<form action="%s/search" method="get">
<form action="%s/search/accounts" method="get">
<label class="pointer">
<input type="hidden" name="t" value="accounts">
<input type="hidden" name="query" value="%s">
<input type="hidden" name="q" value="%s">
<span class="search-tab-btn">Accounts</span>
<input type="submit" class="hidden">
</label>
</form>
</td>
<td class="nav-next btn">
<form action="%s/search" method="get">
<form action="%s/search/hashtags" method="get">
<label class="pointer">
<input type="hidden" name="t" value="hashtags">
<input type="hidden" name="query" value="%s">
<input type="hidden" name="q" value="%s">
<span class="search-tab-btn">Hashtags</span>
<input type="submit" class="hidden">
</label>