Browse Source

text size setting can be set by API calls now

master
Christian Mueller 11 years ago
parent
commit
aaee1b8025
  1. 3
      API.md
  2. 2
      src/notehub/api.clj
  3. 6
      test/notehub/test/api.clj

3
API.md

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
- **V1.4**: Bugfix: no whitespace elimination from the note text is needed now for the signature compuation.
- **V1.3**: New note ID format.
- **V1.2**: Theme & fonts can be specified during the publishing.
- **V1.2**: Theme & font settings can be specified during the publishing.
- **V1.1**: fields `publisher` and `title` in the response to the note retrieval.
- **V1.0**: initial release.
@ -77,6 +77,7 @@ Parameter | Explanation | Type @@ -77,6 +77,7 @@ Parameter | Explanation | Type
`password` | Secret token (plain or hashed) | *optional*
`version` | Used API version | **required**
`theme` | Theme name | *optional*
`text-size` | Text size | *optional*
`text-font` | Text font name | *optional*
`header-font`| Header font name | *optional*

2
src/notehub/api.clj

@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
(when (blank? note) "note is empty")])]
(if (empty? errors)
(let [[year month day] (map str (get-date))
params (select-keys params [:text-font :header-font :theme])
params (select-keys params [:text-size :text-font :header-font :theme])
raw-title (filter #(or (= \- %) (Character/isLetterOrDigit %))
(-> note derive-title trim (sreplace " " "-") lower-case))
max-length (get-setting :max-title-length #(Integer/parseInt %) 80)

6
test/notehub/test/api.clj

@ -147,6 +147,7 @@ @@ -147,6 +147,7 @@
:signature (storage/sign pid psk note)
:version "1.4"
:theme "dark"
:text-size 1.1
:text-font "Helvetica"})
body (parse-string (:body response))
noteID (body "noteID")]
@ -156,8 +157,9 @@ @@ -156,8 +157,9 @@
(last (clojure.string/split
((parse-string (:body response)) "shortURL") #"/"))))) "Location")]
(= url ((parse-string (:body response)) "longURL"))
(substring? "theme=dark" url)
(substring? "text-font=Felvetica" url))
(is (substring? "theme=dark" url))
(is (substring? "text-size=1.1" url))
(is (substring? "text-font=Helvetica" url)))
(is (do
(storage/delete-note noteID)
(not (storage/note-exists? noteID)))))))

Loading…
Cancel
Save