Fix Windows compile error

This commit is contained in:
badaix 2025-01-27 22:49:59 +01:00
parent 85e8d02e5b
commit c105fecc5b
2 changed files with 28 additions and 3 deletions

View file

@ -368,10 +368,10 @@ int main(int argc, char** argv)
namespace fs = std::filesystem; namespace fs = std::filesystem;
settings.server.certificate = fs::weakly_canonical(settings.server.certificate); settings.server.certificate = fs::weakly_canonical(settings.server.certificate);
if (!fs::exists(settings.server.certificate)) if (!fs::exists(settings.server.certificate))
throw SnapException("Certificate file not found: " + settings.server.certificate.native()); throw SnapException("Certificate file not found: " + settings.server.certificate.string());
settings.server.certificate_key = fs::weakly_canonical(settings.server.certificate_key); settings.server.certificate_key = fs::weakly_canonical(settings.server.certificate_key);
if (!fs::exists(settings.server.certificate_key)) if (!fs::exists(settings.server.certificate_key))
throw SnapException("Certificate_key file not found: " + settings.server.certificate_key.native()); throw SnapException("Certificate_key file not found: " + settings.server.certificate_key.string());
} }
else if (settings.server.certificate.empty() != settings.server.certificate_key.empty()) else if (settings.server.certificate.empty() != settings.server.certificate_key.empty())
{ {

View file

@ -28,7 +28,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
/// Server settings
struct ServerSettings struct ServerSettings
{ {
/// Launch settings /// Launch settings
@ -70,6 +70,7 @@ struct ServerSettings
/// User settings /// User settings
struct User struct User
{ {
/// c'tor
explicit User(const std::string& user_permissions_password) explicit User(const std::string& user_permissions_password)
{ {
std::string perm; std::string perm;
@ -78,8 +79,11 @@ struct ServerSettings
permissions = utils::string::split(perm, ','); permissions = utils::string::split(perm, ',');
} }
/// user name
std::string name; std::string name;
/// permissions
std::vector<std::string> permissions; std::vector<std::string> permissions;
/// password
std::string password; std::string password;
}; };
@ -87,36 +91,57 @@ struct ServerSettings
/// HTTP settings /// HTTP settings
struct Http struct Http
{ {
/// enable HTTP server
bool enabled{true}; bool enabled{true};
/// enable HTTPS
bool ssl_enabled{false}; bool ssl_enabled{false};
/// HTTP port
size_t port{1780}; size_t port{1780};
/// HTTPS port
size_t ssl_port{1788}; size_t ssl_port{1788};
/// HTTP listen address
std::vector<std::string> bind_to_address{{"::"}}; std::vector<std::string> bind_to_address{{"::"}};
/// HTTPS listen address
std::vector<std::string> ssl_bind_to_address{{"::"}}; std::vector<std::string> ssl_bind_to_address{{"::"}};
/// doc root directory
std::string doc_root; std::string doc_root;
/// HTTP server host name
std::string host{"<hostname>"}; std::string host{"<hostname>"};
/// URL prefix when serving album art
std::string url_prefix; std::string url_prefix;
}; };
/// TCP streaming client settings /// TCP streaming client settings
struct Tcp struct Tcp
{ {
/// enable plain TCP audio streaming
bool enabled{true}; bool enabled{true};
/// TCP port
size_t port{1705}; size_t port{1705};
/// TCP listen addresses
std::vector<std::string> bind_to_address{{"::"}}; std::vector<std::string> bind_to_address{{"::"}};
}; };
/// Stream settings /// Stream settings
struct Stream struct Stream
{ {
/// Audio streaming port
size_t port{1704}; size_t port{1704};
/// Directory for stream plugins
std::filesystem::path plugin_dir{"/usr/share/snapserver/plug-ins"}; std::filesystem::path plugin_dir{"/usr/share/snapserver/plug-ins"};
/// Stream sources
std::vector<std::string> sources; std::vector<std::string> sources;
/// Default codec
std::string codec{"flac"}; std::string codec{"flac"};
/// Default end to end delay
int32_t bufferMs{1000}; int32_t bufferMs{1000};
/// Default sample format
std::string sampleFormat{"48000:16:2"}; std::string sampleFormat{"48000:16:2"};
/// Default read size for stream sources
size_t streamChunkMs{20}; size_t streamChunkMs{20};
/// Send audio to muted clients?
bool sendAudioToMutedClients{false}; bool sendAudioToMutedClients{false};
/// Liste addresses
std::vector<std::string> bind_to_address{{"::"}}; std::vector<std::string> bind_to_address{{"::"}};
}; };