../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 2 months ago
README.md one month ago
build.zig one month ago
build.zig.zon 2 months ago
if-curl.sh one month ago
if.js one month ago
if.sh one month ago
seed.sql one month ago
src
App.zig one month ago
Config.zig one month ago
Html.zig one month ago
Pad.zig one month ago
UserExpires.zig one month ago
form.zig one month ago
handlers.zig one month ago
main.zig one month ago
root.zig one month ago
sql.zig one month ago