2018-11-03 17:12:20 +01:00
|
|
|
# qswiki
|
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
## About
|
|
|
|
qswiki is a wiki software, intended for my needs. Originally implemented in C, it's now written in C++.
|
|
|
|
|
|
|
|
## Dude... why?
|
|
|
|
|
|
|
|
tl;dr: It was a playground, an experiment (taken too far). I guess at some point I couldn't stop, because I've already
|
|
|
|
started.
|
|
|
|
|
|
|
|
### History
|
|
|
|
Several 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
|
2019-08-11 20:10:38 +02:00
|
|
|
for ARM. So instead of switching distributions or searching for other
|
2022-10-30 11:30:27 +01:00
|
|
|
wikis that I could use, I simply 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
|
2019-08-11 20:10:38 +02:00
|
|
|
"web app" in C and wanted to sharpen my C skills a little bit.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
Of course, it's pretty straightforward at first. No really: Just use CGI
|
|
|
|
and print your HTML to stdout.And indeed, that would have been more than enough for my use cases.
|
|
|
|
|
|
|
|
But then I decided to play around and started using FastCGI (with the official
|
2019-08-11 20:10:38 +02:00
|
|
|
library from now defunct fastcgi.com) and created a multi-threaded version.
|
2022-10-30 11:30:27 +01:00
|
|
|
It initially used a "pile of files database", but that became too painful,
|
2019-08-11 20:10:38 +02:00
|
|
|
so then I started using sqlite.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
|
|
|
C++
|
|
|
|
---
|
2022-10-30 11:30:27 +01:00
|
|
|
Eventually, since it was mostly a playground for me, the code became
|
|
|
|
unmaintainable. Furthermore, I initially wanted something quick and given that
|
|
|
|
it was CGI, I didn't bother taking care of memory leaks.
|
|
|
|
After initiating a FastCGI interface, they became an issue and then the
|
2019-08-11 20:10:38 +02:00
|
|
|
task of avoiding memory leaks became too annoying. And of course, C does n
|
2022-10-30 11:30:27 +01:00
|
|
|
ot include any "batteries" and while I could manage, this too was another
|
2019-08-11 20:10:38 +02:00
|
|
|
good reason.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
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 future C++
|
2019-08-11 20:10:38 +02:00
|
|
|
standards.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
|
|
|
|
## Features
|
|
|
|
Some essential features are lacking, such as a diff between revisions,
|
|
|
|
user registration UI, etc.
|
|
|
|
|
|
|
|
It doesn't compete with any other software anyway.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
|
|
|
- CGI
|
2022-10-30 11:30:27 +01:00
|
|
|
- HTTP server using the header only library [cpp-httplib](https://github.com/yhirose/cpp-httplib). It's more
|
|
|
|
portable and more "future-proof" than FastCGI (since the official website
|
2018-11-03 17:12:20 +01:00
|
|
|
disappeared, the library's future appears to be uncertain).
|
|
|
|
- Support for user accounts. Passwords are stored using PBKDF2.
|
2022-10-30 11:30:27 +01:00
|
|
|
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](https://github.com/SqliteModernCpp)
|
2018-11-03 17:12:20 +01:00
|
|
|
- Relatively fine-grained permission system.
|
|
|
|
- Categories
|
|
|
|
- Templates
|
|
|
|
- FTS search
|
|
|
|
- Caching
|
2022-10-30 11:30:27 +01:00
|
|
|
- Blog-like functionality
|
|
|
|
- RSS/Atom feeds
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
## Security
|
|
|
|
[exile.h](https://github.com/quitesimpleorg/exile.h) is used
|
|
|
|
to restrict access to the files the wiki needs. It doesn't have access to other paths
|
|
|
|
in the system and the system calls that the qswiki process can make are restricted.
|
|
|
|
|
|
|
|
As for "web security", all POST requests are centrally protected against CSRF attacks and all input is escaped against XSS
|
2019-08-11 20:10:38 +02:00
|
|
|
attacks.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2022-10-30 11:30:27 +01:00
|
|
|
## Building
|
2018-11-03 17:12:20 +01:00
|
|
|
Dependencies:
|
|
|
|
- cpp-httplib: https://github.com/yhirose/cpp-httplib
|
|
|
|
- SqliteModernCpp: https://github.com/SqliteModernCpp
|
2021-12-02 10:15:11 +01:00
|
|
|
- exile.h: https://gitea.quitesimple.org/crtxcr/exile.h
|
2019-08-11 20:10:38 +02:00
|
|
|
- sqlite3: https://sqlite.org/index.html
|
2022-10-30 11:30:27 +01:00
|
|
|
|
2020-08-23 17:38:06 +02:00
|
|
|
The first three are header-only libraries that are included as a git submodule. The others must
|
|
|
|
be installed, e. g. by using your distributions standard method.
|
2018-11-03 17:12:20 +01:00
|
|
|
|
2019-08-11 20:10:38 +02:00
|
|
|
If all dependencies are available, run:
|
2020-08-23 17:38:06 +02:00
|
|
|
```
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
make release
|
|
|
|
```
|
2018-11-03 17:12:20 +01:00
|
|
|
|
|
|
|
Setup
|
|
|
|
=====
|
|
|
|
To be written
|