blob: 66edd7ef52647b14d9d13f2d0045f76002effc3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
;; index.cljs.hl - The gnunet-web website
;; Copyright (C) 2013,2014 David Barksdale <amatus@amatus.name>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(page "index.html"
(:use [amatus.code :only (base32-crockford)]
[gnunet-web.hostlist :only (fetch-and-process!)]
[gnunet-web.service :only (start-worker)]
[gnunet-web.transport :only (addr->string monitor-peers
state->string)]))
(set! *print-fn* #(.log js/console %))
(def topology-worker (start-worker "topology" "js/gnunet-daemon-topology.js"))
(def fs-worker (start-worker "fs" "js/gnunet-service-fs.js"))
(defc peers {})
(monitor-peers (fn [message]
(swap! peers assoc (:peer message)
{:state (:state message)
:address (:address message)
:plugin (:plugin message)})))
(fetch-and-process!)
(defelem ui-button
[attr kids]
((div :class "ui button") attr kids))
(html
(head
(link :rel "stylesheet" :type "text/css" :href "css/semantic.min.css")
(script :src "js/semantic.min.js"))
(body
(table :class "ui table segment"
(thead
(tr
(th :text "Peer ID")
(th :text "State")
(th :text "Transport")
(th :text "Address")))
(tbody
(loop-tpl :bindings [[peer info] peers]
(tr
(td :width "25%"
:text (cell=
(apply str
(concat
(take 4 (base32-crockford peer))
"\u2026")))
:title (cell= (base32-crockford peer)))
(td :width "25%"
:text (cell= (state->string (:state info))))
(td :width "25%"
:text (cell= (:plugin info)))
(td :width "25%"
:text (cell= (addr->string (:address info))))))))
(div :class "ui active inline loader")))
;; vim: set expandtab ts=2 sw=2 filetype=clojure :
|