From fd11a4d52a5db7bbc23f7eb079f5cecc153e9a02 Mon Sep 17 00:00:00 2001 From: Expand-sys <79956551+Expand-sys@users.noreply.github.com> Date: Fri, 18 Jun 2021 12:37:32 +1000 Subject: [PATCH 1/8] patch for ccashdeploy docker --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 4babcca..9f75f55 100644 --- a/main.cpp +++ b/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char **argv) bank.admin_pass = argv[1]; //Auto Saving - const unsigned long saving_freq = std::stoul(argv[2]); + const unsigned long saving_freq = std::stoul(std::string(argv[2])); if (saving_freq) //if saving frequency is 0 then auto saving is turned off { std::thread([saving_freq]() { @@ -73,7 +73,7 @@ int main(int argc, char **argv) [](const drogon::HttpRequestPtr &req, const drogon::HttpResponsePtr &resp) { resp->addHeader("Access-Control-Allow-Origin", "*"); }); - app().loadConfigFile(config_location).registerController(API).setThreadNum(std::stoul(argv[3])).run(); + app().loadConfigFile(config_location).registerController(API).setThreadNum(std::stoul(std::string(argv[3]))).run(); return 0; } From 30a3a854318da1f12477aa694691329dd1e2f1f1 Mon Sep 17 00:00:00 2001 From: William Katz Date: Thu, 17 Jun 2021 21:12:11 -0700 Subject: [PATCH 2/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b046771..032f1cd 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Thank you to the contributors | Name | Project Work | Connected Service Work | | :------------------------------------------ | ---------------------------------------------------------- | ---------------------- | -| [Expand](https://github.com/Expand-sys) | `N/A` | Frontend | +| [Expand](https://github.com/Expand-sys) | Slight docker changes | Frontend | | [React](https://github.com/Reactified) | Logo | CC {API, Shops, ATM} | | [Doggo](https://github.com/FearlessDoggo21) | Logs loading/adding Optimized, HTTP convention suggestions | `N/A` | | [Luke](https://github.com/LukeeeeBennett) | Docker, Slight Doc edits | JS API | From 78ca9dad02aa5aae2d8ba9ca09842aacc2fe9cc6 Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 08:13:48 -0700 Subject: [PATCH 3/8] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 032f1cd..977aed0 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ Thank you to the contributors | Name | Project Work | Connected Service Work | | :------------------------------------------ | ---------------------------------------------------------- | ---------------------- | | [Expand](https://github.com/Expand-sys) | Slight docker changes | Frontend | -| [React](https://github.com/Reactified) | Logo | CC {API, Shops, ATM} | +| [React](https://github.com/Reactified) | CC API, Logo | CC Shop, CC ATM. | | [Doggo](https://github.com/FearlessDoggo21) | Logs loading/adding Optimized, HTTP convention suggestions | `N/A` | -| [Luke](https://github.com/LukeeeeBennett) | Docker, Slight Doc edits | JS API | +| [Luke](https://github.com/LukeeeeBennett) | JS API, Docker, Slight Doc edits | `N/A` | | [Jolly](https://github.com/STBoyden) | Slight Doc edits | `N/A` | ## Features From 209d333240fd7471261f4ffbf87c65c16690356b Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 09:20:21 -0700 Subject: [PATCH 4/8] Update .dockerignore --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index dd50c2f..b28e804 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ /build /config.json /users.json +/*.md From ccc6a10dca993c6779124d201f23a917e59b8e05 Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 10:44:06 -0700 Subject: [PATCH 5/8] Order --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 977aed0..d0aee46 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,10 @@ Thank you to the contributors | Name | Project Work | Connected Service Work | | :------------------------------------------ | ---------------------------------------------------------- | ---------------------- | -| [Expand](https://github.com/Expand-sys) | Slight docker changes | Frontend | -| [React](https://github.com/Reactified) | CC API, Logo | CC Shop, CC ATM. | -| [Doggo](https://github.com/FearlessDoggo21) | Logs loading/adding Optimized, HTTP convention suggestions | `N/A` | | [Luke](https://github.com/LukeeeeBennett) | JS API, Docker, Slight Doc edits | `N/A` | +| [React](https://github.com/Reactified) | CC API, Logo | CC Shop, CC ATM. | +| [Expand](https://github.com/Expand-sys) | Slight docker changes | Frontend | +| [Doggo](https://github.com/FearlessDoggo21) | Logs loading/adding Optimized, HTTP convention suggestions | `N/A` | | [Jolly](https://github.com/STBoyden) | Slight Doc edits | `N/A` | ## Features From 9f58dda6d2c7d5ad7afa45d706e7798876574416 Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 10:48:19 -0700 Subject: [PATCH 6/8] Order --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0aee46..eecc1a2 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ Thank you to the contributors | Name | Project Work | Connected Service Work | | :------------------------------------------ | ---------------------------------------------------------- | ---------------------- | -| [Luke](https://github.com/LukeeeeBennett) | JS API, Docker, Slight Doc edits | `N/A` | -| [React](https://github.com/Reactified) | CC API, Logo | CC Shop, CC ATM. | | [Expand](https://github.com/Expand-sys) | Slight docker changes | Frontend | +| [React](https://github.com/Reactified) | CC API, Logo | CC Shop, CC ATM. | +| [Luke](https://github.com/LukeeeeBennett) | JS API, Docker, Slight Doc edits | `N/A` | | [Doggo](https://github.com/FearlessDoggo21) | Logs loading/adding Optimized, HTTP convention suggestions | `N/A` | | [Jolly](https://github.com/STBoyden) | Slight Doc edits | `N/A` | From 04bf0c55e41a81a32f76839d3d33abe60bfe5aa9 Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 12:21:37 -0700 Subject: [PATCH 7/8] :racehorse: reduces json parsing to 0ns json parsing used to be 75% of functions like GetBal's cost, but now its 0% as its just moved in and implicitly cast to Json::Value --- src/bank_f.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/bank_f.cpp b/src/bank_f.cpp index de8cb40..c62b1d9 100644 --- a/src/bank_f.cpp +++ b/src/bank_f.cpp @@ -1,35 +1,12 @@ #include "bank_f.h" -#define JSON(V) callback(HttpResponse::newHttpJsonResponse(JsonReturn(V))); +#define JSON(V) callback(HttpResponse::newHttpJsonResponse(V)); #define INLINE __attribute__((always_inline)) inline #define GEN_BODY \ const auto temp_req = req->getJsonObject(); \ const auto body = temp_req ? *temp_req : Json::Value(); #define PASS_HEADER req->getHeader("Password") -template -INLINE Json::Value JsonReturn(T &&val) -{ - Json::Value res; - if constexpr (std::is_same_v) - { - res["value"] = (int)val; //becuase of json lib interpreting 67 as 'A' for example - } - else if constexpr (std::is_same_v) - { - res["value"] = (Json::Int64)val; - } - else if constexpr (std::is_same_v) - { - res["value"] = (Json::Int64)val; - } - else - { - res["value"] = val; - } - return res; -} - BankF::BankF(Bank *b) : bank(*b) {} void BankF::Help(req_args) const @@ -118,4 +95,4 @@ void BankF::GetLog(req_args, const std::string &name) resp->setExpiredTime(0); //cached forever callback(resp); } -} \ No newline at end of file +} From f541e16a4df76dc9a6cb2cedd0fc36dc8983c909 Mon Sep 17 00:00:00 2001 From: William Katz Date: Fri, 18 Jun 2021 12:22:11 -0700 Subject: [PATCH 8/8] :fire: GEN_BODY is no longer needed --- src/bank_f.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/bank_f.cpp b/src/bank_f.cpp index c62b1d9..cef52c6 100644 --- a/src/bank_f.cpp +++ b/src/bank_f.cpp @@ -2,9 +2,6 @@ #define JSON(V) callback(HttpResponse::newHttpJsonResponse(V)); #define INLINE __attribute__((always_inline)) inline -#define GEN_BODY \ - const auto temp_req = req->getJsonObject(); \ - const auto body = temp_req ? *temp_req : Json::Value(); #define PASS_HEADER req->getHeader("Password") BankF::BankF(Bank *b) : bank(*b) {}