treebird/src/main.c
me@ow.nekobit.net 6f4b964212 Mastodont load
FossilOrigin-Name: 834b0fd5e06c00d0cc94eb520d9efdda483eae6df8da5b7bf253205f95f56035
2022-01-20 04:45:33 +00:00

49 lines
1.3 KiB
C

/*
* RatFE - 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mastodont.h>
#include "../config.h"
#include "index.h"
int main()
{
char* path = getenv("PATH_INFO");
// Content type is always HTML
fputs("Content-type: text/html\r\n\r\n", stdout);
// Global init
mastodont_global_curl_init();
mastodont_t api;
api.url = config_instance_url;
mastodont_init(&api);
// Default index
if (path == NULL || (path && strcmp(path, "/")))
{
content_index(&api);
}
// Cleanup
mastodont_free(&api);
mastodont_global_curl_cleanup();
}