mirror of
https://github.com/Karaka-Management/oms-OnlineResourceWatcher.git
synced 2026-02-07 11:58:41 +00:00
merge NO_CI
This commit is contained in:
commit
ceb0a378fc
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
|
|
@ -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']
|
||||
11
.github/dependabot.yaml
vendored
Normal file
11
.github/dependabot.yaml
vendored
Normal file
|
|
@ -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"
|
||||
32
.github/workflows/cd.yml
vendored
Normal file
32
.github/workflows/cd.yml
vendored
Normal file
|
|
@ -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 }}
|
||||
|
||||
13
.github/workflows/greetings.yml
vendored
Normal file
13
.github/workflows/greetings.yml
vendored
Normal file
|
|
@ -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.'
|
||||
35
.github/workflows/main.yml
vendored
Normal file
35
.github/workflows/main.yml
vendored
Normal file
|
|
@ -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 }}
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
BIN
app/server/Dependencies/win-x64/libcrypto-3-x64.dll
Normal file
BIN
app/server/Dependencies/win-x64/libcrypto-3-x64.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/libcurl.dll
Normal file
BIN
app/server/Dependencies/win-x64/libcurl.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/libintl-9.dll
Normal file
BIN
app/server/Dependencies/win-x64/libintl-9.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/libmariadb.dll
Normal file
BIN
app/server/Dependencies/win-x64/libmariadb.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/libpq.dll
Normal file
BIN
app/server/Dependencies/win-x64/libpq.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/libssl-3-x64.dll
Normal file
BIN
app/server/Dependencies/win-x64/libssl-3-x64.dll
Normal file
Binary file not shown.
BIN
app/server/Dependencies/win-x64/sqlite3.dll
Normal file
BIN
app/server/Dependencies/win-x64/sqlite3.dll
Normal file
Binary file not shown.
|
|
@ -73,6 +73,9 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>C:\Users\deich\git\OnlineResourceWatcherApp\app\server;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
|
@ -105,12 +108,16 @@
|
|||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>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)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>5208;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>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)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>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)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -12,11 +12,12 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <regex.h>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#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<const std::string&>().c_str()),
|
||||
app.config["db"]["core"]["masters"]["admin"]["database"].get_ref<const std::string&>().c_str(),
|
||||
app.config["db"]["core"]["masters"]["admin"]["host"].get_ref<const std::string&>().c_str(),
|
||||
app.config["db"]["core"]["masters"]["admin"]["port"].get<int>(),
|
||||
app.config["db"]["core"]["masters"]["admin"]["login"].get_ref<const std::string&>().c_str(),
|
||||
app.config["db"]["core"]["masters"]["admin"]["password"].get_ref<const std::string&>().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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user