Fix FCGX app issues

FossilOrigin-Name: 0d15195d046dd622b4b10fa5979872781b088b22f4f8528cea3a442439c9d41e
This commit is contained in:
nekobit 2022-08-24 11:53:58 +00:00
parent 8d9d537030
commit 8d225b2c86
14 changed files with 53 additions and 34 deletions

View File

@ -27,7 +27,7 @@
#include "../config.h"
#include "local_config_set.h"
#include "account.h"
#include <fcgi_stdio.h>
#include "cgi.h"
#include "global_cache.h"
#define BODY_STYLE "style=\"background:url('%s');\""

30
src/cgi.h Normal file
View File

@ -0,0 +1,30 @@
/*
* 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 IMPORT_CGI_H */
/* #define IMPORT_CGI_H */
#ifndef NO_FCGI
#include <fcgi_stdio.h>
#endif // NO_FCGI
#ifndef SINGLE_THREADED
#include <fcgiapp.h>
#endif // SINGLE_THREADED
// #endif

View File

@ -21,8 +21,7 @@
#include <stddef.h>
#include "global_perl.h"
#include "key.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
#include "request.h"
struct cookie_values

View File

@ -19,8 +19,7 @@
#ifndef HTTP_H
#define HTTP_H
#include "request.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
#define REDIRECT_303 "303 See Other"

View File

@ -23,8 +23,7 @@
#include "attachments.h"
#include "local_config.h"
#include "key.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
enum config_page
{

View File

@ -27,10 +27,9 @@
#include "../config.h"
#include "http.h"
#include <curl/curl.h>
#include <fcgi_stdio.h>
#include "cgi.h"
#include "request.h"
#define LOGIN_SCOPE "read+write+follow+push"
static void apply_access_token(REQUEST_T req, char* token)

View File

@ -44,9 +44,8 @@
#include "local_config_set.h"
#include "global_cache.h"
#include "conversations.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "request.h"
#include "cgi.h"
#define THREAD_COUNT 20

View File

@ -19,11 +19,10 @@
#ifndef NOTIFICATIONS_H
#define NOTIFICATIONS_H
#include <mastodont.h>
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "session.h"
#include "path.h"
#include "global_perl.h"
#include "cgi.h"
// Page contents
void content_notifications(PATH_ARGS);

View File

@ -22,8 +22,7 @@
#include <mastodont.h>
#include "path.h"
#include "session.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
void content_config_appearance(PATH_ARGS);
void content_config_general(PATH_ARGS);

View File

@ -22,8 +22,7 @@
#include <mastodont.h>
#include <stddef.h>
#include "env.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
#include "request.h"
#define PATH_ARGS REQUEST_T req, struct session* ssn, mastodont_t* api, char** data

View File

@ -23,8 +23,8 @@
#include <unistd.h>
#include "env.h"
#include "mime.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
char* read_get_data(REQUEST_T req, struct get_values* query)
{

View File

@ -19,17 +19,14 @@
#ifndef REQUEST_H
#define REQUEST_H
#ifdef SINGLE_THREADED
#else
#endif
#ifdef SINGLE_THREADED
#define FPRINTF(str, ...) fprintf(str, __VA_ARGS__)
#define PRINTF(str) printf(str)
#define PRINTF(str) puts(str)
#define REQUEST_T void*
#else
#define FPRINTF(str, ...) FCGX_FPrintF(req->out, str, __VA_ARGS__)
#define PRINTF(str) FCGX_PrintF(req->out, str)
// If this adds a newline (it shouldn't) then this is probably
#define PRINTF(str) FCGX_PutS(req->out, str)
#define REQUEST_T FCGX_Request*
#endif

View File

@ -17,9 +17,9 @@
*/
#include <stdlib.h>
#include "search.h"
#include "http.h"
#include "helpers.h"
#include "search.h"
#include "easprintf.h"
#include "../config.h"
#include "string_helpers.h"

View File

@ -23,23 +23,23 @@
#include "path.h"
#include "session.h"
#include "base_page.h"
#include <fcgi_stdio.h>
#include <fcgiapp.h>
#include "cgi.h"
#include "request.h"
/** Wrapper for content_tl_federated */
void tl_home(FCGX_Request* req, struct session* ssn, mastodont_t* api, int local);
void tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local);
/** Wrapper for content_tl_direct */
void tl_direct(FCGX_Request* req, struct session* ssn, mastodont_t* api);
void tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api);
/** Wrapper for content_tl_federated */
void tl_public(FCGX_Request* req, struct session* ssn, mastodont_t* api, int local, enum base_category cat);
void tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat);
/** Wrapper for content_tl_list */
void tl_list(FCGX_Request* req, struct session* ssn, mastodont_t* api, char* list_id);
void tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id);
/** Wrapper for content_tl_tag */
void tl_tag(FCGX_Request* req, struct session* ssn, mastodont_t* api, char* tag);
void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag);
/* ------------------------------------------------ */
@ -78,7 +78,7 @@ void content_tl_tag(PATH_ARGS);
* @param header A header that is displayed above the timeline.
* @param show_post_box If the post box should be shown or not.
*/
void content_timeline(FCGX_Request* req,
void content_timeline(REQUEST_T req,
struct session* ssn,
mastodont_t* api,
struct mstdnt_storage* storage,