Pledge flag
FossilOrigin-Name: e28716be9707aa232727f8ffe623eb73e79a7cfbc319be5e2c1664297bf4d2a5
This commit is contained in:
parent
fa92ac39d4
commit
2cb5bf79e0
|
@ -1,5 +1,3 @@
|
|||
# NOTE: This software is not finished. Any bugs are likely noted
|
||||
|
||||
# Treebird
|
||||
|
||||
![Treebird logo](./meta/treebird.png)
|
||||
|
@ -11,8 +9,7 @@ usable enough to improve the experience with JS.
|
|||
|
||||
Treebird uses C with FCGI, mastodont-c (library designed for Treebird, but can be used
|
||||
for other applications as well), Perl, and **optional** JavaScript for the frontend (100% functional without
|
||||
javascript, it only helps). Uses [RE:DOM](https://redom.js.org/) (2kb JS library) to assist with DOM
|
||||
creation and native JS apis. (Already bundled)
|
||||
javascript, it only helps).
|
||||
|
||||
## Why?
|
||||
|
||||
|
|
|
@ -16,6 +16,12 @@ For the following UNIX-like system, you will need the following libraries/packag
|
|||
|
||||
`# pacman -S curl base-devel perl perl-template-toolkit`
|
||||
|
||||
###### OpenBSD
|
||||
|
||||
`# pkg_add curl fcgi spawn-fcgi p5-Template cjson gmake`
|
||||
|
||||
(**Note:** Treebird supports Pledge and Unveil!)
|
||||
|
||||
###### Gentoo
|
||||
|
||||
TODO
|
||||
|
@ -24,16 +30,16 @@ TODO
|
|||
|
||||
`# pkg install p5-Template-Toolkit fcgi-devkit curl gmake`
|
||||
|
||||
---
|
||||
|
||||
Install mastodont-c. `fossil clone https://code.nekobit.net/fossil/mastodont-c`,
|
||||
`premake4 gmake`, `make`, `make install`.
|
||||
|
||||
Create a copy of `config.def.h` at `config.h`, edit the file with your information
|
||||
(Premake will remind you of this). Note that this setup will change in the
|
||||
Create a copy of `config.def.h` at `config.h`, edit the file with your
|
||||
information. Note that this setup will change in the
|
||||
future.
|
||||
|
||||
Run `premake4 gmake`. This will generate a gmake build file.
|
||||
|
||||
Then run `make`. (**hint:** Pass -j3 to speed up compilation).
|
||||
Run `make` (or `gmake`).
|
||||
|
||||
## Perl dependencies manual install
|
||||
|
||||
|
@ -82,9 +88,14 @@ spawn-fcgi in `scripts/fcgistarter.sh`.
|
|||
|
||||
An example Apache configuration is available in [treebird.apache.conf](./sample/treebird.apache.conf).
|
||||
|
||||
## OpenHTTPd / httpd(8)
|
||||
|
||||
OpenBSD's httpd config file is available. Bare in mind that `slowcgi` *WILL*
|
||||
not work (for now). Please use `spawn-fcgi`.
|
||||
|
||||
#### spawn-fcgi
|
||||
|
||||
`spawn-fcgi` can be used for both Apache and Nginx. Read the manual for it to see how to work it, or view
|
||||
`spawn-fcgi` can be used for both Apache, OpenHTTPd (httpd(8)) and Nginx. Read the manual for it to see how to work it, or view
|
||||
the testing script at `scripts/fcgistarter.sh`
|
||||
|
||||
- Please, at all costs, avoid FCGIWrap. It's caused nothing but headaches and has proved no real use other than
|
||||
|
|
21
src/login.c
21
src/login.c
|
@ -24,7 +24,8 @@
|
|||
static void
|
||||
render_login_page(REQUEST_T req,
|
||||
struct session* ssn,
|
||||
mastodont_t* api)
|
||||
mastodont_t* api,
|
||||
char const* error)
|
||||
{
|
||||
char* page;
|
||||
|
||||
|
@ -32,10 +33,9 @@ render_login_page(REQUEST_T req,
|
|||
HV* session_hv = perlify_session(ssn);
|
||||
XPUSHs(newRV_noinc((SV*)session_hv));
|
||||
XPUSHs(newRV_noinc((SV*)template_files));
|
||||
#if 0
|
||||
if (storage.error || oauth_store.error)
|
||||
mXPUSHs(newSVpv(storage.error ? storage.error : oauth_store.error, 0));
|
||||
#endif
|
||||
|
||||
if (error)
|
||||
mXPUSHs(newSVpv(error, 0));
|
||||
|
||||
PERL_STACK_SCALAR_CALL("login::content_login");
|
||||
|
||||
|
@ -72,6 +72,14 @@ request_cb_oauth_token(struct mstdnt_request_cb_data* cb_data,
|
|||
struct mstdnt_oauth_token* token = MSTDNT_CB_DATA(cb_data);
|
||||
struct path_args_data* path_data = args;
|
||||
|
||||
if (cb_data->storage.error)
|
||||
{
|
||||
debug("Error: %s", cb_data->storage.error);
|
||||
render_login_page(path_data->req, path_data->ssn, path_data->api, cb_data->storage.error);
|
||||
path_args_data_destroy(path_data);
|
||||
return MSTDNT_REQUEST_DONE;
|
||||
}
|
||||
|
||||
char const* url_link = path_data->ssn->m_args.url;
|
||||
|
||||
// Needed for PRINTF statements, will probably get removed later
|
||||
|
@ -79,7 +87,6 @@ request_cb_oauth_token(struct mstdnt_request_cb_data* cb_data,
|
|||
if (url_link)
|
||||
{
|
||||
PRINTF("Set-Cookie: instance_url=%s; Path=/; Max-Age=31536000\r\n", url_link);
|
||||
tb_free(url_link);
|
||||
}
|
||||
else {
|
||||
// Clears the cookie
|
||||
|
@ -249,7 +256,7 @@ content_login(PATH_ARGS)
|
|||
return 1;
|
||||
}
|
||||
else {
|
||||
render_login_page(req, ssn, api);
|
||||
render_login_page(req, ssn, api, NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ int main(int argc, char **argv, char **env)
|
|||
#endif
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath inet dns unveil prot_exec tmppath", "") == -1)
|
||||
if (pledge("stdio rpath inet dns unveil prot_exec", "") == -1)
|
||||
{
|
||||
perror("pledge");
|
||||
exit(2);
|
||||
|
|
Loading…
Reference in New Issue