minor fixes

This commit is contained in:
Brent Gordon 2020-03-17 09:01:12 -05:00
parent 5eca87c468
commit 8ea70047e0

View File

@ -12,7 +12,7 @@
(define CRLF "\r\n") (define CRLF "\r\n")
(define boundary (bytes->string/utf-8 (md5 (number->string (current-seconds))))) (define boundary (bytes->string/utf-8 (md5 (number->string (current-seconds)))))
(define boundary-line (string-append "--" boundary CRLF)) (define boundary-line (string-append "--" boundary CRLF))
; a table to map file extensions to MIME types: ; a hashtable mapping file-extensions and their mime types
(define ext=>mime-type (define ext=>mime-type
#hash(("jpg" . "image/jpeg") #hash(("jpg" . "image/jpeg")
("png" . "image/png") ("png" . "image/png")
@ -60,6 +60,7 @@
(define (upload-attachment) (define (upload-attachment)
(define attachment (attach-media)) (define attachment (attach-media))
(displayln attachment)
(define id (hash-ref attachment 'id)) (define id (hash-ref attachment 'id))
(define data (define data
(bytes-append (bytes-append
@ -72,9 +73,9 @@
(displayln (read-json response)) (displayln (read-json response))
(displayln "Uploaded post!")) (displayln "Uploaded post!"))
;run upload-attachment very 30 mins ;run upload-attachment very 30 mins infinitely
(define (loop) (define (loop)
(sleep 1740) (sleep 1740)
(upload-attachment) (upload-attachment)
(loop)) (loop))