Pastelyst is an easy to use and expandable web paste tool built with Cutelyst and KDE Frameworks 5 Syntax Highlighting. It uses less than 3 MB of RAM and renders quickly using a SQLite DB for the storage.
Pastelyst is almost feature complete and on production at paste.cutelyst.org. You can grab the code and deploy your own paste tool now. And please don't forget to contribute to adding these extra features if you have time:
The list is short and the code is clean, go test, break, hack, and have fun!
Create an INI file like pastelyst.conf with:
[Cutelyst]
DatabasePath = /var/tmp/my_site_data/pastelyst.sqlite
production = true
social = true
download = true
clipboard = true
Where:
You can run it with cutelyst-wsgi or uWSGI, both have similar command line options, and you should look at their documentation to know their options, the simplest one:
cutelyst-wsgi2 --application path/to/libPastelyst.so --http-socket :3000 --ini pastelyst.conf --chdir parent_of_root_dir --static-map /static=root/static
The chdir needs to point to the parent of the root directory that came from this project. The option --static-map
is used to serve the static files.
Now point your browser to http://localhost:3000
Pastelyst also provides an API. Using the API, you can create your own applications based on Pastelyst or use Pastelyst from terminal. For details see Creating RESTful applications with Qt and Cutelyst, Understanding And Using REST APIs, and POST Form Data with cURL.
curl -H "Content-Type: application/json" -X POST https://paste.cutelyst.org/api/json/list/1
{"result":{"count":15,"pages":0,"pastes":["hW7BwGCNS","7B6G5HJNT","l_Zo9VaRT","f_9z4b-_T","YnsDOFIRR","pu0h5ftsT"
curl -H "Content-Type: application/json" -X POST https://paste.cutelyst.org/api/json/list/2
{"result":{"count":15,"pages":0,"pastes":[]}}
curl -H "Content-Type: application/json" -X POST https://paste.cutelyst.org/api/json/show/pu0h5ftsT
{"result":{"data":"#include <iostream>\r\n\r\nint main() {\r\n std::cout << \"hello\\n\";\r\n return 0;\r\n}","id":"pu0h5ftsT","language":"C++","timestamp":1503821618,"title":"Test"}}
curl -H "Content-Type: application/json" -X POST https://paste.cutelyst.org/api/json/show/STIdv05VREeht/1234567890
{"result":{"data":"my hidden text is here.","id":"STIdv05VREeht","language":"text","timestamp":1547050001,"title":"API test 1"}}
curl -X POST http://localhost:3000/api/json/create -F 'data=echo "Hello World!"' -F 'language=Bash' -F 'title=API Test'
{"result":{"id":"m2TvYu2sQ"}}
curl -X POST http://localhost:3000/api/json/create -F 'data=echo "Hello World!"' -F 'language=Bash' -F 'title=API Test' -F 'password=1234567890'
{"result":{"id":"tMQD52pdRCe3K"}}
Pastelyst was initially developed by Daniel Nicoletti and announced on August 25, 2017 on cutelyst.org. Sticklyst, which was chosen as the project name, was later replaced by Pastelyst.