From 59997697f56e73d2323f8ec4be0d2581055063f8 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Tue, 17 Jul 2018 01:24:32 +0200 Subject: bootstrap2 -> bootstrap3 --- src/web/web.vala | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/web.vala b/src/web/web.vala index 5524a7e..5f82cec 100644 --- a/src/web/web.vala +++ b/src/web/web.vala @@ -1131,7 +1131,7 @@ public class WebServer { void handler_img(Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { try { - var f = File.new_for_path(templatedir+path); + var f = File.new_for_path(Path.build_filename(templatedir, path)); uint8[] data = null; if(f.query_exists() && f.load_contents(null, out data, null)) { @@ -1147,6 +1147,24 @@ public class WebServer { return; } + void handler_font(Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { + try { + var f = File.new_for_path(Path.build_filename(templatedir, path)); + uint8[] data = null; + + if(f.query_exists() && f.load_contents(null, out data, null)) { + msg.set_response("application/octet-stream; charset=binary", Soup.MemoryUse.COPY, data); + msg.set_status(200); + return; + } + } catch(Error e) { + error(_("Error: %s\n"), e.message); + } + + handler_404(server, msg, path, query, client); + return; + } + void handler_400_fallback(Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { string result = "Internal Server Error\n"; msg.set_response("text/plain", Soup.MemoryUse.COPY, result.data); @@ -1492,6 +1510,7 @@ public class WebServer { srv.add_handler("/js", handler_js); srv.add_handler("/css", handler_css); srv.add_handler("/img", handler_img); + srv.add_handler("/fonts", handler_font); /* cashbox */ srv.add_handler("/cashbox", handler_cashbox); -- cgit v1.2.3