webapps.pastebin: Cleaner url derivation, better variable names

fix-linux
Doug Coleman 2019-12-07 15:54:57 -08:00
parent e05eecf26b
commit c71b92eba9
1 changed files with 12 additions and 14 deletions

View File

@ -2,17 +2,18 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors calendar db db.tuples db.types furnace.actions 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 furnace.utilities
http.server.dispatchers http.server.responses kernel math.parser html.forms http.server.dispatchers http.server.responses kernel
namespaces present sequences smtp splitting sorting urls validators math.parser namespaces present sequences smtp sorting splitting
xmode.catalog ; 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 SYMBOL: pastebin-email-from
SYMBOL: pastebin-email-to
can-delete-pastes? define-capability can-delete-pastes? define-capability
@ -154,17 +155,14 @@ M: annotation entity-url
{ "summary" "author" "mode" "contents" } to-object ; { "summary" "author" "mode" "contents" } to-object ;
: email-on-paste ( url -- ) : email-on-paste ( url -- )
pastebin-email-list get-global [ pastebin-email-to get-global [
drop drop
] [ ] [
<email> swap >>to <email>
swap clone swap >>to
"https" >>protocol swap adjust-url present >>body
"paste.factorcode.org" >>host pastebin-email-from get-global >>from
[ "$pastebin" ?head drop ] change-path "New paste!" >>subject
present >>body
"factor-builds2@gmail.com" >>from
"New paste" >>subject
send-email send-email
] if-empty ; ] if-empty ;