diff options
Diffstat (limited to 'src/admin.clj')
| -rw-r--r-- | src/admin.clj | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/admin.clj b/src/admin.clj index 4e90bad..7c7721e 100644 --- a/src/admin.clj +++ b/src/admin.clj @@ -217,3 +217,28 @@ AND cancelled = false (format-unknown-action action))] [(flash-assoc :msg msg) (redirect-to "/debug")]))) + +(def report-dir "/var/reports") + +(defn get-reports [] + (reverse + (sort + (for [f (.listFiles (new File report-dir))] + (.replaceAll (.getName f) ".html" ""))))) + +(defn list-reports-dir [session] + (if-super-vip + (let [reports (get-reports)] + (html + [:html + [:head [:title "dump.fm reports"]] + [:body + [:ul + (for [r reports] + [:li [:a {:href (str "/reports/" r)} r]])]]])))) + +(defn show-report [session f] + (if-super-vip + (if (contains? (set (get-reports)) f) + (serve-file report-dir (str f ".html")) + "ERROR"))) |
