diff --git a/include/mastodont_types.h b/include/mastodont_types.h index 6bd6100..83a0c3a 100644 --- a/include/mastodont_types.h +++ b/include/mastodont_types.h @@ -25,11 +25,8 @@ typedef unsigned char mstdnt_bool; #define MSTDNT_FLAG_NO_URI_SANITIZE (1<<0) -#define MSTDNT_FLAG_SSL_NONE (1<<1) #define MSTDNT_FLAG_SSL_UNVERIFIED (1<<2) -#define MSTDNT_FLAG_SSL_EXPIRED (1<<3) -#define MSTDNT_FLAG_SSL_SELFSIGNED (1<<4) -#define MSTDN_FLAG_ISSET(flags, flag) (((flags) & (flag)) == (flag)) +#define MSTDNT_FLAG_ISSET(flags, flag) (((flags) & (flag)) == (flag)) #define MSTDNT_T_FLAG_ISSET(flag_ref, flag) (((flag_ref->flags) & (flag)) == (flag)) typedef struct mastodont diff --git a/src/fetch.c b/src/fetch.c index 8f84454..fcf1f6f 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -43,7 +43,6 @@ void mastodont_fetch_results_cleanup(struct mstdnt_fetch_results* res) free(res->response); } -#include #define TOKEN_STR_SIZE 512 int mastodont_fetch_curl(mastodont_t* mstdnt, char* _url, @@ -72,6 +71,11 @@ int mastodont_fetch_curl(mastodont_t* mstdnt, curl_easy_setopt(mstdnt->curl, CURLOPT_URL, url); curl_easy_setopt(mstdnt->curl, CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt(mstdnt->curl, CURLOPT_WRITEDATA, results); + /* Should we verify the peer's SSL cert? */ + curl_easy_setopt(mstdnt->curl, CURLOPT_SSL_VERIFYPEER, + !MSTDNT_T_FLAG_ISSET(mstdnt, MSTDNT_FLAG_SSL_UNVERIFIED)); + curl_easy_setopt(mstdnt->curl, CURLOPT_SSL_VERIFYHOST, + !MSTDNT_T_FLAG_ISSET(mstdnt, MSTDNT_FLAG_SSL_UNVERIFIED)); /* PUT, POST, GET */ curl_easy_setopt(mstdnt->curl, request_t, 1); diff --git a/src/navigation.c b/src/navigation.c new file mode 100644 index 0000000..870eff3 --- /dev/null +++ b/src/navigation.c @@ -0,0 +1,34 @@ +/* + * 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 "navigation.h" + +#include "easprintf.h" + +// Pages +#include "../static/navigation.chtml" + +char* construct_navigation_box(char* prev_id, char* next_id, size_t size) +{ + char* nav_html; + + size_t s = easprintf(&nav_html, data_navigation_html, + prev_id, + next_id); + if ( +} diff --git a/src/navigation.h b/src/navigation.h new file mode 100644 index 0000000..b3ada73 --- /dev/null +++ b/src/navigation.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 NAVIGATION_H +#define NAVIGATION_H +#include +#include + +char* construct_navigation_box(char* prev_id, char* next_id, size_t size); + +#endif // NAVIGATION_H