Open simonw opened 4 years ago
I'd like to illustrate writable canned queries without the risk of someone abusing and breaking it (or filling it with bad content).
I don't want to have to monitor it, so an application that won't run out of disk space after a few months would be good too.
Maybe a polling app? If I'm only tracking integer numbers of votes it shouldn't ever run out of space.
Would be useful if I had a plugin that could authenticate users based on a secret environment variable (maybe for a password) - that way I could have an "admin" account on the Glitch app that is allowed to setup new polls, while anonymous users can only vote on them.
Part of #806
Create data.db
with:
echo '{"emoji": "🐯", "score": 0}' | sqlite-utils insert data.db emojis --pk=emoji -
echo '{"emoji": "🐺", "score": 0}' | sqlite-utils insert data.db emojis --pk=emoji -
Then run Datasette with this metadata.yaml
:
title: Datasette Poll
databases:
data:
queries:
vote:
sql: |-
update emojis set score = score + 1 where emoji = :emoji
write: true
I can't get Datasette working on Glitch installed from a URL - I'm going to try this on Glitch once I've shipped the 0.44 release in #806.
This needs the startup
hook, see https://github.com/simonw/datasette/issues/834#issuecomment-643501064
I can use magic parameters from #842 in this.
https://github.com/simonw/datasette-glitch is my new plugin that outputs the root login link on Glitch when the server starts.
Using datasette-glitch
and the new https://github.com/simonw/datasette-write - currently running on datasette==0.45a4
- works on Glitch. The console shows a login link which gives you a cookie which allows you access to the /-/write
interface.
How about a blog? Pre-configured canned queries that are only available to "root"
, plus datasette-template-sql and default templates for the index page and blog entry pages.
No I prefer the idea that logged out users can still perform some writes, in a not-likely-to-attract-abuse way.
So a root-user-can-configure-polls, logged-out-users-can-vote-in-them demo would be good.
Or... crazy idea: a collaborative drawing program? A grid of cells of emoji, anyone can add an emoji to a cell. Would involve a bit of JavaScript. I could use https://github.com/joeattardi/emoji-button for this.
Needs to run somewhere with a mutable disk drive, so not Cloud Run or Heroku or Vercel.
I think I'll put it on Glitch.