Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
OCamlPro
osh
Commits
37b7d326
Unverified
Commit
37b7d326
authored
Sep 17, 2021
by
zapashcanon
Browse files
fmt
parent
280e96ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
36 deletions
+42
-36
src/server.ml
src/server.ml
+42
-36
No files found.
src/server.ml
View file @
37b7d326
...
@@ -19,42 +19,48 @@ let () =
...
@@ -19,42 +19,48 @@ let () =
match
page
"index"
with
match
page
"index"
with
|
None
->
Dream
.
empty
`Not_Found
|
None
->
Dream
.
empty
`Not_Found
|
Some
content
->
|
Some
content
->
Dream
.
html
Dream
.
html
(
Template
.
render_unsafe
~
title
:
"title"
~
content
)
)
(
Template
.
render_unsafe
~
title
:
"title"
~
content
)
)
;
Dream
.
get
"/badge"
(
fun
request
->
;
Dream
.
get
"/badge"
(
fun
request
->
Dream
.
respond
~
headers
:
[
"Content-Type"
,
"image/svg+xml"
]
(
Dream
.
respond
let
open
Ocb
in
~
headers
:
[
(
"Content-Type"
,
"image/svg+xml"
)
]
let
label
=
match
Dream
.
query
"label"
request
with
(
let
open
Ocb
in
|
None
->
"Label"
let
label
=
|
Some
label
->
label
match
Dream
.
query
"label"
request
with
in
|
None
->
"Label"
let
color
=
match
Dream
.
query
"color"
request
with
|
Some
label
->
label
|
None
->
Color
.
Blue
in
|
Some
color
->
Color
.
of_string
color
let
color
=
in
match
Dream
.
query
"color"
request
with
let
style
=
match
Dream
.
query
"style"
request
with
|
None
->
Color
.
Blue
|
None
->
Style
.
Flat
|
Some
color
->
Color
.
of_string
color
|
Some
style
->
Style
.
of_string
style
in
in
let
style
=
let
label_color
=
match
Dream
.
query
"label_color"
request
with
match
Dream
.
query
"style"
request
with
|
None
->
Color
.
Black
|
None
->
Style
.
Flat
|
Some
label_color
->
Color
.
of_string
label_color
|
Some
style
->
Style
.
of_string
style
in
in
let
status
=
match
Dream
.
query
"status"
request
with
let
label_color
=
|
None
->
"Status"
match
Dream
.
query
"label_color"
request
with
|
Some
status
->
status
|
None
->
Color
.
Black
in
|
Some
label_color
->
Color
.
of_string
label_color
let
scale
=
match
Dream
.
query
"scale"
request
with
in
|
None
->
1
.
let
status
=
|
Some
scale
->
begin
match
float_of_string_opt
scale
with
match
Dream
.
query
"status"
request
with
|
None
->
1
.
|
None
->
"Status"
|
Some
scale
->
scale
|
Some
status
->
status
end
in
in
let
scale
=
Format
.
asprintf
"%a"
(
match
Dream
.
query
"scale"
request
with
Gen
.
mk
~
label
~
color
~
style
~
label_color
~
status
~
icon
:
None
~
icon_width
:
0
.
~
scale
|
None
->
1
.
)
()
|
Some
scale
->
begin
)
match
float_of_string_opt
scale
with
)
|
None
->
1
.
|
Some
scale
->
scale
end
in
Format
.
asprintf
"%a"
(
Gen
.
mk
~
label
~
color
~
style
~
label_color
~
status
~
icon
:
None
~
icon_width
:
0
.
~
scale
)
()
)
)
]
]
@@
Dream
.
not_found
@@
Dream
.
not_found
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment