diff options
| author | Rutger Broekhoff | 2026-12-01 00:42:18 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-12-01 00:42:18 +0100 |
| commit | 9b8d8fccaec087031ba37dd68e516929c3ddb4a2 (patch) | |
| tree | 8e380c6f80388b4a238ddf486e113d6e5013699c | |
| parent | 4a81c39d94b6877f7753896218467ff77b8d7f6f (diff) | |
| download | routemon-9b8d8fccaec087031ba37dd68e516929c3ddb4a2.tar.gz routemon-9b8d8fccaec087031ba37dd68e516929c3ddb4a2.zip | |
| -rw-r--r-- | flake.nix | 22 | ||||
| -rw-r--r-- | server/src/database/sqlite3.cpp | 10 | ||||
| -rw-r--r-- | server/src/locale.cpp | 6 | ||||
| -rw-r--r-- | server/src/locale.cppm | 5 |
4 files changed, 23 insertions, 20 deletions
| @@ -21,8 +21,8 @@ | |||
| 21 | }); | 21 | }); |
| 22 | boost = pkgs."boost${toString boostVersion}"; | 22 | boost = pkgs."boost${toString boostVersion}"; |
| 23 | 23 | ||
| 24 | routemon-server = stdenv.mkDerivation { | 24 | routemon-server-unwrapped = stdenv.mkDerivation { |
| 25 | name = "routemon-server"; | 25 | name = "routemon-server-unwrapped"; |
| 26 | src = ./server; | 26 | src = ./server; |
| 27 | 27 | ||
| 28 | buildInputs = with pkgs; [ boost pugixml expat icu openssl sqlite ]; | 28 | buildInputs = with pkgs; [ boost pugixml expat icu openssl sqlite ]; |
| @@ -49,6 +49,24 @@ | |||
| 49 | ]; | 49 | ]; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | routemon-server-data = pkgs.stdenvNoCC.mkDerivation { | ||
| 53 | name = "routemon-server-data"; | ||
| 54 | |||
| 55 | src = ./server; | ||
| 56 | |||
| 57 | installPhase = '' | ||
| 58 | install -D -t $out/share/routemon/migrations/ migrations/*.sql | ||
| 59 | ''; | ||
| 60 | }; | ||
| 61 | |||
| 62 | routemon-server = pkgs.buildEnv { | ||
| 63 | name = "routemon-server"; | ||
| 64 | |||
| 65 | paths = [ routemon-server-unwrapped routemon-server-data ]; | ||
| 66 | |||
| 67 | pathsToLink = [ "/bin" "/share" ]; | ||
| 68 | }; | ||
| 69 | |||
| 52 | routemon-web = pkgs.stdenvNoCC.mkDerivation { | 70 | routemon-web = pkgs.stdenvNoCC.mkDerivation { |
| 53 | name = "routemon-web"; | 71 | name = "routemon-web"; |
| 54 | 72 | ||
diff --git a/server/src/database/sqlite3.cpp b/server/src/database/sqlite3.cpp index 35d4fec..bc2b84a 100644 --- a/server/src/database/sqlite3.cpp +++ b/server/src/database/sqlite3.cpp | |||
| @@ -19,16 +19,6 @@ mutex_guard::~mutex_guard() | |||
| 19 | ::sqlite3_mutex_leave(::sqlite3_db_mutex(dbc_)); | 19 | ::sqlite3_mutex_leave(::sqlite3_db_mutex(dbc_)); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // auto do_guarded(::sqlite3* dbc, std::invocable<mutex_guard const&> auto f, | ||
| 23 | // std::optional<mutex_guard const&> malready_locked = std::nullopt) | ||
| 24 | // -> decltype(f(std::declval<mutex_guard const&>())) | ||
| 25 | // { | ||
| 26 | // if (auto const mguard = malready_locked) | ||
| 27 | // return f(*mguard); | ||
| 28 | // else | ||
| 29 | // return f(mutex_guard{dbc}); | ||
| 30 | // } | ||
| 31 | |||
| 32 | error::error(int code, ::sqlite3* dbc) | 22 | error::error(int code, ::sqlite3* dbc) |
| 33 | : code_{code}, message_{::sqlite3_errmsg(dbc)} | 23 | : code_{code}, message_{::sqlite3_errmsg(dbc)} |
| 34 | { | 24 | { |
diff --git a/server/src/locale.cpp b/server/src/locale.cpp index a964d5e..38291f9 100644 --- a/server/src/locale.cpp +++ b/server/src/locale.cpp | |||
| @@ -119,19 +119,19 @@ auto selector::make_matcher(std::vector<std::locale> const& supported_locales) | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | // Trimming optional whitespace as defined in RFC 9110, § 12.4.2. | 121 | // Trimming optional whitespace as defined in RFC 9110, § 12.4.2. |
| 122 | auto selector::ltrim_ows(std::string_view s) -> std::string_view | 122 | auto ltrim_ows(std::string_view s) -> std::string_view |
| 123 | { | 123 | { |
| 124 | if (auto i = s.find_first_not_of(" \t"); i != std::string_view::npos) | 124 | if (auto i = s.find_first_not_of(" \t"); i != std::string_view::npos) |
| 125 | s.remove_prefix(i); | 125 | s.remove_prefix(i); |
| 126 | return s; | 126 | return s; |
| 127 | } | 127 | } |
| 128 | auto selector::rtrim_ows(std::string_view s) -> std::string_view | 128 | auto rtrim_ows(std::string_view s) -> std::string_view |
| 129 | { | 129 | { |
| 130 | if (auto i = s.find_last_not_of(" \t"); i != std::string_view::npos) | 130 | if (auto i = s.find_last_not_of(" \t"); i != std::string_view::npos) |
| 131 | return s.substr(0, i + 1); | 131 | return s.substr(0, i + 1); |
| 132 | return s; | 132 | return s; |
| 133 | } | 133 | } |
| 134 | auto selector::trim_ows(std::string_view s) -> std::string_view | 134 | auto trim_ows(std::string_view s) -> std::string_view |
| 135 | { | 135 | { |
| 136 | return rtrim_ows(ltrim_ows(s)); | 136 | return rtrim_ows(ltrim_ows(s)); |
| 137 | } | 137 | } |
diff --git a/server/src/locale.cppm b/server/src/locale.cppm index 43e32c3..87c3ced 100644 --- a/server/src/locale.cppm +++ b/server/src/locale.cppm | |||
| @@ -50,11 +50,6 @@ export class selector | |||
| 50 | static auto make_matcher(std::vector<std::locale> const& supported_locales) | 50 | static auto make_matcher(std::vector<std::locale> const& supported_locales) |
| 51 | -> icu::LocaleMatcher; | 51 | -> icu::LocaleMatcher; |
| 52 | 52 | ||
| 53 | // Trimming optional whitespace as defined in RFC 9110, § 12.4.2. | ||
| 54 | static auto ltrim_ows(std::string_view s) -> std::string_view; | ||
| 55 | static auto rtrim_ows(std::string_view s) -> std::string_view; | ||
| 56 | static auto trim_ows(std::string_view s) -> std::string_view; | ||
| 57 | |||
| 58 | public: | 53 | public: |
| 59 | explicit selector(locale_input_range auto supported, std::locale default_) | 54 | explicit selector(locale_input_range auto supported, std::locale default_) |
| 60 | : supported_{ | 55 | : supported_{ |