Albert S
882871c34f
In combination with musl, parser crashed. glibc fine. Could not pinpoint down the exact reason mainly due to time constraints. Strange, in both cases actually libstdc++ is used, so this is very odd. |
||
---|---|---|
cache | ||
database | ||
gateway | ||
handlers | ||
setup | ||
template | ||
tests | ||
.gitignore | ||
category.cpp | ||
category.h | ||
config.cpp | ||
config.h | ||
cookie.cpp | ||
cookie.h | ||
headline.cpp | ||
headline.h | ||
htmllink.cpp | ||
htmllink.h | ||
iparser.h | ||
LICENCE | ||
logger.cpp | ||
logger.h | ||
Makefile | ||
page.cpp | ||
page.h | ||
parser.cpp | ||
parser.h | ||
permissions.cpp | ||
permissions.h | ||
qswiki.cpp | ||
random.cpp | ||
random.h | ||
README.md | ||
request.cpp | ||
request.h | ||
requestworker.cpp | ||
requestworker.h | ||
response.cpp | ||
response.h | ||
revision.cpp | ||
revision.h | ||
searchresult.h | ||
session.cpp | ||
session.h | ||
template.cpp | ||
template.h | ||
templatepage.cpp | ||
templatepage.h | ||
TODO | ||
urlprovider.cpp | ||
urlprovider.h | ||
user.cpp | ||
user.h | ||
utils.cpp | ||
utils.h | ||
varreplacer.cpp | ||
varreplacer.h |
qswiki
About
qswiki is a wiki software, intended for small wikis. Originally implemented in C, it's now written in C++.
History
A couple of years ago, I wanted to setup a personal wiki on my raspberry pi. However, the distribution I used back then did not have a PHP package for ARM. So I decided I would write one in C. Yes, that's an odd way to approach the problem and indeed, I may have had too much time back then. Also, I wanted to see how it's like to write a "web app" in C and wanted to sharpen my C a little bit.
Of course, it's pretty straightforward at first. No really. Just use CGI. And indeed, that's probably more than enough. Then I decided to play around and started using FastCGI (with the official library from now defunct fastcgi.com) and created a multi-threaded version. It initially used a "pile of files database", but that became too painful, so then I started using sqlite.
C++
Eventually the code became unmaintainable. Initially, I wanted something quick. I did not care about memory leaks (as it was CGI initially). After FastCGI, they became an issue. In the end, the task of avoiding memory leaks became too annoying. And of course, C does not include any "batteries" and while I could manage, this too was another good reason.
Overall, I am just continuing the experiment with C++17 now. It's not nearly as bad as you would expect perhaps. Some things are surprisingly convenient even. Still, the standard library is lacking and I would hope for a some better built-in Unicode support in the future.
Features
To be fair, at this point it doesn't even have a "diff" between revisions yet and does not have features that make you prefer it over other wikis.
- CGI
- HTTP server using the header only library cpp-httplib. It's more portable and more "future-proof" than FastCGI (since the official website disappeared, the library's future appears to be uncertain).
- Support for user accounts. Passwords are stored using PBKDF2. sqlite database, but not too much of an effort to add other types of storage backends. sqlite is using the great header only library sqlite_modern_cpp
- Relatively fine-grained permission system.
- Categories
- Templates
- FTS search
- Caching
Security
The most reasonable way would have been to add some sort sandboxing support right away, but this is lacking so far. As for "web security", all POST requests are centrally protected against CSRF attacks and all input is escaped against XSS attacks.
Building
Dependencies:
- cpp-httplib: https://github.com/yhirose/cpp-httplib
- SqliteModernCpp: https://github.com/SqliteModernCpp
Given the fact those are header-only libraries, they are already included here, so you only need to run:
make release
Setup
To be written