diff --git a/public/index.html b/public/index.html
index 17433c5..6f17bd1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,34 +1,25 @@
-
+
+
+
+
+
+
+ Name |
+ Status |
+ Action |
+
+
+
+
diff --git a/src/daemon/funkos.cr b/src/daemon/funkos.cr
index 2bae06f..a414917 100644
--- a/src/daemon/funkos.cr
+++ b/src/daemon/funkos.cr
@@ -10,7 +10,7 @@ module Funkos
end
end
- get "/funkos/" do |_|
+ get "/funkos/" do |env|
docker_api = Docr::API.new(Docr::Client.new)
containers = docker_api.containers.list(all: true)
@@ -20,7 +20,12 @@ module Funkos
next if names.empty?
funkos << Funko.new(name: names[0][7..])
}
- funkos.sort! { |a, b| a.name <=> b.name}
- funkos.to_json
+ funkos.sort! { |a, b| a.name <=> b.name }
+
+ if env.params.query.fetch("format", "json") == "html"
+ render "src/views/funkos.ecr"
+ else
+ funkos.to_json
+ end
end
end
diff --git a/src/views/funkos.ecr b/src/views/funkos.ecr
new file mode 100644
index 0000000..73c9a9f
--- /dev/null
+++ b/src/views/funkos.ecr
@@ -0,0 +1,5 @@
+<%- funkos.each do |funko| -%>
+ <%= funko.name %> |
+ sarasa |
+ |
+<%- end -%>