webapps.pastebin: Email a list on every paste.

fix-linux
Doug Coleman 2019-12-07 09:48:03 -08:00
parent 6b91f6f774
commit d58ce0fb5b
1 changed files with 15 additions and 2 deletions

View File

@ -4,13 +4,15 @@ USING: accessors calendar db db.tuples db.types furnace.actions
furnace.auth furnace.boilerplate furnace.recaptcha furnace.auth furnace.boilerplate furnace.recaptcha
furnace.redirection furnace.syndication html.forms furnace.redirection furnace.syndication html.forms
http.server.dispatchers http.server.responses kernel math.parser http.server.dispatchers http.server.responses kernel math.parser
sequences sorting urls validators xmode.catalog ; namespaces sequences smtp sorting urls validators xmode.catalog ;
IN: webapps.pastebin IN: webapps.pastebin
TUPLE: pastebin < dispatcher ; TUPLE: pastebin < dispatcher ;
SYMBOL: can-delete-pastes? SYMBOL: can-delete-pastes?
SYMBOL: pastebin-email-list
can-delete-pastes? define-capability can-delete-pastes? define-capability
! ! ! ! ! !
@ -150,6 +152,17 @@ M: annotation entity-url
now >>date now >>date
{ "summary" "author" "mode" "contents" } to-object ; { "summary" "author" "mode" "contents" } to-object ;
: email-on-paste ( url -- )
pastebin-email-list get-global [
drop
] [
<email> swap >>to
swap >>body
"factor-builds2@gmail.com" >>from
"New paste" >>subject
send-email
] if-empty ;
: <new-paste-action> ( -- action ) : <new-paste-action> ( -- action )
<page-action> <page-action>
[ [
@ -168,7 +181,7 @@ M: annotation entity-url
f <paste-state> f <paste-state>
[ deposit-entity-slots ] [ deposit-entity-slots ]
[ insert-tuple ] [ insert-tuple ]
[ id>> paste-url <redirect> ] [ id>> paste-url [ email-on-paste ] [ <redirect> ] bi ]
tri tri
] >>submit ; ] >>submit ;