diff --git a/extra/webapps/pastebin/paste.xml b/extra/webapps/pastebin/paste.xml
index a48d2ea42d..6e1cb53664 100644
--- a/extra/webapps/pastebin/paste.xml
+++ b/extra/webapps/pastebin/paste.xml
@@ -14,10 +14,11 @@
Date: | |
-
-
+ Plain Text |
Delete Paste
+
+
@@ -28,10 +29,11 @@
Date: | |
-
-
+ Plain Text |
Delete Annotation
+
+
diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor
index 2c51d41aa0..48e6ed030b 100644
--- a/extra/webapps/pastebin/pastebin.factor
+++ b/extra/webapps/pastebin/pastebin.factor
@@ -10,6 +10,7 @@ html.templates.chloe
http.server
http.server.dispatchers
http.server.redirection
+http.server.responses
furnace
furnace.actions
furnace.redirection
@@ -64,16 +65,19 @@ TUPLE: paste < entity annotations ;
TUPLE: annotation < entity parent ;
-annotation "ANNOTATIONS"
+\ annotation "ANNOTATIONS"
{
{ "parent" "PARENT" INTEGER +not-null+ }
} define-persistent
: ( parent id -- annotation )
- annotation new
+ \ annotation new
swap >>id
swap >>parent ;
+: annotation ( id -- annotation )
+ [ f ] dip select-tuple ;
+
: paste ( id -- paste )
[ select-tuple ]
[ f select-tuples ]
@@ -134,6 +138,11 @@ M: annotation entity-url
{ pastebin "paste" } >>template ;
+: ( -- action )
+
+ [ validate-integer-id "id" value paste from-object ] >>init
+ [ "contents" value "text/plain" ] >>display ;
+
: ( -- action )
[ validate-integer-id ] >>init
@@ -213,13 +222,18 @@ M: annotation entity-url
tri
] >>submit ;
+: ( -- action )
+
+ [ validate-integer-id "id" value annotation from-object ] >>init
+ [ "contents" value "text/plain" ] >>display ;
+
: ( -- action )
[ { { "id" [ v-number ] } } validate-params ] >>validate
[
- f "id" value select-tuple
+ f "id" value annotation
[ delete-tuples ]
[ parent>> paste-url ]
bi
@@ -234,10 +248,12 @@ M: annotation entity-url
"" add-responder
"list.atom" add-responder
"paste" add-responder
+ "paste.txt" add-responder
"paste.atom" add-responder
"new-paste" add-responder
"delete-paste" add-responder
"new-annotation" add-responder
+ "annotation.txt" add-responder
"delete-annotation" add-responder
{ pastebin "pastebin-common" } >>template ;