Go to file
Robin Malley be259dc9f4 Make makefile more normal 2023-08-16 22:04:50 +00:00
assets Allow scrolling on index page 2023-03-12 03:31:08 +00:00
conf Start work to drop spp 2023-04-06 21:27:28 +00:00
doc Lots of new documentation 2023-08-09 22:28:48 +00:00
kore_chroot Add gitignores 2020-05-17 12:10:01 -04:00
packaging/systemd Have the processes start in their own chroots 2023-03-12 16:24:22 +00:00
spec More documentation 2023-07-06 00:42:23 +00:00
src Lots of new documentation 2023-08-09 22:28:48 +00:00
tools Lots of new documentation 2023-08-09 22:28:48 +00:00
.gitignore Add some files to gitignore 2021-09-11 21:51:54 +00:00
Makefile Make makefile more normal 2023-08-16 22:04:50 +00:00
README.md Lots of new documentation 2023-08-09 22:28:48 +00:00
dh2048.pem Inital commit 2020-05-15 19:10:20 -04:00


@name .



This repository contains the source code to a pastebin clone. It was made after concerns with pastebin.com taking down certain kinds of content. SMR aims to be small, fast, and secure. It is built on top of Kore, using luajit to expose a Lua programming environment. It uses sqlite3 as it's database. SMR is implemented in about 5k SLOC. Contributions welcome.

Language files blank comment code
Lua 37 331 678 2197
HTML 22 100 0 1021
C 4 102 251 712
JavaScript 4 23 34 293
SQL 36 6 61 274
make 1 30 6 146
CSS 3 4 8 74
C/C++ Header 4 3 0 48
SUM: 111 599 1038 4765


  • Accounts (complete)
  • Comments (complete)
  • Tags (complete)
  • Search (complete)
  • Archive (complete)
  • Author biographies (complete)
  • Kore 4.2.0 (complete)
  • addon api


  • Currently, people can post comments to unlisted stories even if they don't have the correct link.
  • Find a replacement preprocessor
  • The archive is currently generated weekly from a cron job, and served syncronously. We can generate a zip file on-the-fly instead, and if the client disconnects, it's fine to drop the whole thing.
  • We can simplify a lot of error handling logic by setting sql prepared statements to reset during error unwinding.
  • We can simplify a lot of business logic by having requests parse their parameters eagerly.


If you want to contribute to this repository:

  1. Install the kore webserver(Documentation -> installation)
  2. Use a kodev create smr to create a blank kore application
  3. Install Lua and Luarocks from your package manager
  4. Use Luarocks to install the following dependencies (luarocks install <package>)
  • etlua - Lua templating, comparable to Jinja for Python
  • lpeg - Parsing Expression Grammers, used to build text parsers
  • lsqlite3 - Sqlite3 for Lua, a lightweight database
  • lua-zlib - Data compression
  1. You may need to modify conf/build.conf, I use Lua 5.1 on my development machine, but everything should still work with later versions.
  2. Install spp
  3. Clone this repository into the smr folder, cd into the root, and run make!
  • You may need to modify the configuration in the Makefile, add test.monster to your /etc/hosts, modify command invocation, ect.

Folder layout

While the core business logic of SMR is kept under 5k SLOC, tests, documentation, and other resources exceed this limit. The following is an explanation of what goes where:

  assets/ - kore assets, compiled into the binary. Javascript and CSS are kept here.
  cert/ - kore certificates. This is a default to get you started, but in production you should set certificates appropriately.
  conf/ - kore configuration. See https://docs.kore.io/4.2.0/applications/koreconf.html
  doc/ - documentation for smr that doesn't belong to any particular file
  kore_chroot/ - a chroot to get you started modifying smr. In production this should be a properly configured chroot
  packaging/ - scripts for packaging smr for different systems
  spec/ - unit and system tests for smr
  src/ - all the business logic of smr
    lua/ - Lua shared code between endpoints
      endpoints/ - 1-per endpoint business logic
    pages/ - Etlua templated html, exposed from src/lua/pages.lua
    sql/ - Sqlite queries, exposed from src/lua/queries.lua
  tools/ - command line tools for working with the smr database
    accounts/ - tool for modifying author accounts
    archive/ - tool for generating archives of the site (NOT the same as backups)
    migrate/ - tool for migrating/upgrading the smr database

Misc. notes

SMR requires a slightly modified version of Kore to run. See my kore patches for the changes I needed to make to get the JIT compiler playing nice with Kore's seccomp restrictions. There are a few other changes, like modified kore to accept any text as input for things like file upload.

UPDATE (12/18/2020)

Kore 4.0 no longer needs the seccomp changes, as those have been exposed to library users, and smr has been updated appropriately. It still needs the allow-multiline-input patch though.