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.
 
 
 
 
 
Albert S. 95604a6db3 Update git submodules 1 week ago
cache Begin sandboxing support, README updates. 1 year ago
database get header-only library dependencies using git submodules 6 months ago
gateway get header-only library dependencies using git submodules 6 months ago
handlers handlerlogin: Fix typo in error message 3 weeks ago
sandbox remove spaces etc. at end of line (no functional change) 11 months ago
setup user model: added enabled column 1 year ago
submodules Update git submodules 1 week ago
template/quitesimple template/quitesimple: footer: Don't show login and edit time in portrait mode 3 weeks ago
tests remove spaces etc. at end of line (no functional change) 11 months ago
.gitignore Let's make (git) history! 1 year ago
.gitmodules gitmodules: update qssb.h repo location 3 weeks ago
Dockerfile don't link with boost anymore as regex is handled by std now 5 months ago
LICENCE Let's make (git) history! 1 year ago
Makefile Makefile: remove redundancies 5 months ago
README.md Update README.md: Document build with git submodules 3 weeks ago
TODO updated TODO 1 year ago
category.cpp Let's make (git) history! 1 year ago
category.h Let's make (git) history! 1 year ago
config.cpp make html <title></title> configurable 11 months ago
config.h make html <title></title> configurable 11 months ago
cookie.cpp Let's make (git) history! 1 year ago
cookie.h Let's make (git) history! 1 year ago
headline.cpp Let's make (git) history! 1 year ago
headline.h Let's make (git) history! 1 year ago
htmllink.cpp Let's make (git) history! 1 year ago
htmllink.h Let's make (git) history! 1 year ago
iparser.h Parser: Function to exstract 'commands'/attributes (e. g. visible, renaming) 1 year ago
logger.cpp Let's make (git) history! 1 year ago
logger.h Let's make (git) history! 1 year ago
page.cpp Let's make (git) history! 1 year ago
page.h Page: add id field 1 year ago
parser.cpp replace boost regex with std 6 months ago
parser.h don't link with boost anymore as regex is handled by std now 5 months ago
permissions.cpp Permissions: Fix missing initialization with 0 in some cases 11 months ago
permissions.h Permissions: Fix missing initialization with 0 in some cases 11 months ago
qswiki.cpp RequestWorker: take unique ptr (fixes regression) 11 months ago
random.cpp Let's make (git) history! 1 year ago
random.h random: cleanup, assume getrandom libc wrapper exists 5 months ago
request.cpp Let's make (git) history! 1 year ago
request.h Let's make (git) history! 1 year ago
requestworker.cpp Introduce proper HandlerFactory and reduce dependencies of RequestWorker 11 months ago
requestworker.h RequestWorker: take unique ptr (fixes regression) 11 months ago
response.cpp Let's make (git) history! 1 year ago
response.h Let's make (git) history! 1 year ago
revision.cpp Let's make (git) history! 1 year ago
revision.h Let's make (git) history! 1 year ago
searchresult.h Let's make (git) history! 1 year ago
session.cpp Let's make (git) history! 1 year ago
session.h Let's make (git) history! 1 year ago
template.cpp Begin removing several dependencies on Config object 11 months ago
template.h Begin removing several dependencies on Config object 11 months ago
templatepage.cpp proper prefix in templates: wikiqs -> qswiki 1 year ago
templatepage.h Let's make (git) history! 1 year ago
urlprovider.cpp Let's make (git) history! 1 year ago
urlprovider.h Begin removing several dependencies on Config object 11 months ago
user.cpp Let's make (git) history! 1 year ago
user.h user model: added enabled column 1 year ago
utils.cpp utils: localtime is not threadsafe, use localtime_r 5 months ago
utils.h don't link with boost anymore as regex is handled by std now 5 months ago
varreplacer.cpp Let's make (git) history! 1 year ago
varreplacer.h Let's make (git) history! 1 year ago

README.md

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 instead of switching distributions or searching for other wikis that I could use, 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 skills a little bit.

Of course, it’s pretty straightforward at first. No really: Just use CGI. And indeed, that would have been more than enough for my use cases. 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 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

To be fair, at this point it doesn’t even have a “diff” between revisions yet and does not have features that would 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

On Linux namespaces are used to restrict the process to only access files it needs. It doesn’t have access to other paths in the system. In addition, Seccomp is used to restrict the syscalls the qswiki process can call. 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