Load page, config

FossilOrigin-Name: f4af357f387db21585ed5e0a171060e87ab4c9c7c6d954b63294f596f91d63d2
This commit is contained in:
me@ow.nekobit.net 2022-01-17 01:44:27 +00:00
parent e4a001837a
commit 4ba9eaaafc
6 changed files with 94 additions and 7 deletions

View file

@ -11,13 +11,13 @@ all: $(TARGET)
$(TARGET): filec $(OBJ)
$(CC) -o $(DIST)$(TARGET) $(LDFLAGS) $(OBJ)
$(OBJ): $(SRC)
$(CC) $(CFLAGS) -c $< -o $@
filec: src/file-to-c/main.o
$(CC) -o file-to-c $<
src/file-to-c/main.o: src/file-to-c/main.c
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: all
clean:
rm -f $(OBJ) src/file-to-c/main.o
.PHONY: all filec clean

16
config.h Normal file
View file

@ -0,0 +1,16 @@
/*
* This is the config file for RatFE. Any changes you make here requires
* a recompile, but RatFE shouldn't take long to compile ;)
*
* You don't need to understand C, I've created simple types to represent
* what you need to set without any C knowledge.
*/
#ifndef CONFIG_H
#define CONFIG_H
#define FALSE 0
#define TRUE 1
static const char* config_canonical_name = "RatFE";
#endif // CONFIG_H

25
src/index.c Normal file
View file

@ -0,0 +1,25 @@
/*
* 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 "index.h"
void content_index()
{
printf("Index.html\r\n");
}

24
src/index.h Normal file
View file

@ -0,0 +1,24 @@
/*
* 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/>.
*/
#ifndef INDEX_H
#define INDEX_H
void content_index();
#endif // INDEX_H

View file

@ -17,8 +17,19 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "index.h"
int main(void)
int main()
{
printf("Content-type: text/html\r\n\r\n<h1>Release the rats</h1>");
char* path = getenv("PATH_INFO");
// Content type is always HTML
fputs("Content-type: text/html\r\n\r\n", stdout);
// Default index
if (path == NULL || (path && strcmp(path, "/")))
{
content_index();
}
}

11
static/index.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>%s</title>
</head>
<body>
<div class="content">
</div>
</body>
</html>