2 USING: calendar kernel namespaces sequences furnace hashtables
5 TUPLE: paste n summary author channel contents date annotations ;
7 TUPLE: annotation summary author contents ;
9 C: paste ( summary author channel contents -- paste )
10 V{ } clone over set-paste-annotations
11 [ set-paste-contents ] keep
12 [ set-paste-author ] keep
13 [ set-paste-channel ] keep
14 [ set-paste-summary ] keep ;
16 TUPLE: pastebin pastes ;
18 C: pastebin ( -- pastebin )
19 V{ } clone over set-pastebin-pastes ;
21 : add-paste ( paste pastebin -- )
22 now timestamp>http-string pick set-paste-date
23 dup pastebin-pastes length pick set-paste-n
24 pastebin-pastes push ;
26 <pastebin> pastebin set-global
28 : get-paste ( n -- paste )
29 pastebin get pastebin-pastes nth ;
34 "show-paste" render-page ;
36 \ show-paste { { "n" v-number } } define-action
39 "New paste" f "new-paste" render-page ;
41 \ new-paste { } define-action
43 : submit-paste ( summary author channel contents -- )
44 <paste> pastebin get-global add-paste ;
47 { "summary" v-required }
48 { "author" v-required }
49 { "channel" "#concatenative" v-default }
50 { "contents" v-required }
55 [ show-paste ] "show-paste-quot" set
56 [ new-paste ] "new-paste-quot" set
60 "paste-list" render-page
63 \ paste-list { } define-action
65 \ submit-paste [ paste-list ] define-redirect
67 "pastebin" "paste-list" "contrib/furnace-pastebin" web-app
69 : annotate-paste ( paste# summary author contents -- )
70 <annotation> swap get-paste paste-annotations push ;
73 { "n" v-required v-number }
74 { "summary" v-required }
75 { "author" v-required }
76 { "contents" v-required }
79 \ annotate-paste [ "n" show-paste ] define-redirect