Compare commits
No commits in common. "main" and "v0.2.0" have entirely different histories.
6 changed files with 8 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
(package
|
(package
|
||||||
(name (bjomarks))
|
(name (bjomarks))
|
||||||
(version "0.2.1")
|
(version "0.2.0")
|
||||||
(description "Bookmarks in an encrypted store: one file for each device, in any folder that a file syncer or WebDAV shares.")
|
(description "Bookmarks in an encrypted store: one file for each device, in any folder that a file syncer or WebDAV shares.")
|
||||||
(license "MPL-2.0")
|
(license "MPL-2.0")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
(when (>= i 0)
|
(when (>= i 0)
|
||||||
(set! out i (get hex-digits (cast int (bitwise-and rest 15L))))
|
(set! out i (get hex-digits (cast int (bitwise-and rest 15L))))
|
||||||
(go (- i 1) (shift-right rest 4))))
|
(go (- i 1) (shift-right rest 4))))
|
||||||
(bytes->string/lossy out))
|
(bytes->string out))
|
||||||
|
|
||||||
;; The value of the lower-case hex digits of `bytes` from `start` to `end`.
|
;; The value of the lower-case hex digits of `bytes` from `start` to `end`.
|
||||||
;; `None` for any other byte.
|
;; `None` for any other byte.
|
||||||
|
|
|
||||||
|
|
@ -329,8 +329,7 @@
|
||||||
(:def (Some contents) (aead-decrypt dek nonce sealed #:aad header)
|
(:def (Some contents) (aead-decrypt dek nonce sealed #:aad header)
|
||||||
:leave-with (Err "it does not decrypt: it was changed, or it was encrypted with another key"))
|
:leave-with (Err "it does not decrypt: it was changed, or it was encrypted with another key"))
|
||||||
(:def (Ok json) (unpack contents) :propagate)
|
(:def (Ok json) (unpack contents) :propagate)
|
||||||
(:def (Ok text) (bytes->string json) :leave-with (Err "the document in it is not UTF-8"))
|
(:def (Ok doc) (parse-device-doc (bytes->string json)) :propagate)
|
||||||
(:def (Ok doc) (parse-device-doc text) :propagate)
|
|
||||||
((not (= (.device doc) device))
|
((not (= (.device doc) device))
|
||||||
(Err (str "the header names the device " (uuid->string device) ", and the document names "
|
(Err (str "the header names the device " (uuid->string device) ", and the document names "
|
||||||
(uuid->string (.device doc)))))
|
(uuid->string (.device doc)))))
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
(let go ((i start))
|
(let go ((i start))
|
||||||
(if (and (< i end) (name-byte? (cast int (array-ref bytes i))))
|
(if (and (< i end) (name-byte? (cast int (array-ref bytes i))))
|
||||||
(go (+ i 1))
|
(go (+ i 1))
|
||||||
(bytes->string/lossy (ro-span->array (array->ro-span bytes #:from start #:to i))))))
|
(bytes->string (ro-span->array (array->ro-span bytes #:from start #:to i))))))
|
||||||
|
|
||||||
;; The charset that a `Content-Type` value names, if it names one.
|
;; The charset that a `Content-Type` value names, if it names one.
|
||||||
(: (-> string (Option string)))
|
(: (-> string (Option string)))
|
||||||
|
|
@ -118,9 +118,9 @@
|
||||||
(def encoding (match charset
|
(def encoding (match charset
|
||||||
((Some name) (match (encoding-named name) ((Some e) e) (None utf-8)))
|
((Some name) (match (encoding-named name) ((Some e) e) (None utf-8)))
|
||||||
(None utf-8)))
|
(None utf-8)))
|
||||||
(match (bytes->string slice #:encoding encoding)
|
(match (try (bytes->string slice #:encoding encoding) #:catch (System.Exception))
|
||||||
((Ok text) text)
|
((Ok text) text)
|
||||||
((Err _) (bytes->string/lossy slice #:encoding windows-1252))))
|
((Err _) (bytes->string slice #:encoding windows-1252))))
|
||||||
|
|
||||||
;; The title of the page in the first `n` bytes of `bytes`, as
|
;; The title of the page in the first `n` bytes of `bytes`, as
|
||||||
;; `clean-title` makes it. `None` when there is no whole `<title>` element,
|
;; `clean-title` makes it. `None` when there is no whole `<title>` element,
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
(if (string-contains? seen "\r\n\r\n")
|
(if (string-contains? seen "\r\n\r\n")
|
||||||
(path-of seen)
|
(path-of seen)
|
||||||
(match (read-some in)
|
(match (read-some in)
|
||||||
((Some bs) (go (str seen (bytes->string/lossy bs))))
|
((Some bs) (go (str seen (bytes->string bs))))
|
||||||
(None (path-of seen))))))
|
(None (path-of seen))))))
|
||||||
|
|
||||||
;; Waits `ms`, or less when the server stops.
|
;; Waits `ms`, or less when the server stops.
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
(if (string-contains? seen "\r\n\r\n")
|
(if (string-contains? seen "\r\n\r\n")
|
||||||
(match (string-split-once seen "\r\n") ((Some (Tuple l _)) l) (None seen))
|
(match (string-split-once seen "\r\n") ((Some (Tuple l _)) l) (None seen))
|
||||||
(match (read-some in)
|
(match (read-some in)
|
||||||
((Some bs) (go (str seen (bytes->string/lossy bs))))
|
((Some bs) (go (str seen (bytes->string bs))))
|
||||||
(None seen)))))
|
(None seen)))))
|
||||||
|
|
||||||
;; One connection: one request, one answer. The wait ends early when the
|
;; One connection: one request, one answer. The wait ends early when the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue