Compare commits
3 Commits
b2342b1b64
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 51c2de4a19 | |||
| 923e05879d | |||
| 395ac4781a |
2
Makefile
2
Makefile
@@ -3,6 +3,6 @@ srcs += helpers.cpp
|
|||||||
srcs += TRMNL.cpp
|
srcs += TRMNL.cpp
|
||||||
|
|
||||||
all:
|
all:
|
||||||
g++ ${srcs} -o server
|
g++ ${srcs} -o server -lssl -lcrypto
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Required
|
// Required
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 0,
|
"port": 0,
|
||||||
"base_url": "https://trmnl.com/",
|
"base_url": "https://trmnl.com",
|
||||||
|
|
||||||
// Optional
|
// Optional
|
||||||
"devices_filename": "devices.json",
|
"devices_filename": "devices.json",
|
||||||
|
|||||||
10
main.cpp
10
main.cpp
@@ -17,6 +17,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
#include "httplib.h"
|
#include "httplib.h"
|
||||||
#include "json.hpp"
|
#include "json.hpp"
|
||||||
|
|
||||||
@@ -205,7 +206,7 @@ int main(int argc, char **argv)
|
|||||||
TRMNLContainer container;
|
TRMNLContainer container;
|
||||||
shared_mutex mut_container;
|
shared_mutex mut_container;
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc >= 2)
|
||||||
{
|
{
|
||||||
config_filename = argv[1];
|
config_filename = argv[1];
|
||||||
}
|
}
|
||||||
@@ -223,9 +224,8 @@ int main(int argc, char **argv)
|
|||||||
json_extract(cfg, "devices_filename", devices_filename);
|
json_extract(cfg, "devices_filename", devices_filename);
|
||||||
json_extract(cfg, "folder_images", folder_images);
|
json_extract(cfg, "folder_images", folder_images);
|
||||||
|
|
||||||
// TODO: Extract when SSL is ready
|
json_extract(cfg, "cert_file", cert_file);
|
||||||
// json_extract(cfg, "cert_file", cert_file);
|
json_extract(cfg, "key_file", key_file);
|
||||||
// json_extract(cfg, "key_file", cert_file);
|
|
||||||
|
|
||||||
json_extract(cfg, "refresh_min", refresh_min);
|
json_extract(cfg, "refresh_min", refresh_min);
|
||||||
json_extract(cfg, "refresh_offset", refresh_offset);
|
json_extract(cfg, "refresh_offset", refresh_offset);
|
||||||
@@ -262,7 +262,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (!cert_file.empty() && !key_file.empty())
|
if (!cert_file.empty() && !key_file.empty())
|
||||||
{
|
{
|
||||||
// TODO: Implement SSL Server Properly
|
server = make_shared<httplib::SSLServer>(cert_file.c_str(), key_file.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user