Fix building and add development notes
FossilOrigin-Name: 6ef66a2a38b194647df4824af7d908d058610cad47f31368e51eed4a68184cb4
This commit is contained in:
parent
09f993d8a3
commit
c7c9afb2a3
9 changed files with 38 additions and 16 deletions
|
@ -11,6 +11,12 @@ project(wormhole
|
|||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(Module)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
# C++ settings
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
add_compile_options(-Wall -Wno-reorder)
|
||||
|
||||
# Main executable of Wormhole
|
||||
add_executable(wormhole ${PROJECT_SOURCE_DIR}/src/main.cpp)
|
||||
|
||||
|
@ -67,12 +73,6 @@ find_package(OpenSSL REQUIRED)
|
|||
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)
|
||||
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
# C++ settings
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
add_compile_options(-Wall -Wno-unused-function -Wno-reorder)
|
||||
|
||||
# Config directories definition
|
||||
# TODO customizing
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
|
14
docs/NOTES.md
Normal file
14
docs/NOTES.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Development notes
|
||||
|
||||
**Don't trust these except as a last resort! They are exposed as a "TODO" list,
|
||||
essentially, and just to jot down random thoughts from me as I go along**
|
||||
|
||||
### Needed to build on FreeBSD:
|
||||
|
||||
- `setenv PKG_CONFIG_PATH /usr/local/libdata/pkgconfig:/usr/local/lib/pkgconfig`
|
||||
- `setenv CFLAGS "-I/usr/local/include"`
|
||||
- `setenv LDFLAGS "-L/usr/local/lib"`
|
||||
|
||||
---
|
||||
|
||||
If you're developing stuff make sure to copy the config file over
|
|
@ -16,6 +16,7 @@
|
|||
#include "control.h"
|
||||
#include "database/database.h"
|
||||
#include "types/user.h"
|
||||
#include <array>
|
||||
|
||||
namespace {
|
||||
constexpr int CMD_GAP = 27;
|
||||
|
|
|
@ -17,7 +17,7 @@ Rsa::Rsa(std::shared_ptr<::RSA> key)
|
|||
: key{key}
|
||||
{}
|
||||
|
||||
std::string Rsa::to_string() const
|
||||
std::string Crypt::Rsa::to_string() const
|
||||
{
|
||||
BIO* bio = BIO_new(BIO_s_mem());
|
||||
PEM_write_bio_RSAPrivateKey(bio, key.get(), NULL, NULL, 0, NULL, NULL);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <cstddef>
|
||||
#include <openssl/rsa.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Crypt
|
||||
{
|
||||
|
|
|
@ -24,7 +24,8 @@ SQLite::SQLite(std::filesystem::path path)
|
|||
{
|
||||
if (sqlite3_open(this->path.c_str(), &db))
|
||||
{
|
||||
const std::string err_msg = "Can't open database: "s + std::string(sqlite3_errmsg(db));
|
||||
const std::string err_msg = "Can't open database: "s +
|
||||
std::string(sqlite3_errmsg(db));
|
||||
sqlite3_close(db);
|
||||
throw std::runtime_error(err_msg);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* Licensed under BSD 3-Clause. See LICENSE
|
||||
*/
|
||||
|
||||
// Note: I copied this OOP garbage from another project
|
||||
|
||||
// Just your generic, average logger
|
||||
#pragma once
|
||||
#include <functional>
|
||||
|
@ -104,6 +106,7 @@ namespace Logger
|
|||
std::function<void(const Log&)> hook;
|
||||
};
|
||||
|
||||
// This is retarded *shrugs*
|
||||
Logger& instance();
|
||||
}
|
||||
|
||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -22,22 +22,22 @@
|
|||
/* Each module needs to be loaded via the /CMakeLists.txt file,
|
||||
and as such, the module header must exist and be defined */
|
||||
#ifdef MODULE_WEBFINGER
|
||||
#include "protocol/webfinger/webfinger.h"
|
||||
# include "protocol/webfinger/webfinger.h"
|
||||
#endif // MODULE_WEBFINGER
|
||||
#ifdef MODULE_ACTIVITYPUB
|
||||
#include "protocol/activitypub/activitypub.h"
|
||||
# include "protocol/activitypub/activitypub.h"
|
||||
#endif // MODULE_ACTIVITYPUB
|
||||
#ifdef MODULE_HOST_META
|
||||
#include "protocol/host-meta/hostmeta.h"
|
||||
# include "protocol/host-meta/hostmeta.h"
|
||||
#endif // MODULE_HOST_META
|
||||
#ifdef MODULE_OAUTH
|
||||
#include "protocol/oauth/oauth.h"
|
||||
# include "protocol/oauth/oauth.h"
|
||||
#endif // MODULE_OAUTH
|
||||
#ifdef MODULE_MASTO_API
|
||||
#include "protocol/masto-api/mastoapi.h"
|
||||
# include "protocol/masto-api/mastoapi.h"
|
||||
#endif // MODULE_MASTO_API
|
||||
#ifdef MODULE_FCGI
|
||||
#include "frontends/fcgi/fcgi.h"
|
||||
# include "frontends/fcgi/fcgi.h"
|
||||
#endif // MODULE_FCGI
|
||||
|
||||
void init_routes(const std::unique_ptr<HTTP::Server>& server)
|
||||
|
|
|
@ -18,8 +18,10 @@ std::string Random::generate_token(size_t len)
|
|||
const char* syms = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-!@";
|
||||
static size_t syms_len = std::strlen(syms);
|
||||
engine r(rng());
|
||||
|
||||
std::uniform_int_distribution<engine::result_type> dist{0, syms_len - 1};
|
||||
|
||||
std::uniform_int_distribution<engine::result_type> dist{0,
|
||||
// I love C++
|
||||
static_cast<engine::result_type>(syms_len - 1)};
|
||||
std::string result{};
|
||||
result.resize(len);
|
||||
std::generate_n(std::begin(result), len, [&, syms](){ return syms[dist(rng)]; });
|
||||
|
|
Loading…
Reference in a new issue