summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-07-17 01:24:32 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-18 01:24:48 +0200
commit59997697f56e73d2323f8ec4be0d2581055063f8 (patch)
treedd23fe81f7a2aa19aa61a2e471fa6ba42c01771f /src
parent013729dafb19579ec14848cd6c2752dc3afcb2f2 (diff)
downloadserial-barcode-scanner-59997697f56e73d2323f8ec4be0d2581055063f8.tar.bz2
bootstrap2 -> bootstrap3
Diffstat (limited to 'src')
-rw-r--r--src/web/web.vala21
1 files changed, 20 insertions, 1 deletions
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);