../pad
simple scratch pad sharing over the web
Clone with
git clone git://git.awl.red/neallred/pad

pad📎

Simple web-based scratch pad sharer. Written in zig, backed by sqlite. No JS in client. Supports fixed number of pad views and pads that self delete after a creator-defined time.

run locally📎

PAD_DB=$HOME/pad.db zig build run

tests📎

./if.sh

curl usage📎

As the application is completely serverside, no js, it can be used fairly easily with curl.

login:

curl -v -c /tmp/pad.cookies -X POST -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'username=user' -d 'password=pass' \
  localhost:8000/login

get pad admin page:

curl -v -b /tmp/pad.cookies -d 'username=user' -d 'password=pass' localhost:8000/a

get anonymous pad:

curl localhost:8000/p/asdf

create password protected pad:

export PAD_TEST_NOW="$(date +%s)"
export PAD_TEST_CONTENT="my test pad\n"
curl -v -b /tmp/pad.cookies -d "slug=test-$PAD_NOW" -d "content=$PAD_TEST_CONTENT" -d 'username=testpaduser' -d 'password=testpadpass' -d 'views_left=3' localhost:8000/newpad
# 401
curl -v -b /tmp/pad.cookies "localhost:8000/p/test-$PAD_NOW"
# 200
curl -v -b /tmp/pad.cookies -u 'testpaduser:testpadpass' "localhost:8000/p/test-$PAD_NOW"
# 200
curl -v -b /tmp/pad.cookies -u 'testpaduser:testpadpass' "localhost:8000/p/test-$PAD_NOW"
# 200
curl -v -b /tmp/pad.cookies -u 'testpaduser:testpadpass' "localhost:8000/p/test-$PAD_NOW"
# 404
curl -v -b /tmp/pad.cookies -u 'testpaduser:testpadpass' "localhost:8000/p/test-$PAD_NOW"

create base64 of non-text content and fetch it back to a file

export PAD_TEST_NOW="$(date +%s)"
curl -v -b /tmp/pad.cookies -d "slug=test-$PAD_NOW" --data-urlencode content@my_b64_file localhost:8000/newpad
.gitignore one month ago
README.md 27 weeks ago
build.zig 25 weeks ago
build.zig.zon one month ago
if-curl.sh 27 weeks ago
if.js one month ago
if.sh one month ago
seed.sql 28 weeks ago
src
App.zig 15 weeks ago
Config.zig last week
Html.zig last week
Pad.zig 25 weeks ago
UserExpires.zig 25 weeks ago
form.zig 15 weeks ago
handlers.zig 15 weeks ago
main.zig last week
root.zig 15 weeks ago
sql.zig 25 weeks ago