summaryrefslogtreecommitdiffstats
path: root/src/web/main.vala
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
committerHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
commit8f2ba2050ee78d0e4a47f1277c6bc4422d06170c (patch)
treec008d2878905e03df7a8bf8bd3330762cc2d8f43 /src/web/main.vala
parentbb55e121576a5b5d225bfc68c5062f386cc32db9 (diff)
parent3fc3ea6c6df237dbdf48d14703118b747bf5d647 (diff)
downloadserial-barcode-scanner-8f2ba2050ee78d0e4a47f1277c6bc4422d06170c.tar.bz2
Merge branch 'master' into better_inventory
Conflicts: README data/templates/products/entry.html docker/Dockerfile docker/init.sh src/database/database.vala src/database/db-interface.vala src/pdf-stock/Makefile src/pdf-stock/pdf-stock-interface.vala src/pdf-stock/pdf-stock.vala src/web/Makefile src/web/main.vala templates/menu.html templates/products/index.html
Diffstat (limited to 'src/web/main.vala')
-rw-r--r--src/web/main.vala57
1 files changed, 39 insertions, 18 deletions
diff --git a/src/web/main.vala b/src/web/main.vala
index aefe7fd..4c89e40 100644
--- a/src/web/main.vala
+++ b/src/web/main.vala
@@ -20,38 +20,59 @@ public Config cfg;
public AudioPlayer audio;
public PDFStock pdfStock;
string templatedir;
+string? shortname;
public static int main(string[] args) {
+ Intl.setlocale(LocaleCategory.ALL, "");
+ Intl.textdomain("shopsystem");
+
TlsCertificate? cert = null;
string certificate = "";
string privatekey = "";
uint port = 8080;
try {
- db = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Database", "/io/mainframe/shopsystem/database");
- pgp = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.PGP", "/io/mainframe/shopsystem/pgp");
- cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config");
- audio = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.AudioPlayer", "/io/mainframe/shopsystem/audio");
+ db = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Database", "/io/mainframe/shopsystem/database");
+ pgp = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.PGP", "/io/mainframe/shopsystem/pgp");
+ cfg = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config");
+ audio = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.AudioPlayer", "/io/mainframe/shopsystem/audio");
pdfStock = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.StockPDF", "/io/mainframe/shopsystem/stockpdf");
-
- templatedir = cfg.get_string("WEB", "filepath");
+ var datapath = cfg.get_string("GENERAL", "datapath");
+ templatedir = Path.build_filename(datapath, "templates");
port = cfg.get_integer("WEB", "port");
+ } catch(IOError e) {
+ error(_("IO Error: %s\n"), e.message);
+ } catch(KeyFileError e) {
+ error(_("KeyFile Error: %s\n"), e.message);
+ } catch(DBusError e) {
+ error(_("DBus Error: %s\n"), e.message);
+ }
- try {
- certificate = cfg.get_string("WEB", "cert");
- privatekey = cfg.get_string("WEB", "key");
- } catch(KeyFileError e) {
- warning("KeyFileError: %s\n", e.message);
- }
+ try {
+ certificate = cfg.get_string("WEB", "cert");
+ privatekey = cfg.get_string("WEB", "key");
+ } catch(KeyFileError e) {
+ warning(_("KeyFile Error: %s\n"), e.message);
} catch(IOError e) {
- error("IOError: %s\n", e.message);
+ error(_("IO Error: %s\n"), e.message);
+ } catch(DBusError e) {
+ error(_("DBus Error: %s\n"), e.message);
+ }
+
+ try {
+ shortname = cfg.get_string("GENERAL", "shortname");
} catch(KeyFileError e) {
- error("KeyFileError: %s\n", e.message);
+ shortname = "";
+ warning(_("KeyFile Error: %s\n"), e.message);
+ } catch(IOError e) {
+ error(_("IO Error: %s\n"), e.message);
+ } catch(DBusError e) {
+ error(_("DBus Error: %s\n"), e.message);
}
- stdout.printf("Web Server Port: %u\n", port);
- stdout.printf("TLS certificate: %s\n", certificate);
- stdout.printf("TLS private key: %s\n", privatekey);
+ stdout.printf(_("Web Server Port: %u\n"), port);
+ stdout.printf(_("TLS certificate: %s\n"), certificate);
+ stdout.printf(_("TLS private key: %s\n"), privatekey);
/* attach WebServer to MainLoop */
try {
@@ -59,7 +80,7 @@ public static int main(string[] args) {
cert = new TlsCertificate.from_files(certificate, privatekey);
new WebServer(port, cert);
} catch(Error e) {
- error("Could not start Webserver: %s\n", e.message);
+ error(_("Could not start Webserver: %s\n"), e.message);
}
/* start MainLoop */