Update README, config template, restructure documentation
FossilOrigin-Name: f11602e6271c422280fd8474abf2ef63ec6021e144e8359f0ff145e423ad1333
This commit is contained in:
parent
3bfedc3d32
commit
341aa3fa1a
9 changed files with 107 additions and 54 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ filec
|
|||
**/*.o
|
||||
**/*.chtml
|
||||
mastodont-c
|
||||
config.h
|
40
INSTALL.md
40
INSTALL.md
|
@ -1,40 +0,0 @@
|
|||
# Installing Treebird
|
||||
|
||||
## Compiling
|
||||
|
||||
You need the following libraries / packages:
|
||||
|
||||
- libcurl
|
||||
- Debian: `libcurl4-gnutls-dev`
|
||||
- libcjson
|
||||
- Debian: `libcjson-dev`
|
||||
- Arch: `cjson`
|
||||
- libpcre3
|
||||
- Debian: `libpcre3-dev`
|
||||
|
||||
First, edit `config.h` to your instance's liking.
|
||||
|
||||
`make` will clone the library, and compile both it and the project.
|
||||
|
||||
`make update` should be run after updating, as it ensures both the library and the project are up to date.
|
||||
|
||||
## Deploying
|
||||
|
||||
After running `make`, Treebird's files will be in the `dist/` directory. _Copy_, ***DO NOT MOVE***, **everything but treebird.cgi** of this folder to your web server. Copy `treebird.cgi` to another directory of your choosing.
|
||||
|
||||
- The example static files will be in `/var/www/treebird/`, with `treebird.cgi` in `/usr/local/bin/treebird.cgi`.
|
||||
|
||||
### Using NGINX (and uWSGI) to serve Treebird
|
||||
Treebird can be served over nginx by using a CGI server such as uwsgi.
|
||||
|
||||
#### nginx
|
||||
An example nginx configuration is available in [treebird.nginx.conf](./treebird.nginx.conf).
|
||||
* Make sure to change `example.com` to your instance's domain.
|
||||
* Make sure to change the `root` to wherever the static files are being stored
|
||||
|
||||
#### uWSGI
|
||||
uWSGI can be installed on debian with just `sudo apt isntall uwsgi`.
|
||||
|
||||
An example configuration is available in [treebird.uwsgi.ini](./treebird.uwsgi.ini). This should be copied to `/etc/uwsgi/apps-enabled/treebird.ini` on debian (and potentially other) systems.
|
||||
|
||||
##### Note: the uwsgi configuration file is currently very basic.
|
24
README.md
24
README.md
|
@ -1,16 +1,28 @@
|
|||
# Treebird
|
||||
|
||||
A pleroma frontend for cool people only.
|
||||
![Treebird logo](./meta/treebird.png)
|
||||
|
||||
A very lightweight Pleroma frontend.
|
||||
|
||||
The goal is to create a frontend that's lightweight enough to be viewed without JS, but
|
||||
usable enough to improve the experience with JS.
|
||||
|
||||
Treebird uses C with FCGI, mastodont-c (another library that complements Treebird) for
|
||||
communication, and plain JavaScript (100% optional).
|
||||
Treebird uses C with FCGI, mastodont-c (library designed for Treebird, but can be used
|
||||
for other applications as well), and plain JavaScript for the frontend (100% optional).
|
||||
|
||||
## Isn't FCGI outdated?
|
||||
## Why?
|
||||
|
||||
No.
|
||||
PleromaFE, pleroma's default frontend, uses way too much Javascript to be usable (and doesn't even support
|
||||
all of it's own API features...). BloatFE is great, but designed only around Mastodon's api, and isn't as
|
||||
modern or as lightweight as it could be. Soapbox is soapbox and does soapbox things.
|
||||
|
||||
This led me to one choice, to develop my own frontend.
|
||||
|
||||
## Compatibility
|
||||
|
||||
Treebird respects compatibility with old browsers, and thus uses HTML table layouts, which are
|
||||
supported even by most modern terminal web browsers. The core browser we aim to at least maintain compatibility
|
||||
with is Netsurf, but most other browsers like GNU Emacs EWW, elinks, render Treebird wonderfully.
|
||||
|
||||
## Credits
|
||||
|
||||
|
@ -18,4 +30,4 @@ Please view the [`CREDITS`](./CREDITS) file.
|
|||
|
||||
## Installing
|
||||
|
||||
See [INSTALL.md](./INSTALL.md)
|
||||
See [INSTALL.md](./docs/INSTALL.md) for instructions on Apache/Nginx.
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*
|
||||
* The software's recognizable name.
|
||||
*
|
||||
*
|
||||
* Example: "treebird"
|
||||
*/
|
||||
|
||||
|
@ -29,9 +28,9 @@ static char* const config_canonical_name = "treebird";
|
|||
* This MUST include a slash at the end, and the protocol (like https://) at the
|
||||
* beginning
|
||||
*
|
||||
* Example: "https://cum.desupost.soy/
|
||||
* Example: "https://shitposter.club/"
|
||||
*/
|
||||
static char* const config_instance_url = "https://desuposter.club/";
|
||||
static char* const config_instance_url = "https://my-instace.social/";
|
||||
|
||||
/*
|
||||
* String: url_prefix
|
||||
|
@ -41,7 +40,7 @@ static char* const config_instance_url = "https://desuposter.club/";
|
|||
*
|
||||
* Example: "/treebird.cgi"
|
||||
*/
|
||||
static char* const config_url_prefix = "/treebird.cgi";
|
||||
static char* const config_url_prefix = "";
|
||||
|
||||
/*
|
||||
* Bool: experimental_lookup
|
||||
|
@ -62,6 +61,6 @@ static const int config_experimental_lookup = TRUE;
|
|||
* Enables the test page which dumps all CGI cookies, useful when
|
||||
* setting up a reverse proxy
|
||||
*/
|
||||
static const unsigned config_test_page = TRUE;
|
||||
static const unsigned config_test_page = FALSE;
|
||||
|
||||
#endif // CONFIG_H
|
61
docs/INSTALL.md
Normal file
61
docs/INSTALL.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
# Installing Treebird
|
||||
|
||||
## Compiling
|
||||
|
||||
For the following GNU/Linux distributions, you will need the following libraries/packages:
|
||||
|
||||
- libcurl
|
||||
- Debian: `libcurl4-gnutls-dev`
|
||||
- Arch: `curl`
|
||||
- Void: `libcurl libcurl-devel`
|
||||
- libcjson
|
||||
- Debian: `libcjson-dev`
|
||||
- Arch: `cjson`
|
||||
- Void: `cJSON cJSON-devel`
|
||||
- libpcre
|
||||
- Debian: `libpcre3-dev`
|
||||
- Void: `libpcre2`
|
||||
- libfcgi
|
||||
- Void: `fcgi fcgi-devel`
|
||||
|
||||
Create a copy of `config.def.h` at `config.h`, edit the file with your information
|
||||
|
||||
Run `make`. This will also clone mastodont-c, and compile both it and Treebird.
|
||||
|
||||
If you `git pull` any changes, `make update` should be run after updating, as it ensures
|
||||
the library is up to date.
|
||||
|
||||
## Installation
|
||||
|
||||
- TODO?
|
||||
|
||||
Run `make install`, this might require root.
|
||||
|
||||
If this succeeds (assuming you used default variables), you can now find Treebird at the following
|
||||
|
||||
- `/usr/local/share/treebird/` - Contains CSS, images, and other meta files
|
||||
- `/usr/local/bin/treebird` - Regular executable CGI file, test it by running it as is, it'll spit HTML out!
|
||||
|
||||
### Using NGINX (and uWSGI)
|
||||
|
||||
Treebird can be served over nginx by using a CGI server such as uwsgi.
|
||||
|
||||
The example static files will be in `/var/www/treebird/`, with `treebird.cgi` at `/usr/local/bin/treebird`.
|
||||
|
||||
After running `make`, Treebird's files will be in the `dist/` directory. _Copy_, ***DO NOT MOVE***, **everything but treebird.cgi** of this folder to your web server. Copy `treebird.cgi` to another directory of your choosing.
|
||||
|
||||
#### nginx
|
||||
An example nginx configuration is available in [treebird.nginx.conf](./sample/treebird.nginx.conf).
|
||||
* Make sure to change `example.com` to your instance's domain.
|
||||
* Make sure to change the `root` to wherever the static files are being stored
|
||||
|
||||
#### uWSGI
|
||||
uWSGI can be installed on debian with just `sudo apt isntall uwsgi`.
|
||||
|
||||
An example configuration is available in [treebird.uwsgi.ini](./sample/treebird.uwsgi.ini). This should be copied to `/etc/uwsgi/apps-enabled/treebird.ini` on debian (and potentially other) systems.
|
||||
|
||||
##### Note: the uwsgi configuration file is currently very basic.
|
||||
|
||||
### Using Apache and mod_proxy_fcgi
|
||||
|
||||
TODO
|
20
docs/sample/treebird.apache.conf
Normal file
20
docs/sample/treebird.apache.conf
Normal file
|
@ -0,0 +1,20 @@
|
|||
# TODO a lot of things
|
||||
# THIS IS UNTESTED AND INCOMPLETE, ITS JUST FOR REFERENCE
|
||||
|
||||
# Give access to our directory
|
||||
<Directory "/usr/local/share/treebird/dist">
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot "/usr/local/share/treebird/dist"
|
||||
|
||||
# Intercept meta files to be loaded before proxy
|
||||
RewriteEngine on
|
||||
RewriteRule ^/(.*).css /$1.css [L]
|
||||
RewriteRule ^/(treebird\_logo|favicon).png /$1.png [L]
|
||||
|
||||
# Set PATH_INFO variable
|
||||
SetEnvIf Request_URI . proxy-fcgi-pathinfo=1
|
||||
ProxyPass / "fcgi://localhost:4000/"
|
||||
</VirtualHost>
|
|
@ -40,7 +40,7 @@ int main(void)
|
|||
// Global init
|
||||
mastodont_global_curl_init();
|
||||
|
||||
unsigned run_count = 0;
|
||||
unsigned run_count = 1;
|
||||
|
||||
// API
|
||||
for (;FCGI_Accept() >= 0; ++run_count)
|
||||
|
@ -75,8 +75,6 @@ int main(void)
|
|||
{ "/notifications", content_notifications },
|
||||
};
|
||||
|
||||
printf("Run: %d\r\n", run_count);
|
||||
|
||||
handle_paths(&api, paths, sizeof(paths)/sizeof(paths[0]));
|
||||
|
||||
// Cleanup
|
||||
|
@ -88,6 +86,8 @@ int main(void)
|
|||
// can't even think reading them
|
||||
memset(&cookies, 0, sizeof(cookies));
|
||||
memset(&post, 0, sizeof(post));
|
||||
|
||||
++run_count;
|
||||
}
|
||||
|
||||
mastodont_global_curl_cleanup();
|
||||
|
|
Loading…
Reference in a new issue