From: Greg Burri Date: Wed, 19 Jun 2024 08:43:35 +0000 (+0200) Subject: First commit X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=523a5684b30f23aa08c82af37fa0345668a4cf12;p=mumble_web.git First commit --- 523a5684b30f23aa08c82af37fa0345668a4cf12 diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..7f77502 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-unknown-linux-musl] +linker = "rust-lld" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2605101 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/target +**/*.rs.bk +static/style.css +style.css.map +.sass-cache +ice/MumbleServer_ice.py +ice/__pycache__ +ice/MumbleServer \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3eb5a8a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1437 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "askama" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" +dependencies = [ + "askama_derive", + "askama_escape", + "comrak", + "humansize", + "num-traits", + "percent-encoding", +] + +[[package]] +name = "askama_axum" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41603f7cdbf5ac4af60760f17253eb6adf6ec5b6f14a7ed830cf687d375f163" +dependencies = [ + "askama", + "axum-core", + "http", +] + +[[package]] +name = "askama_derive" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" +dependencies = [ + "askama_parser", + "basic-toml", + "mime", + "mime_guess", + "proc-macro2", + "quote", + "serde", + "syn", +] + +[[package]] +name = "askama_escape" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" + +[[package]] +name = "askama_parser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" +dependencies = [ + "nom", +] + +[[package]] +name = "async-compression" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd066d0b4ef8ecb03a55319dc13aa6910616d0f44008a045bb1835af830abff5" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "basic-toml" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +dependencies = [ + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "comrak" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894" +dependencies = [ + "entities", + "memchr", + "once_cell", + "regex", + "slug", + "typed-arena", + "unicode_categories", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "deunicode" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "entities" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "json" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mumble_web" +version = "0.1.0" +dependencies = [ + "askama", + "askama_axum", + "axum", + "itertools", + "json", + "ron", + "rsevents", + "serde", + "serde_json", + "shared_child", + "tokio", + "tower", + "tower-http", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "ron" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +dependencies = [ + "base64", + "bitflags", + "serde", + "serde_derive", +] + +[[package]] +name = "rsevents" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e29769fda0194d58e06d876d82337aac382415df547f073f44ffea0bb0c651" +dependencies = [ + "parking_lot_core", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shared_child" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slug" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tokio" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "async-compression", + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0cf7267 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "mumble_web" +version = "0.1.0" +edition = "2021" + +[dependencies] +axum = { version = "0.7", features = ["http2"] } +tokio = { version = "1", features = ["full"] } +tower = { version = "0.4", features = ["util"] } +tower-http = { version = "0.5", features = ["fs", "trace", "compression-gzip"] } + +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } + +json = "0.12" +ron = "0.8" # Rust object notation, to load configuration files. +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + +itertools = "0.13" + +askama = { version = "0.12", features = [ + "with-axum", + "mime", + "mime_guess", + "markdown", +] } +askama_axum = "0.4" + +shared_child = "1" +rsevents = "0.3" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..001f895 --- /dev/null +++ b/build.rs @@ -0,0 +1,54 @@ +/* +Additionnal build, doc: https://doc.rust-lang.org/cargo/reference/build-scripts.html + +What is build here: + - Compile the SASS file to CSS file. +*/ + +use std::{ + env, + path::Path, + process::{Command, Output}, +}; + +fn exists_in_path

(filename: P) -> bool +where + P: AsRef, +{ + for path in env::split_paths(&env::var_os("PATH").unwrap()) { + if path.join(&filename).is_file() { + return true; + } + } + false +} + +fn main() { + println!("cargo:rerun-if-changed=style.scss"); + + fn run_sass(command: &mut Command) -> Output { + command + .arg("style.scss") + .arg("static/style.css") + .output() + .expect("Unable to compile SASS file, install SASS, see https://sass-lang.com/") + } + + // Create static directory if it doesn't exist. + if !Path::new("static").exists() { + std::fs::create_dir("static").unwrap(); + } + + let output = if exists_in_path("sass.bat") { + run_sass(Command::new("cmd").args(&["/C", "sass.bat"])) + } else { + run_sass(&mut Command::new("sass")) + }; + + if !output.status.success() { + // SASS will put the error in the file. + let error = + std::fs::read_to_string("./static/style.css").expect("unable to read style.css"); + panic!("Error from SASS: {}", error); + } +} diff --git a/deploy-to-ek.nu b/deploy-to-ek.nu new file mode 100644 index 0000000..0e55097 --- /dev/null +++ b/deploy-to-ek.nu @@ -0,0 +1,3 @@ + +# The space in " ~/.." is to avoid nu to substitute by the local home directory. +nu deploy.nu gburri@192.168.2.101 " /var/www/mumble_web/" C:\Users\LyssMetal\lyss_metal_rsa \ No newline at end of file diff --git a/deploy.nu b/deploy.nu new file mode 100644 index 0000000..7589874 --- /dev/null +++ b/deploy.nu @@ -0,0 +1,29 @@ +def main [host: string, destination: string, ssh_key: path] { + let ssh_args = [-i $ssh_key $host] + let scp_args = [-r -i $ssh_key] + let target = "x86_64-unknown-linux-musl" # "x86_64-unknown-linux-gnu" + + def invoke_ssh [command: list] { + let args = $ssh_args ++ $command + print $"Executing: ssh ($args)" + ssh ...$args + } + + def copy_ssh [source: string, destination: string] { + let args = $scp_args ++ [$source $"($host):($destination)"] + print $"Executing: scp ($args)" + scp ...$args + } + + copy_ssh "ice/" $destination + + cargo build --target $target --release + invoke_ssh [systemctl --user stop mumble_web] + copy_ssh ./target/($target)/release/mumble_web $destination + invoke_ssh [rm -rf $"($destination)/static"] + copy_ssh ./static/ $destination + invoke_ssh [chmod u+x $"($destination)/mumble_web"] + invoke_ssh [systemctl --user start mumble_web] + print "Deployment finished" +} + diff --git a/ice/MumbleServer.ice b/ice/MumbleServer.ice new file mode 100644 index 0000000..6cb0940 --- /dev/null +++ b/ice/MumbleServer.ice @@ -0,0 +1,941 @@ +// Copyright 2022-2023 The Mumble Developers. All rights reserved. +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file at the root of the +// Mumble source tree or at . + +/** + * + * Information and control of the murmur server. Each server has + * one {@link Meta} interface that controls global information, and + * each virtual server has a {@link Server} interface. + * + **/ + +#include + +module MumbleServer +{ + + /** A network address in IPv6 format. + **/ + ["python:seq:tuple"] sequence NetAddress; + + /** A connected user. + **/ + struct User { + /** Session ID. This identifies the connection to the server. */ + int session; + /** User ID. -1 if the user is anonymous. */ + int userid; + /** Is user muted by the server? */ + bool mute; + /** Is user deafened by the server? If true, this implies mute. */ + bool deaf; + /** Is the user suppressed by the server? This means the user is not muted, but does not have speech privileges in the current channel. */ + bool suppress; + /** Is the user a priority speaker? */ + bool prioritySpeaker; + /** Is the user self-muted? */ + bool selfMute; + /** Is the user self-deafened? If true, this implies mute. */ + bool selfDeaf; + /** Is the User recording? (This flag is read-only and cannot be changed using setState().) **/ + bool recording; + /** Channel ID the user is in. Matches {@link Channel.id}. */ + int channel; + /** The name of the user. */ + string name; + /** Seconds user has been online. */ + int onlinesecs; + /** Average transmission rate in bytes per second over the last few seconds. */ + int bytespersec; + /** Legacy client version. */ + int version; + /** New client version. (See https://github.com/mumble-voip/mumble/issues/5827) */ + long version2; + /** Client release. For official releases, this equals the version. For snapshots and git compiles, this will be something else. */ + string release; + /** Client OS. */ + string os; + /** Client OS Version. */ + string osversion; + /** Plugin Identity. This will be the user's unique ID inside the current game. */ + string identity; + /** + Base64-encoded Plugin context. This is a binary blob identifying the game and team the user is on. + + The used Base64 alphabet is the one specified in RFC 2045. + + Before Mumble 1.3.0, this string was not Base64-encoded. This could cause problems for some Ice + implementations, such as the .NET implementation. + + If you need the exact string that is used by Mumble, you can get it by Base64-decoding this string. + + If you simply need to detect whether two users are in the same game world, string comparisons will + continue to work as before. + */ + string context; + /** User comment. Shown as tooltip for this user. */ + string comment; + /** Client address. */ + NetAddress address; + /** TCP only. True until UDP connectivity is established. */ + bool tcponly; + /** Idle time. This is how many seconds it is since the user last spoke. Other activity is not counted. */ + int idlesecs; + /** UDP Ping Average. This is the average ping for the user via UDP over the duration of the connection. */ + float udpPing; + /** TCP Ping Average. This is the average ping for the user via TCP over the duration of the connection. */ + float tcpPing; + }; + + sequence IntList; + + /** A text message between users. + **/ + struct TextMessage { + /** Sessions (connected users) who were sent this message. */ + IntList sessions; + /** Channels who were sent this message. */ + IntList channels; + /** Trees of channels who were sent this message. */ + IntList trees; + /** The contents of the message. */ + string text; + }; + + /** A channel. + **/ + struct Channel { + /** Channel ID. This is unique per channel, and the root channel is always id 0. */ + int id; + /** Name of the channel. There can not be two channels with the same parent that has the same name. */ + string name; + /** ID of parent channel, or -1 if this is the root channel. */ + int parent; + /** List of id of linked channels. */ + IntList links; + /** Description of channel. Shown as tooltip for this channel. */ + string description; + /** Channel is temporary, and will be removed when the last user leaves it. */ + bool temporary; + /** Position of the channel which is used in Client for sorting. */ + int position; + }; + + /** A group. Groups are defined per channel, and can inherit members from parent channels. + **/ + struct Group { + /** Group name */ + string name; + /** Is this group inherited from a parent channel? Read-only. */ + bool inherited; + /** Does this group inherit members from parent channels? */ + bool inherit; + /** Can subchannels inherit members from this group? */ + bool inheritable; + /** List of users to add to the group. */ + IntList add; + /** List of inherited users to remove from the group. */ + IntList remove; + /** Current members of the group, including inherited members. Read-only. */ + IntList members; + }; + + /** Write access to channel control. Implies all other permissions (except Speak). */ + const int PermissionWrite = 0x01; + /** Traverse channel. Without this, a client cannot reach subchannels, no matter which privileges he has there. */ + const int PermissionTraverse = 0x02; + /** Enter channel. */ + const int PermissionEnter = 0x04; + /** Speak in channel. */ + const int PermissionSpeak = 0x08; + /** Whisper to channel. This is different from Speak, so you can set up different permissions. */ + const int PermissionWhisper = 0x100; + /** Mute and deafen other users in this channel. */ + const int PermissionMuteDeafen = 0x10; + /** Move users from channel. You need this permission in both the source and destination channel to move another user. */ + const int PermissionMove = 0x20; + /** Make new channel as a subchannel of this channel. */ + const int PermissionMakeChannel = 0x40; + /** Make new temporary channel as a subchannel of this channel. */ + const int PermissionMakeTempChannel = 0x400; + /** Link this channel. You need this permission in both the source and destination channel to link channels, or in either channel to unlink them. */ + const int PermissionLinkChannel = 0x80; + /** Send text message to channel. */ + const int PermissionTextMessage = 0x200; + /** Kick user from server. Only valid on root channel. */ + const int PermissionKick = 0x10000; + /** Ban user from server. Only valid on root channel. */ + const int PermissionBan = 0x20000; + /** Register and unregister users. Only valid on root channel. */ + const int PermissionRegister = 0x40000; + /** Register and unregister users. Only valid on root channel. */ + const int PermissionRegisterSelf = 0x80000; + /** Reset the comment or avatar of a user. Only valid on root channel. */ + const int ResetUserContent = 0x100000; + + + /** Access Control List for a channel. ACLs are defined per channel, and can be inherited from parent channels. + **/ + struct ACL { + /** Does the ACL apply to this channel? */ + bool applyHere; + /** Does the ACL apply to subchannels? */ + bool applySubs; + /** Is this ACL inherited from a parent channel? Read-only. */ + bool inherited; + /** ID of user this ACL applies to. -1 if using a group name. */ + int userid; + /** Group this ACL applies to. Blank if using userid. */ + string group; + /** Binary mask of privileges to allow. */ + int allow; + /** Binary mask of privileges to deny. */ + int deny; + }; + + /** A single ip mask for a ban. + **/ + struct Ban { + /** Address to ban. */ + NetAddress address; + /** Number of bits in ban to apply. */ + int bits; + /** Username associated with ban. */ + string name; + /** Hash of banned user. */ + string hash; + /** Reason for ban. */ + string reason; + /** Date ban was applied in unix time format. */ + int start; + /** Duration of ban. */ + int duration; + }; + + /** A entry in the log. + **/ + struct LogEntry { + /** Timestamp in UNIX time_t */ + int timestamp; + /** The log message. */ + string txt; + }; + + class Tree; + sequence TreeList; + + enum ChannelInfo { ChannelDescription, ChannelPosition }; + enum UserInfo { UserName, UserEmail, UserComment, UserHash, UserPassword, UserLastActive, UserKDFIterations }; + + dictionary UserMap; + dictionary ChannelMap; + sequence ChannelList; + sequence UserList; + sequence GroupList; + sequence ACLList; + sequence LogList; + sequence BanList; + sequence IdList; + sequence NameList; + dictionary NameMap; + dictionary IdMap; + sequence Texture; + dictionary ConfigMap; + sequence GroupNameList; + sequence CertificateDer; + sequence CertificateList; + + /** User information map. + * Older versions of ice-php can't handle enums as keys. If you are using one of these, replace 'UserInfo' with 'byte'. + */ + + dictionary UserInfoMap; + + /** User and subchannel state. Read-only. + **/ + class Tree { + /** Channel definition of current channel. */ + Channel c; + /** List of subchannels. */ + TreeList children; + /** Users in this channel. */ + UserList users; + }; + + exception MurmurException {}; + /** This is thrown when you specify an invalid session. This may happen if the user has disconnected since your last call to {@link Server.getUsers}. See {@link User.session} */ + exception InvalidSessionException extends MurmurException {}; + /** This is thrown when you specify an invalid channel id. This may happen if the channel was removed by another provess. It can also be thrown if you try to add an invalid channel. */ + exception InvalidChannelException extends MurmurException {}; + /** This is thrown when you try to do an operation on a server that does not exist. This may happen if someone has removed the server. */ + exception InvalidServerException extends MurmurException {}; + /** This happens if you try to fetch user or channel state on a stopped server, if you try to stop an already stopped server or start an already started server. */ + exception ServerBootedException extends MurmurException {}; + /** This is thrown if {@link Server.start} fails, and should generally be the cause for some concern. */ + exception ServerFailureException extends MurmurException {}; + /** This is thrown when you specify an invalid userid. */ + exception InvalidUserException extends MurmurException {}; + /** This is thrown when you try to set an invalid texture. */ + exception InvalidTextureException extends MurmurException {}; + /** This is thrown when you supply an invalid callback. */ + exception InvalidCallbackException extends MurmurException {}; + /** This is thrown when you supply the wrong secret in the calling context. */ + exception InvalidSecretException extends MurmurException {}; + /** This is thrown when the channel operation would exceed the channel nesting limit */ + exception NestingLimitException extends MurmurException {}; + /** This is thrown when you ask the server to disclose something that should be secret. */ + exception WriteOnlyException extends MurmurException {}; + /** This is thrown when invalid input data was specified. */ + exception InvalidInputDataException extends MurmurException {}; + + /** Callback interface for servers. You can supply an implementation of this to receive notification + * messages from the server. + * If an added callback ever throws an exception or goes away, it will be automatically removed. + * Please note that all callbacks are done asynchronously; murmur does not wait for the callback to + * complete before continuing processing. + * Note that callbacks are removed when a server is stopped, so you should have a callback for + * {@link MetaCallback.started} which calls {@link Server.addCallback}. + * @see MetaCallback + * @see Server.addCallback + */ + interface ServerCallback { + /** Called when a user connects to the server. + * @param state State of connected user. + */ + idempotent void userConnected(User state); + /** Called when a user disconnects from the server. The user has already been removed, so you can no longer use methods like {@link Server.getState} + * to retrieve the user's state. + * @param state State of disconnected user. + */ + idempotent void userDisconnected(User state); + /** Called when a user state changes. This is called if the user moves, is renamed, is muted, deafened etc. + * @param state New state of user. + */ + idempotent void userStateChanged(User state); + /** Called when user writes a text message + * @param state the User sending the message + * @param message the TextMessage the user has sent + */ + idempotent void userTextMessage(User state, TextMessage message); + /** Called when a new channel is created. + * @param state State of new channel. + */ + idempotent void channelCreated(Channel state); + /** Called when a channel is removed. The channel has already been removed, you can no longer use methods like {@link Server.getChannelState} + * @param state State of removed channel. + */ + idempotent void channelRemoved(Channel state); + /** Called when a new channel state changes. This is called if the channel is moved, renamed or if new links are added. + * @param state New state of channel. + */ + idempotent void channelStateChanged(Channel state); + }; + + /** Context for actions in the Server menu. */ + const int ContextServer = 0x01; + /** Context for actions in the Channel menu. */ + const int ContextChannel = 0x02; + /** Context for actions in the User menu. */ + const int ContextUser = 0x04; + + /** Callback interface for context actions. You need to supply one of these for {@link Server.addContext}. + * If an added callback ever throws an exception or goes away, it will be automatically removed. + * Please note that all callbacks are done asynchronously; murmur does not wait for the callback to + * complete before continuing processing. + */ + interface ServerContextCallback { + /** Called when a context action is performed. + * @param action Action to be performed. + * @param usr User which initiated the action. + * @param session If nonzero, session of target user. + * @param channelid If not -1, id of target channel. + */ + idempotent void contextAction(string action, User usr, int session, int channelid); + }; + + /** Callback interface for server authentication. You need to supply one of these for {@link Server.setAuthenticator}. + * If an added callback ever throws an exception or goes away, it will be automatically removed. + * Please note that unlike {@link ServerCallback} and {@link ServerContextCallback}, these methods are called + * synchronously. If the response lags, the entire murmur server will lag. + * Also note that, as the method calls are synchronous, making a call to {@link Server} or {@link Meta} will + * deadlock the server. + */ + interface ServerAuthenticator { + /** Called to authenticate a user. If you do not know the username in question, always return -2 from this + * method to fall through to normal database authentication. + * Note that if authentication succeeds, murmur will create a record of the user in it's database, reserving + * the username and id so it cannot be used for normal database authentication. + * The data in the certificate (name, email addresses etc), as well as the list of signing certificates, + * should only be trusted if certstrong is true. + * + * Internally, Murmur treats usernames as case-insensitive. It is recommended + * that authenticators do the same. Murmur checks if a username is in use when + * a user connects. If the connecting user is registered, the other username is + * kicked. If the connecting user is not registered, the connecting user is not + * allowed to join the server. + * + * @param name Username to authenticate. + * @param pw Password to authenticate with. + * @param certificates List of der encoded certificates the user connected with. + * @param certhash Hash of user certificate, as used by murmur internally when matching. + * @param certstrong True if certificate was valid and signed by a trusted CA. + * @param newname Set this to change the username from the supplied one. + * @param groups List of groups on the root channel that the user will be added to for the duration of the connection. + * @return UserID of authenticated user, -1 for authentication failures, -2 for unknown user (fallthrough), + * -3 for authentication failures where the data could (temporarily) not be verified. + */ + idempotent int authenticate(string name, string pw, CertificateList certificates, string certhash, bool certstrong, out string newname, out GroupNameList groups); + + /** Fetch information about a user. This is used to retrieve information like email address, keyhash etc. If you + * want murmur to take care of this information itself, simply return false to fall through. + * @param id User id. + * @param info Information about user. This needs to include at least "name". + * @return true if information is present, false to fall through. + */ + idempotent bool getInfo(int id, out UserInfoMap info); + + /** Map a name to a user id. + * @param name Username to map. + * @return User id or -2 for unknown name. + */ + idempotent int nameToId(string name); + + /** Map a user id to a username. + * @param id User id to map. + * @return Name of user or empty string for unknown id. + */ + idempotent string idToName(int id); + + /** Map a user to a custom Texture. + * @param id User id to map. + * @return User texture or an empty texture for unknown users or users without textures. + */ + idempotent Texture idToTexture(int id); + }; + + /** Callback interface for server authentication and registration. This allows you to support both authentication + * and account updating. + * You do not need to implement this if all you want is authentication, you only need this if other scripts + * connected to the same server calls e.g. {@link Server.setTexture}. + * Almost all of these methods support fall through, meaning murmur should continue the operation against its + * own database. + */ + interface ServerUpdatingAuthenticator extends ServerAuthenticator { + /** Register a new user. + * @param info Information about user to register. + * @return User id of new user, -1 for registration failure, or -2 to fall through. + */ + int registerUser(UserInfoMap info); + + /** Unregister a user. + * @param id Userid to unregister. + * @return 1 for successful unregistration, 0 for unsuccessful unregistration, -1 to fall through. + */ + int unregisterUser(int id); + + /** Get a list of registered users matching filter. + * @param filter Substring usernames must contain. If empty, return all registered users. + * @return List of matching registered users. + */ + idempotent NameMap getRegisteredUsers(string filter); + + /** Set additional information for user registration. + * @param id Userid of registered user. + * @param info Information to set about user. This should be merged with existing information. + * @return 1 for successful update, 0 for unsuccessful update, -1 to fall through. + */ + idempotent int setInfo(int id, UserInfoMap info); + + /** Set texture (now called avatar) of user registration. + * @param id registrationId of registered user. + * @param tex New texture. + * @return 1 for successful update, 0 for unsuccessful update, -1 to fall through. + */ + idempotent int setTexture(int id, Texture tex); + }; + + /** Per-server interface. This includes all methods for configuring and altering + * the state of a single virtual server. You can retrieve a pointer to this interface + * from one of the methods in {@link Meta}. + **/ + ["amd"] interface Server { + /** Shows if the server currently running (accepting users). + * + * @return Run-state of server. + */ + idempotent bool isRunning() throws InvalidSecretException; + + /** Start server. */ + void start() throws ServerBootedException, ServerFailureException, InvalidSecretException; + + /** Stop server. + * Note: Server will be restarted on Murmur restart unless explicitly disabled + * with setConf("boot", false) + */ + void stop() throws ServerBootedException, InvalidSecretException; + + /** Delete server and all it's configuration. */ + void delete() throws ServerBootedException, InvalidSecretException; + + /** Fetch the server id. + * + * @return Unique server id. + */ + idempotent int id() throws InvalidSecretException; + + /** Add a callback. The callback will receive notifications about changes to users and channels. + * + * @param cb Callback interface which will receive notifications. + * @see removeCallback + */ + void addCallback(ServerCallback *cb) throws ServerBootedException, InvalidCallbackException, InvalidSecretException; + + /** Remove a callback. + * + * @param cb Callback interface to be removed. + * @see addCallback + */ + void removeCallback(ServerCallback *cb) throws ServerBootedException, InvalidCallbackException, InvalidSecretException; + + /** Set external authenticator. If set, all authentications from clients are forwarded to this + * proxy. + * + * @param auth Authenticator object to perform subsequent authentications. + */ + void setAuthenticator(ServerAuthenticator *auth) throws ServerBootedException, InvalidCallbackException, InvalidSecretException; + + /** Retrieve configuration item. + * @param key Configuration key. + * @return Configuration value. If this is empty, see {@link Meta.getDefaultConf} + */ + idempotent string getConf(string key) throws InvalidSecretException, WriteOnlyException; + + /** Retrieve all configuration items. + * @return All configured values. If a value isn't set here, the value from {@link Meta.getDefaultConf} is used. + */ + idempotent ConfigMap getAllConf() throws InvalidSecretException; + + /** Set a configuration item. + * @param key Configuration key. + * @param value Configuration value. + */ + idempotent void setConf(string key, string value) throws InvalidSecretException; + + /** Set superuser password. This is just a convenience for using {@link updateRegistration} on user id 0. + * @param pw Password. + */ + idempotent void setSuperuserPassword(string pw) throws InvalidSecretException; + + /** Fetch log entries. + * @param first Lowest numbered entry to fetch. 0 is the most recent item. + * @param last Last entry to fetch. + * @return List of log entries. + */ + idempotent LogList getLog(int first, int last) throws InvalidSecretException; + + /** Fetch length of log + * @return Number of entries in log + */ + idempotent int getLogLen() throws InvalidSecretException; + + /** Fetch all users. This returns all currently connected users on the server. + * @return List of connected users. + * @see getState + */ + idempotent UserMap getUsers() throws ServerBootedException, InvalidSecretException; + + /** Fetch all channels. This returns all defined channels on the server. The root channel is always channel 0. + * @return List of defined channels. + * @see getChannelState + */ + idempotent ChannelMap getChannels() throws ServerBootedException, InvalidSecretException; + + /** Fetch certificate of user. This returns the complete certificate chain of a user. + * @param session Connection ID of user. See {@link User.session}. + * @return Certificate list of user. + */ + idempotent CertificateList getCertificateList(int session) throws ServerBootedException, InvalidSessionException, InvalidSecretException; + + /** Fetch all channels and connected users as a tree. This retrieves an easy-to-use representation of the server + * as a tree. This is primarily used for viewing the state of the server on a webpage. + * @return Recursive tree of all channels and connected users. + */ + idempotent Tree getTree() throws ServerBootedException, InvalidSecretException; + + /** Fetch all current IP bans on the server. + * @return List of bans. + */ + idempotent BanList getBans() throws ServerBootedException, InvalidSecretException; + + /** Set all current IP bans on the server. This will replace any bans already present, so if you want to add a ban, be sure to call {@link getBans} and then + * append to the returned list before calling this method. + * @param bans List of bans. + */ + idempotent void setBans(BanList bans) throws ServerBootedException, InvalidSecretException; + + /** Kick a user. The user is not banned, and is free to rejoin the server. + * @param session Connection ID of user. See {@link User.session}. + * @param reason Text message to show when user is kicked. + */ + void kickUser(int session, string reason) throws ServerBootedException, InvalidSessionException, InvalidSecretException; + + /** Get state of a single connected user. + * @param session Connection ID of user. See {@link User.session}. + * @return State of connected user. + * @see setState + * @see getUsers + */ + idempotent User getState(int session) throws ServerBootedException, InvalidSessionException, InvalidSecretException; + + /** Set user state. You can use this to move, mute and deafen users. + * @param state User state to set. + * @see getState + */ + idempotent void setState(User state) throws ServerBootedException, InvalidSessionException, InvalidChannelException, InvalidSecretException; + + /** Send text message to a single user. + * @param session Connection ID of user. See {@link User.session}. + * @param text Message to send. + * @see sendMessageChannel + */ + void sendMessage(int session, string text) throws ServerBootedException, InvalidSessionException, InvalidSecretException; + + /** Check if user is permitted to perform action. + * @param session Connection ID of user. See {@link User.session}. + * @param channelid ID of Channel. See {@link Channel.id}. + * @param perm Permission bits to check. + * @return true if any of the permissions in perm were set for the user. + */ + bool hasPermission(int session, int channelid, int perm) throws ServerBootedException, InvalidSessionException, InvalidChannelException, InvalidSecretException; + + /** Return users effective permissions + * @param session Connection ID of user. See {@link User.session}. + * @param channelid ID of Channel. See {@link Channel.id}. + * @return bitfield of allowed actions + */ + idempotent int effectivePermissions(int session, int channelid) throws ServerBootedException, InvalidSessionException, InvalidChannelException, InvalidSecretException; + + /** Add a context callback. This is done per user, and will add a context menu action for the user. + * + * @param session Session of user which should receive context entry. + * @param action Action string, a unique name to associate with the action. + * @param text Name of action shown to user. + * @param cb Callback interface which will receive notifications. + * @param ctx Context this should be used in. Needs to be one or a combination of {@link ContextServer}, {@link ContextChannel} and {@link ContextUser}. + * @see removeContextCallback + */ + void addContextCallback(int session, string action, string text, ServerContextCallback *cb, int ctx) throws ServerBootedException, InvalidCallbackException, InvalidSecretException; + + /** Remove a callback. + * + * @param cb Callback interface to be removed. This callback will be removed from all from all users. + * @see addContextCallback + */ + void removeContextCallback(ServerContextCallback *cb) throws ServerBootedException, InvalidCallbackException, InvalidSecretException; + + /** Get state of single channel. + * @param channelid ID of Channel. See {@link Channel.id}. + * @return State of channel. + * @see setChannelState + * @see getChannels + */ + idempotent Channel getChannelState(int channelid) throws ServerBootedException, InvalidChannelException, InvalidSecretException; + + /** Set state of a single channel. You can use this to move or relink channels. + * @param state Channel state to set. + * @see getChannelState + */ + idempotent void setChannelState(Channel state) throws ServerBootedException, InvalidChannelException, InvalidSecretException, NestingLimitException; + + /** Remove a channel and all its subchannels. + * @param channelid ID of Channel. See {@link Channel.id}. + */ + void removeChannel(int channelid) throws ServerBootedException, InvalidChannelException, InvalidSecretException; + + /** Add a new channel. + * @param name Name of new channel. + * @param parent Channel ID of parent channel. See {@link Channel.id}. + * @return ID of newly created channel. + */ + int addChannel(string name, int parent) throws ServerBootedException, InvalidChannelException, InvalidSecretException, NestingLimitException; + + /** Send text message to channel or a tree of channels. + * @param channelid Channel ID of channel to send to. See {@link Channel.id}. + * @param tree If true, the message will be sent to the channel and all its subchannels. + * @param text Message to send. + * @see sendMessage + */ + void sendMessageChannel(int channelid, bool tree, string text) throws ServerBootedException, InvalidChannelException, InvalidSecretException; + + /** Retrieve ACLs and Groups on a channel. + * @param channelid Channel ID of channel to fetch from. See {@link Channel.id}. + * @param acls List of ACLs on the channel. This will include inherited ACLs. + * @param groups List of groups on the channel. This will include inherited groups. + * @param inherit Does this channel inherit ACLs from the parent channel? + */ + idempotent void getACL(int channelid, out ACLList acls, out GroupList groups, out bool inherit) throws ServerBootedException, InvalidChannelException, InvalidSecretException; + + /** Set ACLs and Groups on a channel. Note that this will replace all existing ACLs and groups on the channel. + * @param channelid Channel ID of channel to fetch from. See {@link Channel.id}. + * @param acls List of ACLs on the channel. + * @param groups List of groups on the channel. + * @param inherit Should this channel inherit ACLs from the parent channel? + */ + idempotent void setACL(int channelid, ACLList acls, GroupList groups, bool inherit) throws ServerBootedException, InvalidChannelException, InvalidSecretException; + + /** Temporarily add a user to a group on a channel. This state is not saved, and is intended for temporary memberships. + * @param channelid Channel ID of channel to add to. See {@link Channel.id}. + * @param session Connection ID of user. See {@link User.session}. + * @param group Group name to add to. + */ + idempotent void addUserToGroup(int channelid, int session, string group) throws ServerBootedException, InvalidChannelException, InvalidSessionException, InvalidSecretException; + + /** Remove a user from a temporary group membership on a channel. This state is not saved, and is intended for temporary memberships. + * @param channelid Channel ID of channel to add to. See {@link Channel.id}. + * @param session Connection ID of user. See {@link User.session}. + * @param group Group name to remove from. + */ + idempotent void removeUserFromGroup(int channelid, int session, string group) throws ServerBootedException, InvalidChannelException, InvalidSessionException, InvalidSecretException; + + /** Redirect whisper targets for user. If set, whenever a user tries to whisper to group "source", the whisper will be redirected to group "target". + * To remove a redirect pass an empty target string. This is intended for context groups. + * @param session Connection ID of user. See {@link User.session}. + * @param source Group name to redirect from. + * @param target Group name to redirect to. + */ + idempotent void redirectWhisperGroup(int session, string source, string target) throws ServerBootedException, InvalidSessionException, InvalidSecretException; + + /** Map a list of {@link User.userid} to a matching name. + * @param List of ids. + * @return Matching list of names, with an empty string representing invalid or unknown ids. + */ + idempotent NameMap getUserNames(IdList ids) throws ServerBootedException, InvalidSecretException; + + /** Map a list of user names to a matching id. + * @param List of names. + * @reuturn List of matching ids, with -1 representing invalid or unknown user names. + */ + idempotent IdMap getUserIds(NameList names) throws ServerBootedException, InvalidSecretException; + + /** Register a new user. + * @param info Information about new user. Must include at least "name". + * @return The ID of the user. See {@link RegisteredUser.userid}. + */ + int registerUser(UserInfoMap info) throws ServerBootedException, InvalidUserException, InvalidSecretException; + + /** Remove a user registration. + * @param userid ID of registered user. See {@link RegisteredUser.userid}. + */ + void unregisterUser(int userid) throws ServerBootedException, InvalidUserException, InvalidSecretException; + + /** Update the registration for a user. You can use this to set the email or password of a user, + * and can also use it to change the user's name. + * @param registration Updated registration record. + */ + idempotent void updateRegistration(int userid, UserInfoMap info) throws ServerBootedException, InvalidUserException, InvalidSecretException; + + /** Fetch registration for a single user. + * @param userid ID of registered user. See {@link RegisteredUser.userid}. + * @return Registration record. + */ + idempotent UserInfoMap getRegistration(int userid) throws ServerBootedException, InvalidUserException, InvalidSecretException; + + /** Fetch a group of registered users. + * @param filter Substring of user name. If blank, will retrieve all registered users. + * @return List of registration records. + */ + idempotent NameMap getRegisteredUsers(string filter) throws ServerBootedException, InvalidSecretException; + + /** Verify the password of a user. You can use this to verify a user's credentials. + * @param name User name. See {@link RegisteredUser.name}. + * @param pw User password. + * @return User ID of registered user (See {@link RegisteredUser.userid}), -1 for failed authentication or -2 for unknown usernames. + */ + idempotent int verifyPassword(string name, string pw) throws ServerBootedException, InvalidSecretException; + + /** Fetch user texture. Textures are stored as zlib compress()ed 600x60 32-bit BGRA data. + * @param userid ID of registered user. See {@link RegisteredUser.userid}. + * @return Custom texture associated with user or an empty texture. + */ + idempotent Texture getTexture(int userid) throws ServerBootedException, InvalidUserException, InvalidSecretException; + + /** Set a user texture (now called avatar). + * @param userid ID of registered user. See {@link RegisteredUser.userid}. + * @param tex Texture (as a Byte-Array) to set for the user, or an empty texture to remove the existing texture. + */ + idempotent void setTexture(int userid, Texture tex) throws ServerBootedException, InvalidUserException, InvalidTextureException, InvalidSecretException; + + /** Get virtual server uptime. + * @return Uptime of the virtual server in seconds + */ + idempotent int getUptime() throws ServerBootedException, InvalidSecretException; + + /** + * Update the server's certificate information. + * + * Reconfigure the running server's TLS socket with the given + * certificate and private key. + * + * The certificate and and private key must be PEM formatted. + * + * New clients will see the new certificate. + * Existing clients will continue to see the certificate the server + * was using when they connected to it. + * + * This method throws InvalidInputDataException if any of the + * following errors happen: + * - Unable to decode the PEM certificate and/or private key. + * - Unable to decrypt the private key with the given passphrase. + * - The certificate and/or private key do not contain RSA keys. + * - The certificate is not usable with the given private key. + */ + idempotent void updateCertificate(string certificate, string privateKey, string passphrase) throws ServerBootedException, InvalidSecretException, InvalidInputDataException; + + /** + * Makes the given user start listening to the given channel. + * @param userid The ID of the user + * @param channelid The ID of the channel + */ + idempotent void startListening(int userid, int channelid); + + /** + * Makes the given user stop listening to the given channel. + * @param userid The ID of the user + * @param channelid The ID of the channel + */ + idempotent void stopListening(int userid, int channelid); + + /** + * @param userid The ID of the user + * @param channelid The ID of the channel + * @returns Whether the given user is currently listening to the given channel + */ + idempotent bool isListening(int userid, int channelid); + + /** + * @param userid The ID of the user + * @returns An ID-list of channels the given user is listening to + */ + idempotent IntList getListeningChannels(int userid); + + /** + * @param channelid The ID of the channel + * @returns An ID-list of users listening to the given channel + */ + idempotent IntList getListeningUsers(int channelid); + + /** + * @param channelid The ID of the channel + * @param userid The ID of the user + * @returns The volume adjustment set for a listener of the given user in the given channel + */ + idempotent float getListenerVolumeAdjustment(int channelid, int userid); + + /** + * Sets the volume adjustment set for a listener of the given user in the given channel + * @param channelid The ID of the channel + * @param userid The ID of the user + */ + idempotent void setListenerVolumeAdjustment(int channelid, int userid, float volumeAdjustment); + + /** + * @param receiverUserIDs list of IDs of the users the message shall be sent to + */ + idempotent void sendWelcomeMessage(IdList receiverUserIDs); + }; + + /** Callback interface for Meta. You can supply an implementation of this to receive notifications + * when servers are stopped or started. + * If an added callback ever throws an exception or goes away, it will be automatically removed. + * Please note that all callbacks are done asynchronously; murmur does not wait for the callback to + * complete before continuing processing. + * @see ServerCallback + * @see Meta.addCallback + */ + interface MetaCallback { + /** Called when a server is started. The server is up and running when this event is sent, so all methods that + * need a running server will work. + * @param srv Interface for started server. + */ + void started(Server *srv); + + /** Called when a server is stopped. The server is already stopped when this event is sent, so no methods that + * need a running server will work. + * @param srv Interface for started server. + */ + void stopped(Server *srv); + }; + + sequence ServerList; + + /** This is the meta interface. It is primarily used for retrieving the {@link Server} interfaces for each individual server. + **/ + ["amd"] interface Meta { + /** Fetch interface to specific server. + * @param id Server ID. See {@link Server.getId}. + * @return Interface for specified server, or a null proxy if id is invalid. + */ + idempotent Server *getServer(int id) throws InvalidSecretException; + + /** Create a new server. Call {@link Server.getId} on the returned interface to find it's ID. + * @return Interface for new server. + */ + Server *newServer() throws InvalidSecretException; + + /** Fetch list of all currently running servers. + * @return List of interfaces for running servers. + */ + idempotent ServerList getBootedServers() throws InvalidSecretException; + + /** Fetch list of all defined servers. + * @return List of interfaces for all servers. + */ + idempotent ServerList getAllServers() throws InvalidSecretException; + + /** Fetch default configuration. This returns the configuration items that were set in the configuration file, or + * the built-in default. The individual servers will use these values unless they have been overridden in the + * server specific configuration. The only special case is the port, which defaults to the value defined here + + * the servers ID - 1 (so that virtual server #1 uses the defined port, server #2 uses port+1 etc). + * @return Default configuration of the servers. + */ + idempotent ConfigMap getDefaultConf() throws InvalidSecretException; + + /** Fetch version of Murmur. + * @param major Major version. + * @param minor Minor version. + * @param patch Patchlevel. + * @param text Textual representation of version. Note that this may not match the {@link major}, {@link minor} and {@link patch} levels, as it + * may be simply the compile date or the SVN revision. This is usually the text you want to present to users. + */ + idempotent void getVersion(out int major, out int minor, out int patch, out string text); + + /** Add a callback. The callback will receive notifications when servers are started or stopped. + * + * @param cb Callback interface which will receive notifications. + */ + void addCallback(MetaCallback *cb) throws InvalidCallbackException, InvalidSecretException; + + /** Remove a callback. + * + * @param cb Callback interface to be removed. + */ + void removeCallback(MetaCallback *cb) throws InvalidCallbackException, InvalidSecretException; + + /** Get murmur uptime. + * @return Uptime of murmur in seconds + */ + idempotent int getUptime(); + + /** Get slice file. + * @return Contents of the slice file server compiled with. + */ + idempotent string getSlice(); + + /** Returns a checksum dict for the slice file. + * @return Checksum dict + */ + idempotent Ice::SliceChecksumDict getSliceChecksums(); + }; +}; diff --git a/ice/ice.py b/ice/ice.py new file mode 100644 index 0000000..f981bd8 --- /dev/null +++ b/ice/ice.py @@ -0,0 +1,52 @@ +import sys, socket, json, Ice, MumbleServer + +initdata = Ice.InitializationData() +initdata.properties = Ice.createProperties(None, initdata.properties) +initdata.properties.setProperty('Ice.ImplicitContext', 'Shared') + +def getChannelPath(channels, channelId): + if channelId == 0: + return "" + else: + channel = channels[channelId] + return getChannelPath(channels, channel.parent) + "/" + channel.name + +def getUsers(server): + return map(lambda u: (u.name, u.channel), server.getUsers().values()) + +def getUsersAsJson(server): + channels = server.getChannels() + users = getUsers(server) + return json.dumps( + [ + {'username': username, 'channel': getChannelPath(channels, channel)} + for (username, channel) in users + ] + ) + +with Ice.initialize(sys.argv, initdata) as commmunicator: + commmunicator.getImplicitContext().put('secret', '71370537') + proxy = commmunicator.stringToProxy("Meta:tcp -h 192.168.2.101 -p 6502") + meta = MumbleServer.MetaPrx.uncheckedCast(proxy) + server = meta.getServer(1) + + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.bind(("127.0.0.1", 4978)) + s.listen() + while True: + conn, addr = s.accept() + with conn: + # print(f"New connection: {addr}") + data = conn.recv(8) + + id = int.from_bytes(data[0:4], sys.byteorder) + length = int.from_bytes(data[4:8], sys.byteorder) + # print(f"id: {id}, length: {length}") + + if id == 1: # Request of users list. + payload = bytes(getUsersAsJson(server), 'utf-8') + packet = (2).to_bytes(4, sys.byteorder) + \ + len(payload).to_bytes(4, sys.byteorder) + payload + conn.sendall(packet) + else: + print(f"Unknown packet id: {id}") \ No newline at end of file diff --git a/src/ice.rs b/src/ice.rs new file mode 100644 index 0000000..f917f82 --- /dev/null +++ b/src/ice.rs @@ -0,0 +1,157 @@ +use std::{ + io::prelude::*, + net::TcpStream, + process::Command, + str::from_utf8, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, + thread, + time::{self, Duration}, +}; + +use json; +use rsevents::{AutoResetEvent, Awaitable, EventState}; +use shared_child::SharedChild; + +const RELAUNCH_PERIOD: Duration = Duration::from_secs(5); +const CACHED_VALUES_DURATION: Duration = Duration::from_secs(5); + +#[derive(Debug, Clone)] +pub struct User { + pub name: String, + pub channel: String, +} + +pub struct Ice { + kill_event: Arc, + dropped: Arc, + cached_users: Vec, + cached_users_timestamp: time::Instant, +} + +#[cfg(not(unix))] +const PYTHON_PATH: &'static str = r"C:\Users\LyssMetal\anaconda3\python.exe"; + +#[cfg(unix)] +const PYTHON_PATH: &'static str = r"python3"; + +impl Ice { + pub fn new() -> Ice { + let kill_event_arc = Arc::new(AutoResetEvent::new(EventState::Unset)); + let dropped_arc = Arc::new(AtomicBool::new(false)); + + let ice = Ice { + kill_event: kill_event_arc.clone(), + dropped: dropped_arc.clone(), + cached_users: vec![], + cached_users_timestamp: time::Instant::now() - CACHED_VALUES_DURATION, + }; + + // Start the Python ICE process and monitor it. Restart it in case of failure. + thread::spawn(move || loop { + let time_beginning_loop = time::Instant::now(); + let kill_event_arc_clone1 = kill_event_arc.clone(); + let kill_event_arc_clone2 = kill_event_arc.clone(); + let dropped_arc_clone = dropped_arc.clone(); + + println!("Launching ice.py..."); + + let mut command = Command::new(PYTHON_PATH); + command.arg("./ice/ice.py"); + + let child = SharedChild::spawn(&mut command).unwrap(); + let child_arc = Arc::new(child); + let child_arc_cloned = child_arc.clone(); + + thread::spawn(move || { + kill_event_arc_clone1.wait(); + child_arc_cloned.kill() + }); + + println!("ice.py launched!"); + + child_arc.wait().unwrap(); + + // if kill_event is set then quit loop. + if dropped_arc_clone.load(Ordering::Relaxed) { + println!("Stopping main python loop..."); + kill_event_arc_clone2.set(); + return; + } else { + kill_event_arc_clone2.set(); + } + + print!("Python stopped!"); + + let elapsed = time::Instant::now() - time_beginning_loop; + if elapsed < RELAUNCH_PERIOD { + let to_wait = RELAUNCH_PERIOD - elapsed; + println!("Waiting {}s before relaunching...", to_wait.as_secs()); + thread::sleep(to_wait); + } else { + println!(); + } + }); + + ice + } + + pub fn get_users(&mut self) -> Vec { + let now = time::Instant::now(); + if self.cached_users_timestamp + CACHED_VALUES_DURATION > now { + self.cached_users.clone() + } else { + let mut stream = TcpStream::connect("127.0.0.1:4978").unwrap(); + + let id: u32 = 1; + let length: u32 = 0; + let mut buffer = [0u8; 8]; + buffer[0..4].copy_from_slice(&id.to_ne_bytes()); + buffer[4..8].copy_from_slice(&length.to_ne_bytes()); + stream.write(&buffer).unwrap(); + + let mut id_bytes = [0u8; 4]; + let mut length_bytes = [0u8; 4]; + stream.read(&mut id_bytes).unwrap(); + stream.read(&mut length_bytes).unwrap(); + let id = u32::from_ne_bytes(id_bytes); + + // Response id must be 2. + if id != 2 { + panic!("id must be 2"); + } + + let length = u32::from_ne_bytes(length_bytes); + let mut payload = vec![0u8; length as usize]; + stream.read_exact(&mut payload).unwrap(); + let json_str = from_utf8(&payload).unwrap(); + let json = json::parse(json_str).unwrap(); + + // println!("id: {}, length: {}, json: {:?}", id, length, json); // Debug. + + let mut users: Vec = vec![]; + for i in 0..json.len() { + let user_json = &json[i]; + users.push(User { + name: user_json["username"].as_str().unwrap().to_string(), + channel: user_json["channel"].as_str().unwrap().to_string(), + }); + } + self.cached_users = users.clone(); + self.cached_users_timestamp = time::Instant::now(); + users + } + } +} + +impl Drop for Ice { + fn drop(&mut self) { + println!("Dropping..",); + self.dropped.store(true, Ordering::Relaxed); + self.kill_event.set(); + self.kill_event.wait(); + println!("Dropped!",); + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6352630 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,123 @@ +use std::{ + cmp::Ordering, + net::SocketAddr, + sync::{Arc, Mutex}, +}; + +use askama::Template; +use askama_axum::IntoResponse; +use axum::{extract::State, routing::get, Router}; +use tokio::signal; +use tower_http::{compression::CompressionLayer, services::ServeDir}; + +mod ice; + +#[derive(Eq)] +struct User { + name: String, +} + +impl PartialEq for User { + fn eq(&self, other: &Self) -> bool { + self.name.eq(&other.name) + } +} + +impl PartialOrd for User { + fn partial_cmp(&self, other: &Self) -> Option { + self.name.partial_cmp(&other.name) + } +} + +impl Ord for User { + fn cmp(&self, other: &Self) -> Ordering { + self.name.cmp(&other.name) + } +} + +struct Channel { + name: String, + users: Vec, +} + +#[derive(Template)] +#[template(path = "main.html")] +struct MainTemplate { + channels: Vec, +} + +#[tokio::main] +async fn main() { + println!("Starting of Mumble Web..."); + + let ice = Arc::new(Mutex::new(ice::Ice::new())); + + tracing_subscriber::fmt::init(); + + let app = Router::new() + .route("/", get(root)) + .nest_service("/static", ServeDir::new("static")) + .with_state(ice) + .layer(CompressionLayer::new()); + + let addr = SocketAddr::from(([127, 0, 0, 1], 8086)); + let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); + + axum::serve(listener, app) + .with_graceful_shutdown(shutdown_signal()) + .await + .unwrap(); +} + +async fn root(State(ice): State>>) -> impl IntoResponse { + let users = ice.lock().unwrap().get_users(); + + let mut channels = Vec::::new(); + 'next_user: for u in &users { + for c in &mut channels { + if c.name == u.channel { + c.users.push(User { + name: u.name.clone(), + }); + continue 'next_user; + } + } + let channel = Channel { + name: u.channel.clone(), + users: vec![User { + name: u.name.clone(), + }], + }; + channels.push(channel); + } + + for c in &mut channels { + c.users.sort(); + } + + MainTemplate { channels } +} + +async fn shutdown_signal() { + let ctrl_c = async { + signal::ctrl_c() + .await + .expect("failed to install Ctrl+C handler"); + }; + + #[cfg(unix)] + let terminate = async { + signal::unix::signal(signal::unix::SignalKind::terminate()) + .expect("failed to install signal handler") + .recv() + .await; + }; + + #[cfg(not(unix))] + let terminate = std::future::pending::<()>(); + + tokio::select! { + _ = ctrl_c => {}, + _ = terminate => {}, + } +} diff --git a/static/FiraCode-Bold.woff2 b/static/FiraCode-Bold.woff2 new file mode 100644 index 0000000..d8b3179 Binary files /dev/null and b/static/FiraCode-Bold.woff2 differ diff --git a/static/FiraCode-Light.woff2 b/static/FiraCode-Light.woff2 new file mode 100644 index 0000000..9cb6aee Binary files /dev/null and b/static/FiraCode-Light.woff2 differ diff --git a/static/FiraCode-Medium.woff2 b/static/FiraCode-Medium.woff2 new file mode 100644 index 0000000..dfeb9de Binary files /dev/null and b/static/FiraCode-Medium.woff2 differ diff --git a/static/FiraCode-Regular.woff2 b/static/FiraCode-Regular.woff2 new file mode 100644 index 0000000..1979211 Binary files /dev/null and b/static/FiraCode-Regular.woff2 differ diff --git a/static/FiraCode-SemiBold.woff2 b/static/FiraCode-SemiBold.woff2 new file mode 100644 index 0000000..ecec57d Binary files /dev/null and b/static/FiraCode-SemiBold.woff2 differ diff --git a/style.scss b/style.scss new file mode 100644 index 0000000..b745f54 --- /dev/null +++ b/style.scss @@ -0,0 +1,52 @@ +@font-face { + font-family: Fira Code; + font-weight: 200; + src: url(FiraCode-Light.woff2) format("woff2"); +} + +@font-face { + font-family: Fira Code; + font-weight: 400; + src: url(FiraCode-Regular.woff2) format("woff2"); +} + +@font-face { + font-family: Fira Code; + font-weight: 600; + src: url(FiraCode-SemiBold.woff2) format("woff2"); +} + +@font-face { + font-family: Fira Code; + font-weight: 700; + src: url(FiraCode-Bold.woff2) format("woff2"); +} + +body { + font-family: Fira Code, Helvetica Neue, Helvetica, Arial, sans-serif; + color: #bdbdbd; + background-color: #252525; +} + +#channel { + color: #c5c500; +} + +h1 { + font-size: x-large; + margin: 20px 20px 16px 20px; +} + +h2 { + font-size: large; + margin: 16px 16px 10px 16px; +} + +p { + font-size: medium; + margin: 12px; +} + +img { + border: 0px; +} \ No newline at end of file diff --git a/templates/main.html b/templates/main.html new file mode 100644 index 0000000..18fe2c5 --- /dev/null +++ b/templates/main.html @@ -0,0 +1,29 @@ + + + + + + + Euphoirik Mumble + + + + +

+

~ Euphorik Mumble ~

+ {% if channels.len() == 0 %} +

No user connected

+ {% else %} + {% for channel in channels %} +

{{ channel.name }}

+ + {% endfor %} + {% endif %} +
+ + + \ No newline at end of file