Skip to content

Commit

Permalink
part name and fixed lightcycle's extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnuda committed Jul 11, 2020
1 parent 48a9d7f commit b92e34a
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/dactyl_keyboard/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,22 @@
:configuration-use-screw-inserts? param-screw-inserts}
generated-file (cond
generate-plate? {:file (g/generate-plate-dm c is-right?)
:part "plate"
:extension "scad"}
generate-json? {:file (g/generate-json-dm c is-right?)
:part "any"
:extension "json"}
:else {:file (g/generate-case-dm c is-right?)
:extension "scad"})]
:part (str "case-" (if is-right? "right" "left"))
:extension "scad"})
scad-file (get generated-file :file)
part-name (get generated-file :part)
date-time (current-time)
extension (get generated-file :extension)]
{:status 200
:headers {"Content-Type" "application/octet-stream"
"Content-Disposition" (str "inline; filename=\"manuform-" (current-time) "." (get generated-file :extension) "\"")}
:body (get generated-file :file)}))
"Content-Disposition" (str "inline; filename=\"manuform-" part-name "-" date-time "." extension "\"")}
:body scad-file}))

(defn generate-lightcycle [req]
(let [p (:form-params req)
Expand Down Expand Up @@ -215,17 +222,21 @@
:configuration-show-caps? param-show-keycaps

:configuration-use-screw-inserts? param-screw-inserts}
generated-file (cond
generate-plate? {:file (g/generate-plate-dl c is-right?)
:extension "scad"}
generate-json? {:file (g/generate-json-dl c is-right?)
:extension "json"}
:else {:file (g/generate-case-dl c is-right?)
:extension "scad"})]
generated-file (cond
generate-plate? {:file (g/generate-plate-dl c is-right?)
:extension "scad"}
generate-json? {:file (g/generate-json-dl c is-right?)
:extension "json"}
:else {:file (g/generate-case-dl c is-right?)
:extension "scad"})
scad-file (get generated-file :file)
part-name (get generated-file :part)
date-time (current-time)
extension (get generated-file :extension)]
{:status 200
:headers {"Content-Type" "application/octet-stream"
"Content-Disposition" (str "inline; filename=\"lightcycle" (current-time) (get generated-file :extension) "\"")}
:body (get generated-file :file)}))
"Content-Disposition" (str "inline; filename=\"lightcycle-" part-name "-" date-time "." extension "\"")}
:body scad-file}))

(defn api-generate-manuform [{body :body}]
(let [keys (get body :keys)
Expand Down

0 comments on commit b92e34a

Please sign in to comment.