diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..9b0c38d
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # orange_management
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: ['https://paypal.me/orangemgmt']
diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml
new file mode 100644
index 0000000..cc5dba6
--- /dev/null
+++ b/.github/dependabot.yaml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "gitsubmodule" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "weekly"
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
new file mode 100644
index 0000000..a1842a9
--- /dev/null
+++ b/.github/workflows/cd.yml
@@ -0,0 +1,32 @@
+name: CD
+
+on:
+ workflow_dispatch:
+ inputs:
+ tags:
+ description: 'Release Tag'
+ required: true
+
+env:
+ APP_NAME: OnlineResourceWatcherApp
+
+jobs:
+ build:
+ runs-on: windows-latest
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ncipollo/release-action@v1
+ with:
+ artifacts: ""
+ tag: ${{ github.event.inputs.tags }}
+ token: ${{ secrets.GITHUB_TOKEN }}
+ artifactErrorsFailBuild: true
+ - uses: dev-drprasad/delete-older-releases@v0.2.0
+ with:
+ keep_latest: 3
+ delete_tags: true
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml
new file mode 100644
index 0000000..adb8716
--- /dev/null
+++ b/.github/workflows/greetings.yml
@@ -0,0 +1,13 @@
+name: Greetings
+
+on: [pull_request, issues]
+
+jobs:
+ greeting:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/first-interaction@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
+ pr-message: 'Thank you for your pull request. We will check it as soon as possible.'
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..6558e33
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,35 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+ codestyle-tests:
+ runs-on: ubuntu-latest
+ if: "!contains(github.event.head_commit.message, 'NO_CI')"
+ strategy:
+ fail-fast: false
+ max-parallel: 3
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@main
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ token: ${{ secrets.GH_TOKEN }}
+ - name: Checkout Build Repository
+ uses: actions/checkout@main
+ with:
+ fetch-depth: 1
+ ref: develop
+ repository: Karaka-Management/Build
+ path: Build
+ - name: Copy config file
+ run: |
+ cp ./Build/Config/.clang-format ./.clang-format
+ - name: Lint Code Base
+ uses: github/super-linter/slim@v4
+ env:
+ VALIDATE_ALL_CODEBASE: false
+ VALIDATE_CLANG_FORMAT : true
+ DEFAULT_BRANCH: develop
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 0c5acab..215a9e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
.vs
obj/
-*.cache
-.directory
bin/Debug
x64/Debug
app/server/Libraries
@@ -30,3 +28,6 @@ coverage.xml
*.cache
*.phar
*.xml
+app/server/bin/x64/Debug
+app/server/x64/Debug
+.vscode
diff --git a/app/server/Controller/ApiController.h b/app/server/Controller/ApiController.h
index 4e5c3ba..c51156b 100755
--- a/app/server/Controller/ApiController.h
+++ b/app/server/Controller/ApiController.h
@@ -78,7 +78,7 @@ namespace Controller {
Hash::Meow::meow_u128 h1 = Hash::Meow::MeowHash(Hash::Meow::MeowDefaultSeed, f1.size, f1.content);
Hash::Meow::meow_u128 h2 = Hash::Meow::MeowHash(Hash::Meow::MeowDefaultSeed, f2.size, f2.content);
- return Hash::Meow::MeowHashesAreEqual(h1, h2);
+ return MeowHashesAreEqual(h1, h2);
}
Utils::FileUtils::file_body hasChanged(char *oldResource, char *newResource, time_t lastChange)
@@ -90,8 +90,8 @@ namespace Controller {
++length;
}
- Utils::FileUtils::file_body f1;
- Utils::FileUtils::file_body f2;
+ Utils::FileUtils::file_body f1 = {0};
+ Utils::FileUtils::file_body f2 = {0};
bool isFileModified = false;
if (length > 5
@@ -109,7 +109,7 @@ namespace Controller {
}
}
- bool hasChanged = isFileModified || hasResourceContentChanged(f1, f2);
+ bool hasChanged = f1.content && f2.content && (isFileModified || hasResourceContentChanged(f1, f2));
free(f1.content);
f1.size = -1;
diff --git a/app/server/Controller/InstallController.h b/app/server/Controller/InstallController.h
index d14db20..5b8496c 100755
--- a/app/server/Controller/InstallController.h
+++ b/app/server/Controller/InstallController.h
@@ -16,32 +16,14 @@
#include "cOMS/Utils/Parser/Json.h"
#include "cOMS/Utils/ArrayUtils.h"
-#include "DataStorage/Database/Connection/ConnectionFactory.h"
-#include "DataStorage/Database/Connection/ConnectionAbstract.h"
-#include "DataStorage/Database/Connection/DbConnectionConfig.h"
+#include "../cOMS/DataStorage/Database/Connection/ConnectionFactory.h"
+#include "../cOMS/DataStorage/Database/Connection/ConnectionAbstract.h"
+#include "../cOMS/DataStorage/Database/Connection/DbConnectionConfig.h"
#include "../Models/InstallType.h"
namespace Controller {
namespace InstallController {
- void installApplication(int argc, char **argv)
- {
- Models::InstallType type = (Models::InstallType) atoi(Utils::ArrayUtils::get_arg("-t", argv, argc));
-
- int status = 0;
- if (type == Models::InstallType::WEB) {
- status = installWeb();
- } else {
- status = installLocal();
- }
-
- if (status == 0) {
- printf("Application successfully installed\n");
- } else {
- printf("Application installation failed\n");
- }
- }
-
int installWeb()
{
// Create config by copying weg config (nothing else necessary)
@@ -114,6 +96,26 @@ namespace Controller {
return 0;
}
+ void installApplication(int argc, char** argv)
+ {
+ Models::InstallType type = (Models::InstallType)atoi(Utils::ArrayUtils::get_arg("-t", argv, argc));
+
+ int status = 0;
+ if (type == Models::InstallType::WEB) {
+ status = installWeb();
+ }
+ else {
+ status = installLocal();
+ }
+
+ if (status == 0) {
+ printf("Application successfully installed\n");
+ }
+ else {
+ printf("Application installation failed\n");
+ }
+ }
+
void parseConfigFile()
{
FILE *fp = fopen("config.json", "r");
diff --git a/app/server/Dependencies/win-x64/libcrypto-3-x64.dll b/app/server/Dependencies/win-x64/libcrypto-3-x64.dll
new file mode 100644
index 0000000..cd0566c
Binary files /dev/null and b/app/server/Dependencies/win-x64/libcrypto-3-x64.dll differ
diff --git a/app/server/Dependencies/win-x64/libcurl.dll b/app/server/Dependencies/win-x64/libcurl.dll
new file mode 100644
index 0000000..a1e8e36
Binary files /dev/null and b/app/server/Dependencies/win-x64/libcurl.dll differ
diff --git a/app/server/Dependencies/win-x64/libintl-9.dll b/app/server/Dependencies/win-x64/libintl-9.dll
new file mode 100644
index 0000000..82ffaad
Binary files /dev/null and b/app/server/Dependencies/win-x64/libintl-9.dll differ
diff --git a/app/server/Dependencies/win-x64/libmariadb.dll b/app/server/Dependencies/win-x64/libmariadb.dll
new file mode 100644
index 0000000..854e81f
Binary files /dev/null and b/app/server/Dependencies/win-x64/libmariadb.dll differ
diff --git a/app/server/Dependencies/win-x64/libpq.dll b/app/server/Dependencies/win-x64/libpq.dll
new file mode 100644
index 0000000..5d504ec
Binary files /dev/null and b/app/server/Dependencies/win-x64/libpq.dll differ
diff --git a/app/server/Dependencies/win-x64/libssl-3-x64.dll b/app/server/Dependencies/win-x64/libssl-3-x64.dll
new file mode 100644
index 0000000..40ca109
Binary files /dev/null and b/app/server/Dependencies/win-x64/libssl-3-x64.dll differ
diff --git a/app/server/Dependencies/win-x64/sqlite3.dll b/app/server/Dependencies/win-x64/sqlite3.dll
new file mode 100644
index 0000000..6676ae0
Binary files /dev/null and b/app/server/Dependencies/win-x64/sqlite3.dll differ
diff --git a/app/server/OnlineResourceWatcherServerApp.vcxproj b/app/server/OnlineResourceWatcherServerApp.vcxproj
index 0e3884d..c745d21 100755
--- a/app/server/OnlineResourceWatcherServerApp.vcxproj
+++ b/app/server/OnlineResourceWatcherServerApp.vcxproj
@@ -73,6 +73,9 @@
C:\Users\deich\git\OnlineResourceWatcherApp\app\server;$(IncludePath)
+
+ $(SolutionDir)bin\$(Platform)\$(Configuration)
+
Level3
@@ -105,12 +108,16 @@
Level3
true
- _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
true
+ C:\Users\deich\git\OnlineResourceWatcherApp\app\server\cOMS\Resources\sqlite\src;C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include;C:\Program Files\PostgreSQL\15\include;C:\libs\curl\builds\libcurl-vc-x64-release-dll-ipv6-sspi-schannel\include;%(AdditionalIncludeDirectories)
+ 5208;%(DisableSpecificWarnings)
Console
true
+ C:\Users\deich\git\OnlineResourceWatcherApp\app\server\cOMS\Resources\sqlite\lib\x64\sqlite3.lib;C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\libmariadb.lib;C:\Program Files\PostgreSQL\15\lib\libpq.lib;C:\libs\curl\builds\libcurl-vc-x64-release-dll-ipv6-sspi-schannel\lib\libcurl.lib;%(AdditionalDependencies)
+ C:\Users\deich\git\OnlineResourceWatcherApp\app\server\cOMS\Resources\sqlite\lib\x64;C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib;C:\Program Files\PostgreSQL\15\lib;C:\libs\curl\builds\libcurl-vc-x64-release-dll-ipv6-sspi-schannel\lib;%(AdditionalLibraryDirectories)
diff --git a/app/server/OnlineResourceWatcherServerApp.vcxproj.user b/app/server/OnlineResourceWatcherServerApp.vcxproj.user
index 88a5509..5df420f 100755
--- a/app/server/OnlineResourceWatcherServerApp.vcxproj.user
+++ b/app/server/OnlineResourceWatcherServerApp.vcxproj.user
@@ -1,4 +1,6 @@
-
+
+ false
+
\ No newline at end of file
diff --git a/app/server/Routes.h b/app/server/Routes.h
index 7e2d34e..b89afa0 100755
--- a/app/server/Routes.h
+++ b/app/server/Routes.h
@@ -12,11 +12,12 @@
#include
#include
-#include
+#include
+#include
#include "Controller/ApiController.h"
#include "Controller/InstallController.h"
-#include "Stdlib/HashTable.h"
+#include "cOMS/Stdlib/HashTable.h"
typedef void (*Fptr)(int, char **);
@@ -41,12 +42,14 @@ Fptr match_route(Stdlib::HashTable::ht *routes, char *uri)
Fptr ptr = NULL;
Stdlib::HashTable::it itr = Stdlib::HashTable::table_iterator(routes);
- regex_t regex;
- while (Stdlib::HashTable::next(&itr)) {
- regcomp(®ex, itr.key, 0);
+ std::regex regex;
+ std::cmatch match;
- int status = regexec(®ex, uri, 0, NULL, 0);
- if (status == 0) {
+ while (Stdlib::HashTable::next(&itr)) {
+ regex = std::regex(itr.key);
+
+ bool status = std::regex_search(uri, match, regex);
+ if (status) {
ptr = (Fptr) itr.value;
}
}
diff --git a/app/server/main.cpp b/app/server/main.cpp
index 48a8bcc..2bb6e09 100755
--- a/app/server/main.cpp
+++ b/app/server/main.cpp
@@ -12,9 +12,9 @@
#include
#include "cOMS/Utils/ApplicationUtils.h"
-#include "DataStorage/Database/Connection/ConnectionAbstract.h"
+#include "cOMS/DataStorage/Database/Connection/ConnectionAbstract.h"
#include "cOMS/Utils/Parser/Json.h"
-#include "Stdlib/HashTable.h"
+#include "cOMS/Stdlib/HashTable.h"
#include "Routes.h"
@@ -27,13 +27,13 @@ typedef struct {
nlohmann::json config;
} App;
-App app;
+App app = {0};
int main(int argc, char **argv)
{
/* --------------- Basic setup --------------- */
- char *arg = Utils::ApplicationUtils::compile_arg_line(argc, argv);
+ const char *arg = Utils::ApplicationUtils::compile_arg_line(argc, argv);
// Set program path as cwd
char *cwd = Utils::ApplicationUtils::cwd();
@@ -42,6 +42,9 @@ int main(int argc, char **argv)
return -1;
}
+ char *cwdT = Utils::StringUtils::search_replace(cwd, "\\", "/");
+ free(cwd);
+ cwd = cwdT;
Utils::ApplicationUtils::chdir_application(cwd, argv[0]);
@@ -65,17 +68,17 @@ int main(int argc, char **argv)
fclose(in);
// Setup db connection
- DataStorage::Database::DbConnectionConfig dbdata = (DataStorage::Database::DbConnectionConfig) {
- db = DataStorage::Database::database_type_from_str(&app.config["db"]["core"]["masters"]["admin"]["db"]),
- database = &app.config["db"]["core"]["masters"]["admin"]["database"],
- host = &app.config["db"]["core"]["masters"]["admin"]["host"],
- port = app.config["db"]["core"]["masters"]["admin"]["port"],
- login = &app.config["db"]["core"]["masters"]["admin"]["login"],
- password = &app.config["db"]["core"]["masters"]["admin"]["password"],
+ DataStorage::Database::DbConnectionConfig dbdata = {
+ DataStorage::Database::database_type_from_str(app.config["db"]["core"]["masters"]["admin"]["db"].get_ref().c_str()),
+ app.config["db"]["core"]["masters"]["admin"]["database"].get_ref().c_str(),
+ app.config["db"]["core"]["masters"]["admin"]["host"].get_ref().c_str(),
+ app.config["db"]["core"]["masters"]["admin"]["port"].get(),
+ app.config["db"]["core"]["masters"]["admin"]["login"].get_ref().c_str(),
+ app.config["db"]["core"]["masters"]["admin"]["password"].get_ref().c_str(),
};
- app->db = DataStorage::Database::create_connection(dbdata);
- app->db->connect();
+ app.db = DataStorage::Database::create_connection(dbdata);
+ app.db->connect();
/* --------------- Handle request --------------- */
@@ -85,21 +88,21 @@ int main(int argc, char **argv)
return -1;
}
- Fptr ptr = match_route(routes, arg);
+ Fptr ptr = match_route(routes, (char *) arg);
// Dispatch found endpoint
(*ptr)(argc, argv);
/* --------------- Cleanup --------------- */
- app->db->close();
- $app->db = NULL;
+ app.db->close();
+ app.db = NULL;
Stdlib::HashTable::free_table(routes);
free(routes);
routes = NULL;
- free(arg);
+ free((char *) arg);
arg = NULL;
// Reset CWD (don't know if this is necessary)