diff --git a/html/kotatsu.html b/html/kotatsu.html
new file mode 100644
index 0000000..8a8c576
--- /dev/null
+++ b/html/kotatsu.html
@@ -0,0 +1,11 @@
+
+
+
+
+ --KOTATSU_TITLE--
+
+
+ --KOTATSU_TITLE--
+ --KOTATSU_SERVICES--
+
+
\ No newline at end of file
diff --git a/src/kotatsu.cr b/src/kotatsu.cr
index d493fe7..0479291 100644
--- a/src/kotatsu.cr
+++ b/src/kotatsu.cr
@@ -96,6 +96,21 @@ module Kotatsu
end
end
+ def self.makeContent(title, services)
+ content = File.read("./html/kotatsu.html")
+ content = content.gsub("--KOTATSU_TITLE--", title)
+
+ services_c = String.new
+ i = 0
+ while services.size > i
+ services_c = services_c + "#{services[i][0]}
"
+ i+=1
+ end
+ content = content.sub("--KOTATSU_SERVICES--", services_c)
+
+ return content
+ end
+
# -- PARSER --
OptionParser.parse do |parser|
@@ -181,10 +196,12 @@ module Kotatsu
#Reads config file
c_version, c_port, c_title, c_services = readConfig()
+ webcontent = makeContent(c_title, c_services)
+
#Run http server
webserv = HTTP::Server.new do |context|
- context.response.content_type = "text/plain"
- context.response.print "Running kotatsu #{VERSION}"
+ context.response.content_type = "text/html"
+ context.response << webcontent
end
webaddr = webserv.bind_tcp c_port
puts "Started kotatsu webserver on #{webaddr}"