2019-07-17 13:37:18 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <Definitions.h>
|
|
|
|
#ifdef byte
|
|
|
|
#undef byte
|
|
|
|
#endif
|
|
|
|
#include <spdlog/common.h>
|
2020-04-03 13:07:03 -04:00
|
|
|
#include <misc/strobf.h>
|
2019-07-17 13:37:18 -04:00
|
|
|
#include "geo/GeoLocation.h"
|
2020-03-02 07:33:57 -05:00
|
|
|
#include "../../license/shared/include/license/license.h"
|
2020-04-03 13:07:03 -04:00
|
|
|
#include "build.h"
|
2019-07-17 13:37:18 -04:00
|
|
|
|
|
|
|
namespace YAML {
|
2020-01-23 20:57:58 -05:00
|
|
|
class Node;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace ts::config {
|
|
|
|
struct EntryBinding {
|
|
|
|
std::string key;
|
|
|
|
std::map<std::string, std::deque<std::string>> description;
|
|
|
|
uint8_t flags = 0;
|
|
|
|
|
|
|
|
int type = 0; /* 0 = unbound | 1 = string | 2 = number | 3 = boolean | 4 = user defined */
|
|
|
|
int bounded_by = 0; /* 0 = unbound | 1 = config | 2 = command line */
|
|
|
|
|
|
|
|
std::function<std::deque<std::string>()> default_value;
|
|
|
|
std::function<std::string()> value_description;
|
|
|
|
std::function<void(YAML::Node&)> set_default;
|
|
|
|
std::function<void(YAML::Node&)> read_config;
|
|
|
|
std::function<void(const std::string&)> read_argument;
|
|
|
|
};
|
|
|
|
|
2020-02-28 05:24:07 -05:00
|
|
|
extern bool update_license(std::string& /* error */, const std::string& /* new license */);
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::vector<std::string> parseConfig(const std::string& /* path */);
|
|
|
|
extern std::vector<std::string> reload();
|
|
|
|
extern std::deque<std::shared_ptr<EntryBinding>> create_bindings();
|
|
|
|
|
|
|
|
namespace database {
|
|
|
|
extern std::string url;
|
|
|
|
namespace sqlite {
|
|
|
|
extern std::string journal_mode;
|
|
|
|
extern std::string locking_mode;
|
|
|
|
extern std::string sync_mode;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::shared_ptr<license::License> license;
|
|
|
|
extern std::shared_ptr<license::License> license_original;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool experimental_31;
|
|
|
|
extern std::string permission_mapping_file;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace binding {
|
|
|
|
extern bool enforce_default_voice_host;
|
|
|
|
extern std::string DefaultVoiceHost;
|
|
|
|
extern std::string DefaultWebHost;
|
|
|
|
extern std::string DefaultQueryHost;
|
|
|
|
extern std::string DefaultFileHost;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern uint16_t DefaultQueryPort;
|
|
|
|
extern uint16_t DefaultFilePort;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace server {
|
|
|
|
extern std::string DefaultServerVersion;
|
|
|
|
extern std::string DefaultServerPlatform;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool delete_old_bans;
|
|
|
|
extern bool delete_missing_icon_permissions;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern LicenseType DefaultServerLicense;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool strict_ut8_mode;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool enable_teamspeak_weblist;
|
|
|
|
extern bool show_invisible_clients_as_online;
|
|
|
|
extern bool disable_ip_saving;
|
2020-02-15 09:37:19 -05:00
|
|
|
extern bool default_music_bot;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace badges {
|
|
|
|
extern bool allow_overwolf;
|
|
|
|
extern bool allow_badges;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace authentication {
|
|
|
|
extern bool name;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace clients {
|
2020-03-20 12:58:58 -04:00
|
|
|
enum WelcomeMessageType {
|
|
|
|
WELCOME_MESSAGE_TYPE_MIN,
|
|
|
|
WELCOME_MESSAGE_TYPE_NONE = WELCOME_MESSAGE_TYPE_MIN,
|
|
|
|
WELCOME_MESSAGE_TYPE_CHAT,
|
|
|
|
WELCOME_MESSAGE_TYPE_POKE,
|
|
|
|
WELCOME_MESSAGE_TYPE_MAX
|
|
|
|
};
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool teamspeak;
|
2020-03-20 12:58:58 -04:00
|
|
|
extern std::string extra_welcome_message_teamspeak;
|
|
|
|
extern WelcomeMessageType extra_welcome_message_type_teamspeak;
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool teaspeak;
|
2020-03-20 12:58:58 -04:00
|
|
|
extern std::string extra_welcome_message_teaspeak;
|
|
|
|
extern WelcomeMessageType extra_welcome_message_type_teaspeak;
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool teaweb;
|
2020-03-20 12:58:58 -04:00
|
|
|
extern std::string extra_welcome_message_teaweb;
|
|
|
|
extern WelcomeMessageType extra_welcome_message_type_teaweb;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern ssize_t max_virtual_server;
|
2020-04-03 13:07:03 -04:00
|
|
|
|
|
|
|
__attribute__((always_inline)) inline std::string default_version() { return strobf("TeaSpeak ").string() + build::version()->string(true); }
|
|
|
|
__attribute__((always_inline)) inline bool check_server_version_with_license() {
|
2020-04-03 13:26:22 -04:00
|
|
|
return default_version() == DefaultServerVersion || (license->isPremium() && license->isValid());
|
2020-04-03 13:07:03 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace voice {
|
|
|
|
extern size_t DefaultPuzzlePrecomputeSize;
|
|
|
|
extern int RsaPuzzleLevel;
|
|
|
|
extern bool enforce_coocie_handshake;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool notifyMuted;
|
|
|
|
extern int connectLimit;
|
|
|
|
extern int clientConnectLimit;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool suppress_myts_warnings;
|
|
|
|
extern uint16_t default_voice_port;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool warn_on_permission_editor;
|
|
|
|
extern bool allow_session_reinitialize;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace geo {
|
|
|
|
extern std::string countryFlag;
|
|
|
|
extern bool staticFlag;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string mappingFile;
|
|
|
|
extern geoloc::ProviderType type;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool vpn_block;
|
|
|
|
extern std::string vpn_file;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace query {
|
|
|
|
extern std::string motd;
|
|
|
|
extern std::string newlineCharacter;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern int sslMode;
|
|
|
|
namespace ssl {
|
|
|
|
extern std::string keyFile;
|
|
|
|
extern std::string certFile;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace music {
|
|
|
|
extern bool enabled;
|
|
|
|
extern std::string command_prefix;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace messages {
|
|
|
|
extern std::string serverStopped;
|
|
|
|
extern std::string applicationStopped;
|
|
|
|
extern std::string applicationCrashed;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string idle_time_exceeded;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string mute_notify_message;
|
|
|
|
extern std::string unmute_notify_message;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string kick_invalid_hardware_id;
|
|
|
|
extern std::string kick_invalid_badges;
|
|
|
|
extern std::string kick_invalid_command;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string kick_vpn;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::string teamspeak_permission_editor;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace shutdown {
|
|
|
|
extern std::string scheduled;
|
|
|
|
extern std::string interval;
|
|
|
|
extern std::string now;
|
|
|
|
extern std::string canceled;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern std::vector<std::pair<std::chrono::seconds, std::string>> intervals;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace music {
|
|
|
|
extern std::string song_announcement;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace timeout {
|
|
|
|
extern std::string packet_resend_failed;
|
|
|
|
extern std::string connection_reinitialized;
|
|
|
|
}
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace web {
|
|
|
|
extern bool activated;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace ssl {
|
|
|
|
/* servername; private key file; public key file*/
|
|
|
|
extern std::deque<std::tuple<std::string, std::string, std::string>> certificates;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern uint16_t webrtc_port_min;
|
|
|
|
extern uint16_t webrtc_port_max;
|
|
|
|
extern std::deque<std::string> ice_servers;
|
|
|
|
extern bool enable_upnp;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace threads {
|
|
|
|
extern size_t ticking;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace voice {
|
|
|
|
extern size_t execute_per_server;
|
|
|
|
extern size_t execute_limit;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern size_t events_per_server;
|
|
|
|
extern size_t io_min;
|
|
|
|
extern size_t io_per_server;
|
|
|
|
extern size_t io_limit;
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
extern bool bind_io_thread_to_kernel_thread;
|
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace music {
|
|
|
|
extern size_t execute_per_bot;
|
|
|
|
extern size_t execute_limit;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace web {
|
|
|
|
extern size_t io_loops;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
}
|
2019-07-17 13:37:18 -04:00
|
|
|
|
2020-02-15 08:03:46 -05:00
|
|
|
namespace log {
|
|
|
|
extern std::string path;
|
|
|
|
extern size_t vs_size;
|
|
|
|
extern spdlog::level::level_enum logfileLevel;
|
|
|
|
extern bool logfileColored;
|
|
|
|
extern spdlog::level::level_enum terminalLevel;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|
2020-02-15 08:03:46 -05:00
|
|
|
|
|
|
|
extern std::string crash_path;
|
2019-07-17 13:37:18 -04:00
|
|
|
}
|