diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2c7326f..c1b806a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,7 @@ { "label": "build", "type": "shell", - "command": "cmake -S . -B build && cmake --build build", + "command": "cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build build && cp build/compile_commands.json compile_commands.json", "group": "build", "problemMatcher": [ "$gcc" @@ -13,7 +13,7 @@ { "label": "build release", "type": "shell", - "command": "cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build", + "command": "cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build build && cp build/compile_commands.json compile_commands.json ", "group": "build", "problemMatcher": [ "$gcc" @@ -26,6 +26,12 @@ "options": { "cwd": "frontend" } - } + }, + { + "label": "clean", + "type": "shell", + "command": "rm -rf build/*", + "group": "build", + }, ] } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 49e7a73..4c0032d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ endif() file(GLOB_RECURSE ASSETS_FILES "${CMAKE_SOURCE_DIR}/assets/*") file(GLOB_RECURSE FRONTEND_FILES "${CMAKE_SOURCE_DIR}/frontend/build/*") -foreach(file IN LISTS STATIC_FILES) +foreach(file IN LISTS ASSETS_FILES) file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}") configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY) endforeach() diff --git a/assets/favicon.ico b/assets/favicon.ico new file mode 100644 index 0000000..ac282d3 Binary files /dev/null and b/assets/favicon.ico differ diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..351ea12 Binary files /dev/null and b/assets/favicon.png differ diff --git a/assets/settings.json b/assets/settings.json index 5c01519..4f0edd5 100644 --- a/assets/settings.json +++ b/assets/settings.json @@ -1,5 +1,5 @@ { "http_port" : 3010, - "db_path": "/var/lib/shadowrun-server/shadowrun.db", - "url": "*" + "db_path": "shadowrun.db", + "domain": "*" } \ No newline at end of file diff --git a/frontend/src/app.html b/frontend/src/app.html index f273cc5..b9c45d8 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -3,6 +3,7 @@
+ %sveltekit.head% diff --git a/frontend/static/favicon.ico b/frontend/static/favicon.ico new file mode 100644 index 0000000..ac282d3 Binary files /dev/null and b/frontend/static/favicon.ico differ diff --git a/source/cors.h b/source/cors.h deleted file mode 100644 index 351111e..0000000 --- a/source/cors.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __CORS_H__ -#define __CORS_H__ - -#include "crow.h" -#include "json_settings.h" - -extern AppSettings::Settings settings; - -struct CORS { - // required inner type for Crow middleware - struct context {}; - - void before_handle(crow::request& req, crow::response& res, context& /*ctx*/) { - // allow all origins (for dev); replace "*" with your frontend URL in production - res.add_header("Access-Control-Allow-Origin", settings.url); - res.add_header("Access-Control-Allow-Methods", "POST, GET, OPTIONS"); - res.add_header("Access-Control-Allow-Headers", "Content-Type"); - - // automatically handle preflight - if (req.method == crow::HTTPMethod::OPTIONS) { - res.end(); // stop here — no routing needed - } - } - - // run after handler (not needed for CORS, but must be present) - void after_handle(crow::request&, crow::response&, context&) {} -}; - -#endif // __CORS_H__ \ No newline at end of file diff --git a/source/json_settings.cpp b/source/json_settings.cpp index 4104251..313f19a 100644 --- a/source/json_settings.cpp +++ b/source/json_settings.cpp @@ -12,7 +12,7 @@ Settings AppSettings::deafult(){ return Settings { .http_port = 3010, .db_path = "/var/lib/shadowrun-server/shadowrun.db", - .url = "*" + .domain = "*" }; } diff --git a/source/json_settings.h b/source/json_settings.h index 9be49cb..48fd866 100644 --- a/source/json_settings.h +++ b/source/json_settings.h @@ -10,12 +10,12 @@ static constexpr char settingsFile[] = "assets/settings.json"; struct Settings { int http_port; std::string db_path; - std::string url; + std::string domain; }; Settings load(); Settings deafult(); -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Settings, http_port, db_path, url); +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Settings, http_port, db_path, domain); } #endif // JSON_SETTINGS_H \ No newline at end of file diff --git a/source/login/login.cpp b/source/login/login.cpp index 6974fbe..89413d0 100644 --- a/source/login/login.cpp +++ b/source/login/login.cpp @@ -45,8 +45,7 @@ std::optional