Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (76 sloc) 2.83 KB
status loop
save doc with schema that can be displayed:
twitter name && couchdb user name.
if twitter name == configured twitter acct && username == current logged in user, then we push it.
want to take care that someone else can't force a tweet by writing docs to your local db, then they get configured to push to twitter when it comes back online.
validate that only owners may write docs with needstweet = true?
additional schema
twebz :
state : sent | unsent | sending
state_at : time()
acct : {
service : twitter,
name : jchris
signature : hmac(),
/* create twebz database*/
setup screen
first check to see if site needs setup!
site setup:
create twebz user
put twebz user password in config.json
create twebz-config database only twebz user can read
prompt for user to setup twitter app keypair
if user is setup
main-page (if admin, link to pending users)
if user is admin
pending users
wait for admin
now check to see if user needs setup:
user setup:
prompt to create twebz-private-username database
ensure user is admin
(this could be skipped by giving the twebz bot admin creds)
grant access to private-db to node script
(user: twebz, password: uuid)
save uuid in private db
link twitter accounts and save creds in private-db
prompt to run twebz-node script
(can we use externals API to provide uuid to node script?)
link twitter account(s) to couchdb account
user stores a start-link-account document to the twebz db
in state "request"
user subscribes to _changes on the user db
twebz-bot gets a request-token and makes it available in the user-db,
sets the link_account doc state to "working"
twebz-bot subscribes to the user-db _changes until oath complete (w timeout)
user loads the token, marks it as used, and uses it to redirect to the twitter authorize page
user authorizes and is redirected back to the app
app updates user-db request token document with 'go'
user subscribes to user-db _changes
twebz-bot uses request-token document to get access token, updates token doc with access token, user_id, and screen_name
active state!
ability to link more states
ability for admin to setup new users
ability for user to request new setups.
option to send each tweet as any linked account
required for twebz to post to twitter:
twitter creds for tacct x are in private db for cacct
pretweet has tacct and cacct + content signed with shared secret hmac
docids need to be deterministic across nodes or else we get dup tweets
if twebz initiated, docid is couchdb id
if else, docid is twitter id.
if twebz initiated remotely, and pushed through twitter before replicated
status couch