mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
Merge branch 'EntireTwix:main' into main
This commit is contained in:
commit
19b6acc48f
7 changed files with 31 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
||||||
build
|
build
|
||||||
ccash_config.hpp
|
ccash_config.hpp
|
||||||
deployment/.yamllint
|
deployment/.yamllint
|
||||||
|
config
|
||||||
10
docs/FAQ.md
10
docs/FAQ.md
|
|
@ -20,16 +20,20 @@
|
||||||
#### A : Because this usecase requires none of the features a database would offer.
|
#### A : Because this usecase requires none of the features a database would offer.
|
||||||
|
|
||||||
|
|
||||||
#### Q : People are making too many accounts/transactions maliciously to fill up space on my server!
|
#### Q : People are making too many accounts maliciously to fill up space on my server!
|
||||||
#### A : Consider disabling `ADD_USER_OPEN` in the [build proccess](https://github.com/EntireTwix/CCash/blob/main/docs/building.md).
|
#### A : Consider disabling `ADD_USER_OPEN` in the [build proccess](https://github.com/EntireTwix/CCash/blob/main/docs/building.md).
|
||||||
|
|
||||||
|
|
||||||
|
#### Q : People are making too many transactions filling up space on my server!
|
||||||
|
#### A : Consider setting the variable `MAX_LOG_SIZE` to 0 in the [build proccess](https://github.com/EntireTwix/CCash/blob/main/docs/building.md).
|
||||||
|
|
||||||
|
|
||||||
#### Q : My instance is taking up too much RAM
|
#### Q : My instance is taking up too much RAM
|
||||||
#### A : If your memory usage is too high I would reduce log size.
|
#### A : Reduce log size.
|
||||||
|
|
||||||
|
|
||||||
#### Q : My instance is taking up too much disk spac
|
#### Q : My instance is taking up too much disk spac
|
||||||
#### A : Use the purge users endpoint to delete old or superfluous accounts or reducing log size will reduce disk space but should be a last resort.
|
#### A : Use the prune users endpoint to dead accounts or you can reduce log size but should be a last resort.
|
||||||
|
|
||||||
|
|
||||||
#### Q : My instance is slow
|
#### Q : My instance is slow
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ as CCash is very lightweight it can run on practically any device but here are s
|
||||||
* `MAX_LOG_SIZE` should be adjusted as it takes up the most memory usage/storage of the ledger's features at ~203 bytes in memory and ~104 bytes in disk at default settings, so 5165 logs per Mb of RAM. Setting to 0 will disable logs
|
* `MAX_LOG_SIZE` should be adjusted as it takes up the most memory usage/storage of the ledger's features at ~203 bytes in memory and ~104 bytes in disk at default settings, so 5165 logs per Mb of RAM. Setting to 0 will disable logs
|
||||||
* with no users memory usage is 8.47 Mb
|
* with no users memory usage is 8.47 Mb
|
||||||
* Saving frequency (a runtime argument) being set to 0 will disable frequency saving and only save on close
|
* Saving frequency (a runtime argument) being set to 0 will disable frequency saving and only save on close
|
||||||
|
* make backups of your save files
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
If you want to use the docker package, deploy information can be found [here](deploy.md)
|
If you want to use the docker package, deploy information can be found [here](deploy.md)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
| [SpaceCat](https://github.com/SpaceCat-Chan) | CCLua | [CatsCCashLuaApi](https://github.com/SpaceCat-Chan/CatsCCashLuaApi) | :heavy_check_mark: |
|
| [SpaceCat](https://github.com/SpaceCat-Chan) | CCLua | [CatsCCashLuaApi](https://github.com/SpaceCat-Chan/CatsCCashLuaApi) | :heavy_check_mark: |
|
||||||
| [Luke](https://github.com/LukeeeeBennett/ccash-client-js) | JS | [ccash client js](https://github.com/LukeeeeBennett/ccash-client-js) | :heavy_multiplication_x: |
|
| [Luke](https://github.com/LukeeeeBennett/ccash-client-js) | JS | [ccash client js](https://github.com/LukeeeeBennett/ccash-client-js) | :heavy_multiplication_x: |
|
||||||
| [Doggo](https://github.com/FearlessDoggo21) | Python | [CCashPythonClient](https://github.com/FearlessDoggo21/CCashPythonClient) | :heavy_check_mark: |
|
| [Doggo](https://github.com/FearlessDoggo21) | Python | [CCashPythonClient](https://github.com/FearlessDoggo21/CCashPythonClient) | :heavy_check_mark: |
|
||||||
| [Sam](https://github.com/STBoyden) | Rust | [ccash rs](https://git.stboyden.com/STBoyden/ccash-rs) | :heavy_check_mark: |
|
| [Sam](https://github.com/STBoyden) | Rust | [ccash rs](https://github.com/STBoyden/ccash-rs) | :heavy_check_mark: |
|
||||||
|
|
||||||
for example here is a demo program for the lua API by SpaceCat
|
for example here is a demo program for the lua API by SpaceCat
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
# Contributors
|
# Contributors
|
||||||
| name | work |
|
| name | work |
|
||||||
| :------------------------------------------- | ---------------------------- |
|
| :------------------------------------------- | ---------------------------------- |
|
||||||
| [Luke](https://github.com/LukeeeeBennett) | Docker package, JS API |
|
| [Luke](https://github.com/LukeeeeBennett) | Github Actions, and JS API |
|
||||||
| [React](https://github.com/Reactified) | Logo, deprecated CCLua API |
|
| [React](https://github.com/Reactified) | Logo, CC Wallet/Shop/ATM |
|
||||||
| [Doggo](https://github.com/FearlessDoggo21) | HTTP suggestions, Python API |
|
| [Doggo](https://github.com/FearlessDoggo21) | HTTP advice, Python API, and C CLI |
|
||||||
| [SpaceCat](https://github.com/SpaceCat-Chan) | CCLua API |
|
| [SpaceCat](https://github.com/SpaceCat-Chan) | CCLua API |
|
||||||
| [Expand](https://github.com/Expand-sys) | Fixed docker package |
|
| [Expand](https://github.com/Expand-sys) | Docker, and Ansible |
|
||||||
| [Sam](https://github.com/STBoyden) | Rust API |
|
| [Sam](https://github.com/STBoyden) | Rust API |
|
||||||
| Caesay | Restful API suggestions |
|
| Caesay | Restful API advice |
|
||||||
|
|
@ -19,7 +19,7 @@ as explained in earlier docs a ecosystem of connected services allows you many w
|
||||||
#### APIs
|
#### APIs
|
||||||
for devs who wanna make more connected services, existing APIs exist in multiple lanaguages enabling faster development/maintenance.
|
for devs who wanna make more connected services, existing APIs exist in multiple lanaguages enabling faster development/maintenance.
|
||||||
#### External
|
#### External
|
||||||
its game indepedent meaning you dont have to be in-game to use it.
|
its game indepedent meaning you dont have to be in-game to use it. With support for Docker and Ansible Playbook.
|
||||||
## Security
|
## Security
|
||||||
#### HTTPS
|
#### HTTPS
|
||||||
OpenSSL is used to secure the HTTP server.
|
OpenSSL is used to secure the HTTP server.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "bank_api.h"
|
#include "bank_api.h"
|
||||||
|
|
||||||
|
// TODO: parser iterate(input).get(doc) error handling might be superfulous
|
||||||
|
|
||||||
#define CACHE_FOREVER resp->setExpiredTime(0)
|
#define CACHE_FOREVER resp->setExpiredTime(0)
|
||||||
|
|
||||||
#define CORS resp->addHeader("Access-Control-Allow-Origin", "*")
|
#define CORS resp->addHeader("Access-Control-Allow-Origin", "*")
|
||||||
|
|
@ -51,8 +53,8 @@ void api::SendFunds(req_args)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
uint64_t amount; // simdjson lacks .get(uint32_t support)
|
uint64_t amount; // as simdjson lacks .get(uint32_t support)
|
||||||
if (doc["name"].get(name) || doc["time"].get(amount))
|
if (doc["name"].get(name) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +137,7 @@ void api::SetBal(req_args)
|
||||||
{
|
{
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
uint64_t amount;
|
uint64_t amount;
|
||||||
if (doc["name"].get(name) || doc["time"].get(amount))
|
if (doc["name"].get(name) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +161,7 @@ void api::ImpactBal(req_args)
|
||||||
{
|
{
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
int64_t amount;
|
int64_t amount;
|
||||||
if (doc["name"].get(name) || doc["time"].get(amount))
|
if (doc["name"].get(name) || doc["amount"].get(amount))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +233,7 @@ void api::PruneUsers(req_args)
|
||||||
#if MAX_LOG_SIZE > 0
|
#if MAX_LOG_SIZE > 0
|
||||||
int64_t time;
|
int64_t time;
|
||||||
uint64_t amount;
|
uint64_t amount;
|
||||||
if (doc["time"].get(time) || doc["time"].get(amount))
|
if (doc["time"].get(time) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +243,7 @@ void api::PruneUsers(req_args)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uint64_t amount
|
uint64_t amount
|
||||||
if (doc["time"].get(amount))
|
if (doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -301,7 +303,7 @@ void api::AdminAddUser(req_args)
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
uint64_t amount;
|
uint64_t amount;
|
||||||
std::string_view pass;
|
std::string_view pass;
|
||||||
if (doc["name"].get(name) || doc["time"].get(amount) || doc["time"].get(pass))
|
if (doc["name"].get(name) || doc["amount"].get(amount) || doc["time"].get(pass) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue