qswiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Go to file
Albert S. 24121a1618
Makefile: Add libstdc++ assertions + randomize link order
2 weeks ago
cache fscache: Fix starts_with() broken by b41a5f4e5b 1 year ago
database database: Add missing virtual destructors for some classes 3 months ago
dynamic Add DynamicContentFactory 5 months ago
gateway gateway: httpgateway: Adjust default payload length for urlencoded content 2 months ago
handlers HandlerFeedGenerator: Don't escape title again 5 months ago
sandbox sandbox: Use exile_vows_from_str() for seccomp policy 3 months ago
setup Page: Add 'title' column, storing title of last revision 10 months ago
submodules submodules: cpp-httplib: Update 2 months ago
template/quitesimple template: Enable syntax highlighting using highlight.js 3 months ago
tests Let's make (git) history! 4 years ago
.gitignore Let's make (git) history! 4 years ago
.gitmodules sandbox: Switch to exile.h (former qssb.h) 1 year ago
Dockerfile don't link with boost anymore as regex is handled by std now 3 years ago
LICENCE Let's make (git) history! 4 years ago
Makefile Makefile: Add libstdc++ assertions + randomize link order 2 weeks ago
README.md README: update 3 months ago
TODO updated TODO 4 years ago
authenticator.cpp Remove utils::hasKey(), as we now have .contains() 1 year ago
authenticator.h Authenticator: Introduce AUTH_DEFAULT_SALT_SIZE 1 year ago
category.cpp Let's make (git) history! 4 years ago
category.h Let's make (git) history! 4 years ago
cli.cpp Database: PageDao/CategoryDao: Return 'Page' object, not pagename string 10 months ago
cli.h Add [[maybe_unused]] to silence unhelpful warnings 1 year ago
cliconsole.cpp CLIConsole: On 'exit', ask whether to quit attached instance 1 year ago
cliconsole.h Introduce CLI 1 year ago
cliserver.cpp C++20: Avoid implicit capture 1 year ago
cliserver.h Introduce CLI 1 year ago
config.cpp config: Adjust default payload length 2 months ago
config.h UrlProvider: Add Links to specify rendertype in allpages / category view 10 months ago
cookie.cpp Let's make (git) history! 4 years ago
cookie.h Let's make (git) history! 4 years ago
grouper.cpp Add Grouper: Maps a key to a vectors 10 months ago
grouper.h Add Grouper: Maps a key to a vectors 10 months ago
headline.cpp Let's make (git) history! 4 years ago
headline.h Let's make (git) history! 4 years ago
htmllink.cpp Let's make (git) history! 4 years ago
htmllink.h Let's make (git) history! 4 years ago
iparser.h Parser: Seperate parseDynamcis(), fix headline extraction with tags inside them 10 months ago
logger.cpp Let's make (git) history! 4 years ago
logger.h Let's make (git) history! 4 years ago
page.cpp Let's make (git) history! 4 years ago
page.h Page: Add 'title' column, storing title of last revision 10 months ago
pagelistrenderer.cpp Add PageListRenderer: Allow rendering pagelist by creationdate and A-Z as before 10 months ago
pagelistrenderer.h Add PageListRenderer: Allow rendering pagelist by creationdate and A-Z as before 10 months ago
parser.cpp parser: Render <code> and <blockquote> preformated 3 months ago
parser.h Parser: Add code,blockquote and begin img tag 10 months ago
permissions.cpp Permissions: Add toString() 1 year ago
permissions.h Permissions: Add toString() 1 year ago
qswiki.cpp Add [[maybe_unused]] to silence unhelpful warnings 1 year ago
random.cpp Random: Mark getRandom* const 2 years ago
random.h Random: Mark getRandom* const 2 years ago
request.cpp Request: createPairFromVar(): Explicitly decode value 10 months ago
request.h Let's make (git) history! 4 years ago
requestworker.cpp Adjust to new Template::getPage() returning value, not reference 1 year ago
requestworker.h RequestWorker: take unique ptr (fixes regression) 3 years ago
response.cpp Response: addHeader(): Pass by value, not reference 1 year ago
response.h Response: addHeader(): Pass by value, not reference 1 year ago
revision.cpp Let's make (git) history! 4 years ago
revision.h Let's make (git) history! 4 years ago
revisionrenderer.cpp Add RevisionRenderer 5 months ago
revisionrenderer.h Add RevisionRenderer 5 months ago
searchresult.h Let's make (git) history! 4 years ago
session.cpp Let's make (git) history! 4 years ago
session.h Let's make (git) history! 4 years ago
template.cpp template: Adjust after renaming: Use utils::toISODateTime() 10 months ago
template.h Template: Make loadResolvedPart() public 10 months ago
templatepage.cpp TemplatePage: Change 'content' to shared_ptr 1 year ago
templatepage.h TemplatePage: Change 'content' to shared_ptr 1 year ago
urlprovider.cpp UrlProvider: Add Links to specify rendertype in allpages / category view 10 months ago
urlprovider.h UrlProvider: Add Links to specify rendertype in allpages / category view 10 months ago
user.cpp Let's make (git) history! 4 years ago
user.h user model: added enabled column 4 years ago
utils.cpp utils: readCompleteFile(): Fix error string which is too generic without context 10 months ago
utils.h utils: Rename/Add date functions 10 months ago
varreplacer.cpp Remove utils::hasKey(), as we now have .contains() 1 year ago
varreplacer.h Let's make (git) history! 4 years ago
version.cpp Add version.{h,cpp}: Returning version info 1 year ago
version.h Add version.{h,cpp}: Returning version info 1 year ago

README.md

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