diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/view/markdown.scm | 8 | ||||
-rwxr-xr-x | web/webserver.scm | 7 |
2 files changed, 1 insertions, 14 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm index d561832..59eb8b8 100644 --- a/web/view/markdown.scm +++ b/web/view/markdown.scm @@ -13,7 +13,6 @@ #:use-module (web client) #:use-module (web uri) #:use-module (web request) - #:use-module (web sxml) #:use-module (commonmark) @@ -24,13 +23,11 @@ commit-file is-repo?)) - (define (markdown-file->sxml fn) "Parse a local file" (commonmark->sxml (call-with-input-file fn get-string-all))) -;; --- fetch github style URLs (define (fetch-raw-file url) (receive (response-status response-body) @@ -59,8 +56,6 @@ (br) (br)))) - - (define (fetch-file repo query_path) (let* ( (abs_path (string-append repo "/" query_path))) (if (file-exists? abs_path) (let* ((full_path (canonicalize-path abs_path)) @@ -71,7 +66,6 @@ ("hash" . ,commit-sha)) ) (throw 'file-error (string-append "the file path " abs_path " does not exists"))))) - (define (git-invoke repo-path . args) (apply system* "git" "-C" repo-path args)) @@ -79,7 +73,6 @@ (let ((data (git-invoke repo-path "rev-parse"))) (zero? data))) - (define (get-latest-commit-sha1 repo-path) (let* ((output-port (open-input-pipe (string-append "git -C " repo-path " log -n 1 --pretty=format:%H HEAD"))) (commit-sha (read-line output-port))) @@ -87,7 +80,6 @@ commit-sha)) (define* (commit-file repo file-path content commit-message username email #:optional (prev-commit "")) - (if (string=? prev-commit (get-latest-commit-sha1 repo)) #t (throw 'system-error (format #f "Commits do no match.Please pull in latest changes for current * ~a * and prev * ~a * " diff --git a/web/webserver.scm b/web/webserver.scm index 72984a1..0dcb5f8 100755 --- a/web/webserver.scm +++ b/web/webserver.scm @@ -39,7 +39,6 @@ (web view doc) (web view markdown)) - (define info `( ("name" . "GeneNetwork REST API") ("version" . ,get-version) @@ -66,8 +65,6 @@ otherwise search for set/group data" taxoninfo (cdr (get-group-data id))))) -;; ---- REST API web server handler - (define (not-found2 request) (values (build-response #:code 404) (string-append "Resource X not found: " @@ -77,7 +74,6 @@ otherwise search for set/group data" (list (build-response #:code 404) (string-append "Resource not found: " (uri->string uri)))) - (define file-mime-types '(("css" . (text/css)) ("js" . (text/javascript)) @@ -133,7 +129,6 @@ otherwise search for set/group data" (lambda (port) (format port "~a" "foo")))) - (define (build-json-response status_code json) (list (build-response @@ -152,7 +147,6 @@ otherwise search for set/group data" '() (json-string->scm (utf8->string body)))) - (define (decode-query-component component) (let* ([index (string-index component #\=)] [key (if index (substring component 0 index) component)] @@ -201,6 +195,7 @@ otherwise search for set/group data" prev-commit)))) (lambda (key . args) (let ((msg (car args))) (build-json-response 400 `(("error" . ,key) ("msg" . ,msg))))))) + (define (controller request body) (match-lambda (('GET) |