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
25 weeks ago
README.md
6 days ago
build.zig
4 days ago
build.zig.zon
25 weeks ago
if-curl.sh
6 days ago
if.js
last week
if.sh
last week
seed.sql
last week
Config.zig
4 days ago
Html.zig
4 days ago
Pad.zig
4 days ago
UserExpires.zig
4 days ago
main.zig
4 days ago
root.zig
4 days ago
sql.zig
4 days ago