(time-parse (lookup (string "limit" i) v))
(time-parse (lookup (string "end" i) v))
) c -1))
- (write-file "../control.dat"
+ (write-file "control.dat"
(append (format "; Updated at %s\n(" (date))
(join (map string c) "\n " true)
")\n"))
-; Load and present ../controls.dat
+; Load and present control.dat
(load "expand-string.lsp")
)
(constant
- 'CONTROLFILE "../control.dat"
+ 'CONTROLFILE "control.dat"
'CONTROL (read-expr (read-file CONTROLFILE))
'GAP (or (lookup 'gap CONTROL) 5)
'CLIP (or (lookup 'clip CONTROL) 5)
- 'INCL (or (lookup control CONTROL) "ipset-control.lsp")
+ 'INCL (or (lookup 'control CONTROL) "ipset-control.lsp")
'TIMES (map (fn (n) (or (assoc n CONTROL) '(1 timed (7 0) (3 0) (19 0))))
(sequence 1 7))
+ 'NET (or (lookup 'net CONTROL) "10.0.0.0/8")
)
(setf
(define (usage-file dat)
(clean null?
(map usage
- (parse (read-file (format "../activity/%s" dat)) "\n"))))
+ (parse (read-file (format "activity/%s" dat)) "\n"))))
(setf
- USAGE (sort (flat (map usage-file (directory "../activity" "^[^.]")) 1) <)
+ USAGE (sort (flat (map usage-file (directory "activity" "^[^.]")) 1) <)
MAP '()
)
(load "usage-extra.lsp")
)
-(define (get-remote-user)
- (and (regex "^([^:]+):" (base64-dec (6 (env "HTTP_AUTHORIZATION"))) 0) $1))
+(define (get-remote-user) REMOTE_USER)
(constant
- 'ADMIN (member (get-remote-user) '("ralph" "lin"))
- 'USAGE (read-expr (read-file "../usage.dat"))
+ 'ADMIN (member REMOTE_USER '("ralph" "lin"))
+ 'USAGE (read-expr (read-file "usage.dat"))
'extra-options '(0 10 30 60)
- 'EXTRAFILE "../control-extra.dat"
+ 'EXTRAFILE "control-extra.dat"
'EXTRATM (file-info EXTRAFILE 6)
'TM (date-value)
'EXTRA (and (regex "([0-9]+) ([0-9]+)" (or (read-file EXTRAFILE) "") 0)
)
(define (tm2time tm)
- (if (> tm)
- (letn ((m (/ tm 60)) (h (/ m 60))) (list h (- m (* 60 h))))
+ (if (> tm) (letn ((m (/ tm 60)) (h (/ m 60))) (list h (- m (* 60 h))))
'(0 0))
)