qswiki
Iet uz failu
2023-01-16 20:43:34 +01:00
cache fscache: Fix starts_with() broken by b41a5f4e5b 2021-11-30 19:14:59 +01:00
database database: Add missing virtual destructors for some classes 2022-10-24 15:17:04 +02:00
dynamic Add DynamicContentFactory 2022-08-20 10:24:23 +02:00
gateway gateway: httpgateway: Adjust default payload length for urlencoded content 2022-12-13 10:16:30 +01:00
handlers HandlerFeedGenerator: Don't escape title again 2022-08-20 12:57:54 +02:00
sandbox sandbox: Use exile_vows_from_str() for seccomp policy 2022-10-23 21:36:58 +02:00
setup Page: Add 'title' column, storing title of last revision 2022-03-27 09:23:35 +02:00
submodules submodules: cpp-httplib: Update 2022-12-13 10:18:10 +01:00
template/quitesimple template: Enable syntax highlighting using highlight.js 2022-11-08 08:48:22 +01:00
tests Let's make (git) history! 2018-11-03 17:12:20 +01:00
.gitignore Let's make (git) history! 2018-11-03 17:12:20 +01:00
.gitmodules sandbox: Switch to exile.h (former qssb.h) 2021-12-02 10:15:11 +01:00
authenticator.cpp Remove utils::hasKey(), as we now have .contains() 2021-10-19 12:48:45 +02:00
authenticator.h Authenticator: Introduce AUTH_DEFAULT_SALT_SIZE 2021-10-03 17:01:03 +02:00
category.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
category.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
cli.cpp Database: PageDao/CategoryDao: Return 'Page' object, not pagename string 2022-04-03 11:15:02 +02:00
cli.h Add [[maybe_unused]] to silence unhelpful warnings 2021-10-25 17:56:37 +02:00
cliconsole.cpp CLIConsole: On 'exit', ask whether to quit attached instance 2021-10-10 20:15:28 +02:00
cliconsole.h Introduce CLI 2021-10-03 17:05:46 +02:00
cliserver.cpp C++20: Avoid implicit capture 2021-10-25 18:09:46 +02:00
cliserver.h Introduce CLI 2021-10-03 17:05:46 +02:00
config.cpp config: Adjust default payload length 2022-12-13 10:17:40 +01:00
config.h UrlProvider: Add Links to specify rendertype in allpages / category view 2022-04-03 11:15:02 +02:00
cookie.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
cookie.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
Dockerfile don't link with boost anymore as regex is handled by std now 2020-04-19 17:02:21 +02:00
grouper.cpp Add Grouper: Maps a key to a vectors 2022-04-03 11:05:13 +02:00
grouper.h Add Grouper: Maps a key to a vectors 2022-04-03 11:05:13 +02:00
headline.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
headline.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
htmllink.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
htmllink.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
iparser.h Parser: Seperate parseDynamcis(), fix headline extraction with tags inside them 2022-03-29 22:35:45 +02:00
LICENCE Let's make (git) history! 2018-11-03 17:12:20 +01:00
logger.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
logger.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
Makefile Makefile: Add libstdc++ assertions + randomize link order 2023-01-16 20:43:34 +01:00
page.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
page.h Page: Add 'title' column, storing title of last revision 2022-03-27 09:23:35 +02:00
pagelistrenderer.cpp Add PageListRenderer: Allow rendering pagelist by creationdate and A-Z as before 2022-04-03 11:06:19 +02:00
pagelistrenderer.h Add PageListRenderer: Allow rendering pagelist by creationdate and A-Z as before 2022-04-03 11:06:19 +02:00
parser.cpp parser: Render <code> and <blockquote> preformated 2022-11-08 08:47:53 +01:00
parser.h Parser: Add code,blockquote and begin img tag 2022-04-19 19:50:22 +02:00
permissions.cpp Permissions: Add toString() 2021-10-03 17:01:48 +02:00
permissions.h Permissions: Add toString() 2021-10-03 17:01:48 +02:00
qswiki.cpp Add [[maybe_unused]] to silence unhelpful warnings 2021-10-25 17:56:37 +02:00
random.cpp Random: Mark getRandom* const 2021-04-18 13:35:43 +02:00
random.h Random: Mark getRandom* const 2021-04-18 13:35:43 +02:00
README.md README: update 2022-10-30 11:30:27 +01:00
request.cpp Request: createPairFromVar(): Explicitly decode value 2022-03-30 22:59:20 +02:00
request.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
requestworker.cpp Adjust to new Template::getPage() returning value, not reference 2021-10-08 00:11:58 +02:00
requestworker.h RequestWorker: take unique ptr (fixes regression) 2019-09-29 21:34:21 +02:00
response.cpp Response: addHeader(): Pass by value, not reference 2021-10-10 20:15:28 +02:00
response.h Response: addHeader(): Pass by value, not reference 2021-10-10 20:15:28 +02:00
revision.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
revision.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
revisionrenderer.cpp Add RevisionRenderer 2022-08-20 12:30:47 +02:00
revisionrenderer.h Add RevisionRenderer 2022-08-20 12:30:47 +02:00
searchresult.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
session.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
session.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
template.cpp template: Adjust after renaming: Use utils::toISODateTime() 2022-03-27 08:30:20 +02:00
template.h Template: Make loadResolvedPart() public 2022-03-27 08:30:51 +02:00
templatepage.cpp TemplatePage: Change 'content' to shared_ptr 2021-10-10 22:32:13 +02:00
templatepage.h TemplatePage: Change 'content' to shared_ptr 2021-10-10 22:32:13 +02:00
TODO updated TODO 2018-11-10 22:44:26 +01:00
urlprovider.cpp UrlProvider: Add Links to specify rendertype in allpages / category view 2022-04-03 11:15:02 +02:00
urlprovider.h UrlProvider: Add Links to specify rendertype in allpages / category view 2022-04-03 11:15:02 +02:00
user.cpp Let's make (git) history! 2018-11-03 17:12:20 +01:00
user.h user model: added enabled column 2019-05-03 15:56:16 +02:00
utils.cpp utils: readCompleteFile(): Fix error string which is too generic without context 2022-04-03 11:07:26 +02:00
utils.h utils: Rename/Add date functions 2022-03-27 08:29:13 +02:00
varreplacer.cpp Remove utils::hasKey(), as we now have .contains() 2021-10-19 12:48:45 +02:00
varreplacer.h Let's make (git) history! 2018-11-03 17:12:20 +01:00
version.cpp Add version.{h,cpp}: Returning version info 2021-10-03 23:01:19 +02:00
version.h Add version.{h,cpp}: Returning version info 2021-10-03 23:01:19 +02:00

qswiki

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 for ARM. So instead of switching distributions or searching for other 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 "web app" in C and wanted to sharpen my C skills a little bit.

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 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, 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 task of avoiding memory leaks became too annoying. And of course, C does n ot 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 future C++ standards.

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.

  • 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
  • Blog-like functionality
  • RSS/Atom feeds

Security

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 attacks.

Building

Dependencies:

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.

If all dependencies are available, run:

  git submodule init
  git submodule update
  make release

Setup

To be written