From c71b92eba9851a684a4ae1345e4f72df805d6297 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 7 Dec 2019 15:54:57 -0800 Subject: [PATCH] webapps.pastebin: Cleaner url derivation, better variable names --- extra/webapps/pastebin/pastebin.factor | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor index c456ccf3d5..fd987c71c8 100644 --- a/extra/webapps/pastebin/pastebin.factor +++ b/extra/webapps/pastebin/pastebin.factor @@ -2,17 +2,18 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors calendar db db.tuples db.types furnace.actions furnace.auth furnace.boilerplate furnace.recaptcha -furnace.redirection furnace.syndication html.forms -http.server.dispatchers http.server.responses kernel math.parser -namespaces present sequences smtp splitting sorting urls validators -xmode.catalog ; +furnace.redirection furnace.syndication furnace.utilities +html.forms http.server.dispatchers http.server.responses kernel +math.parser namespaces present sequences smtp sorting splitting +urls validators xmode.catalog ; IN: webapps.pastebin TUPLE: pastebin < dispatcher ; SYMBOL: can-delete-pastes? -SYMBOL: pastebin-email-list +SYMBOL: pastebin-email-from +SYMBOL: pastebin-email-to can-delete-pastes? define-capability @@ -154,17 +155,14 @@ M: annotation entity-url { "summary" "author" "mode" "contents" } to-object ; : email-on-paste ( url -- ) - pastebin-email-list get-global [ + pastebin-email-to get-global [ drop ] [ - swap >>to - swap clone - "https" >>protocol - "paste.factorcode.org" >>host - [ "$pastebin" ?head drop ] change-path - present >>body - "factor-builds2@gmail.com" >>from - "New paste" >>subject + + swap >>to + swap adjust-url present >>body + pastebin-email-from get-global >>from + "New paste!" >>subject send-email ] if-empty ;