1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-01-13 19:56:40 +00:00
Commit graph

190 commits

Author SHA1 Message Date
c7545f27cf Add some missing environment variables.
Also add a description of what they're for, at least
some of them.
2017-05-14 14:51:50 +01:00
57dc0c7717 Add reason_code to string lookup. 2017-05-14 03:43:38 +01:00
ec80734625 Add http status codes and save dummy error into the mstch context. 2017-05-14 03:38:41 +01:00
4d31323bb1 Redirect to error.cgi when saving fails.
Not working yet, still getting there.
2017-05-12 22:46:54 +01:00
73707c2ad0 Revert "Pass the ResponseFactory object down to the Response itself."
This reverts commit 3bc6c56c03.
2017-05-12 22:18:03 +01:00
3bc6c56c03 Pass the ResponseFactory object down to the Response itself. 2017-05-12 09:36:01 +01:00
10da75caf5 Remove parameters from Response's constructor.
They can safely be defaulted and derived classes can
change their preferences later inside their constructor
if they need to.
2017-05-12 09:18:49 +01:00
f286507edf Delay fast subsequent pasties from the same IP. 2017-05-11 18:50:56 +01:00
9e63a648a1 Protect against fast flooding from the same ip. 2017-05-11 09:48:18 +01:00
d449781c40 Add unit test for utf8 sanitization. 2017-05-10 20:47:24 +01:00
13e46ab1e6 Replace nullchars with #.
There is also a glib-based implementation but I'm not
sure about it yet.
2017-05-10 20:45:26 +01:00
ed1343bd7b Pass the istream to read_post instead of assuming std::cin. 2017-05-10 20:42:42 +01:00
9e1e18dcf0 Set default.lang if user's lang is not found. 2017-05-08 19:48:09 +01:00
07135f215c Delete get_env, which confused me a lot.
Get raw environment variables directly from main().
Add code to split on '=' in cgi_environment_vars and only pick
the ones that are interesting, just as before.
2017-05-08 19:46:14 +01:00
376b34c1d0 Add todo comment. 2017-05-06 21:57:31 +01:00
df384f5128 Add unit test for IndexResponse. 2017-05-06 21:49:46 +01:00
f5f19350ea Make SafeStackObject implicitly up-castable. 2017-05-06 21:48:45 +01:00
cd1be59cfa Pass the output stream and cgi_env to Response.
Mask the fact that they are globals, because I need
to be able to pass different classes in order to be
able to write unit tests for response classes.
2017-05-06 19:48:44 +01:00
8980a1d1ff I don't really need to store the page name in the base class. 2017-05-06 19:16:57 +01:00
ebed6fd1d4 Fix unit test for IniParser.
I'm not sure why graph needs the -eol part for the
value part, hopefully I'll find out at some point.
2017-05-06 18:40:39 +01:00
5b59ca3c41 Add unit test for IniFile and improve parser.
The test still fails because for some reason the parser
doesn't want to skip the trailing spaces in values.
2017-05-06 02:01:05 +01:00
b4291becf0 Add unit test for the SettingsBag. 2017-05-05 09:48:46 +01:00
e1687c96ff Split tawashi into lib+executable to enable unit testing 2017-05-04 19:52:18 +01:00
bcb800ffef Buildfix in release 2017-05-04 19:41:18 +01:00
7646a04c51 Add user agent cgi variable. 2017-05-04 10:22:43 +01:00
c41e7ce65f Add more logging 2017-05-04 10:00:49 +01:00
92d8f1f73c Make logging level configurable in tawashi.ini. 2017-05-04 09:59:49 +01:00
c892ed2df8 Add logging lib spdlog. 2017-05-03 09:31:41 +01:00
73323c9ee7 Add plain text mode 2017-04-27 09:33:47 +01:00
457127aa04 Rename built binary to tawashi.cgi
Also copy html dir when doing make install.
2017-04-26 20:52:52 +01:00
4a57181ff6 Version bump to v0.1.3 2017-04-26 20:15:13 +01:00
3191203bfd Tell the browser returned plain text is utf8. 2017-04-26 20:12:59 +01:00
fbc9afc81c Remove invalid utf8 sequences from GET and POST. 2017-04-26 20:12:59 +01:00
f2bee62f0e Add utfcpp 2.3.4 to the project. 2017-04-26 20:02:49 +01:00
5377d25c72 Simplify the response pipeline.
There is no on_send() anymore, instead responses can
override the way the top-level mustache file is retrieved.
2017-04-26 09:17:57 +01:00
298aedc633 Version bump to v0.1.2 2017-04-25 22:56:35 +01:00
06920f8d84 Return pasties into a proper html page.
I don't think html escaping is needed, since pasties
go through the colorizer first.

I don't really like the workaround to not call on_send() when
I don't want the html output, it's a bit omg what's going on
there... I'll have to rewrite that bit.
2017-04-25 22:56:19 +01:00
54e737c171 Escape html in non-plaintext responses. 2017-04-25 22:09:46 +01:00
8a23dc1add An empty GET is synonym of m=plain 2017-04-25 22:09:46 +01:00
85784d231d Use houdini escaping instead of easy_curl.
Drop dependency on easy_curl.
2017-04-25 22:09:46 +01:00
c75c23fa36 Import houdini lib.
Will replace curl dependency soon.
2017-04-25 22:09:45 +01:00
b423522af8 Enable language and expiry in pasties. 2017-04-25 00:21:44 +01:00
9232644cbb I missed this in a previous commit - take the setting from the SettingsBag. 2017-04-25 00:10:50 +01:00
3e60ea4183 Escape any html from pasties before sending the response. 2017-04-24 19:41:38 +01:00
3c10d624e3 Allow users to specify min/max valid pastie sizes. 2017-04-24 19:09:43 +01:00
79e82e2489 Do the str to int conversion in the SettingsBag. 2017-04-24 18:55:04 +01:00
fe53ea7ea1 Implement as_str() and as_ref() as template as<>().
Also provide a commodity at() that is a synonym
for as<boost::string_ref>() but much shorter to type.
2017-04-24 09:25:04 +01:00
34e69d0b52 Version bump to 0.1.1 2017-04-23 15:06:36 +01:00
eebcfb4157 Set default html path to "", not "html". 2017-04-23 13:58:06 +01:00
0add0720d5 Add langmap_dir setting.
Allows users to specify the path to the langmap dir for
source-highlight.
2017-04-23 13:57:49 +01:00
fb4d99d62b Add as_str() and as_ref() convenience methods to SettingsBag.
as_ref() does the same as operator[], but it's nicer to
type when settings bag is a pointer.
2017-04-23 13:54:06 +01:00
75674525de Response keeps a ptr to the SettingsBag now. 2017-04-23 13:40:48 +01:00
6c5497ae49 Redirect to base_uri, not to localhost 2017-04-23 13:08:27 +01:00
26aa51c3be Add a redis_db setting to the ini file. 2017-04-21 23:26:01 +01:00
b03c3198b8 Make a SettingsBag class that wraps the ini settings.
Easily allows to have default values for options
that are not specified in the loaded ini file.
2017-04-21 23:10:16 +01:00
34b4588481 Fix operator* 2017-04-21 22:56:44 +01:00
1bc059bfe4 Export the list of supported languages to mustache. 2017-04-21 22:18:43 +01:00
73c3d2f04d Use partials in html. 2017-04-21 19:01:13 +01:00
00aa06282d Set the html root from the config file. 2017-04-18 20:10:36 +01:00
1870829ec2 Import lib mstch and put it to good use.
Response classes are given a chance to modify the
dictionary that is later sent to mstch.
2017-04-18 18:40:42 +01:00
680f13e1f6 Refactoring.
IncRedis is now held by Response, if requested by the base class.
Response objects know their names, and they use it to load
the html (soon to be mustache) data from disk.
Main only prepares a factory, the factory then instantiates
the actual Response.
The code now correctly serves index.cgi when the request is /.
Remove kakoune's safe_ptr from inside src and put an updated
one in lib/kakoune.
2017-04-15 03:18:33 +01:00
4bf8dfc29f Enable the redis_mode option in tawashi.ini 2017-04-14 00:50:50 +01:00
b61465476b Add install command 2017-04-11 19:47:05 +01:00
da2484b0d4 Use base_uri in the response 2017-04-11 19:36:18 +01:00
41e1d35c7a Make ini parser use a map of string_ref
It is important that you keep your IniFile object around
if you access stuff in the map returned by parsed() at this
point.
2017-04-11 18:32:43 +01:00
2dd4ebe515 Load redis parameters from config file. 2017-04-11 18:19:19 +01:00
6a6d4c85bb Import pathname from dindexer. 2017-04-11 18:10:19 +01:00
aef2210f6d Add tawashiConfig.h.in with default paths. 2017-04-11 08:30:22 +01:00
f331113be8 Add parser for ini file 2017-04-10 22:37:22 +01:00
ed25d60351 Use source-highlight library for syntax colorizing. 2017-04-07 23:57:32 +01:00
ef9e74c473 Redirect to the new page if pastie was successful. 2017-04-07 00:31:06 +01:00
4354f4bf29 Add GPL3 licence. 2017-04-06 23:35:06 +01:00
31890ba5e4 Allow retrieval of pasties 2017-04-06 23:28:57 +01:00
091746e9b6 Disable debug output 2017-04-06 23:11:11 +01:00
2b54349e0e Rename envy to cgi_environment_vars. 2017-04-06 23:05:08 +01:00
81cf36de22 Rename CGIEnv to cgi::Env 2017-04-06 23:02:17 +01:00
fa33944919 Unescape + to space correctly 2017-04-06 22:57:44 +01:00
33c52b88d5 Rename submit form to submit paste. 2017-04-06 22:45:44 +01:00
dbd1a3a90a Submitting a paste and saving to redis works! 2017-04-06 22:42:43 +01:00
e32cecedba Print to stderr otherwise it disturbs the response. 2017-04-06 21:47:28 +01:00
98d98fc4ba Step up work on responses. 2017-04-06 21:27:38 +01:00
cc20a8ccfb Add CurlWrapper class and use it to escape GET/POST values.
Use the new code to print the values from the request.
2017-04-06 20:15:44 +01:00
6a502df135 New free function to get POST values. 2017-04-06 20:12:44 +01:00
e9d54c3ff5 Rename function. 2017-04-05 20:32:46 +01:00
cd72d374c5 query_string() should return the raw GET string. 2017-04-05 20:07:42 +01:00
3fb4df637e A basic implementation of make_token().
Simply converts the given number into base 26.
2017-04-05 20:04:21 +01:00
5ed8e782aa The environment never changes so these functions can be pure. 2017-04-05 09:29:02 +01:00
3df7a4c5d3 Implement code that splits version infos.
According to the docs, the version info is
something like LALALA/X.X with X being a single digit.
2017-04-05 09:25:25 +01:00
f8d6796fc1 Wrap environment in a class. 2017-04-05 08:41:49 +01:00
fea5b738df First commit 2017-04-04 20:58:40 +01:00