Use rocket_dyn_templates
This commit is contained in:
parent
346b6c30c4
commit
b654d913ad
|
@ -159,12 +159,6 @@ dependencies = [
|
|||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "binascii"
|
||||
version = "0.1.4"
|
||||
|
@ -384,16 +378,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80f6044740a4a516b8aac14c140cdf35c1a640b1bd6b98b6224e49143b2f1566"
|
||||
dependencies = [
|
||||
"percent-encoding 2.1.0",
|
||||
"time 0.1.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.15.1"
|
||||
|
@ -527,34 +511,14 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
|
||||
|
||||
[[package]]
|
||||
name = "devise"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3"
|
||||
dependencies = [
|
||||
"devise_codegen 0.2.0",
|
||||
"devise_core 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "devise"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50c7580b072f1c8476148f16e0a0d5dedddab787da98d86c5082c5e9ed8ab595"
|
||||
dependencies = [
|
||||
"devise_codegen 0.3.1",
|
||||
"devise_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "devise_codegen"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7"
|
||||
dependencies = [
|
||||
"devise_core 0.2.0",
|
||||
"quote 0.6.13",
|
||||
"devise_codegen",
|
||||
"devise_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -563,22 +527,10 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "123c73e7a6e51b05c75fe1a1b2f4e241399ea5740ed810b0e3e6cacd9db5e7b2"
|
||||
dependencies = [
|
||||
"devise_core 0.3.1",
|
||||
"devise_core",
|
||||
"quote 1.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "devise_core"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "devise_core"
|
||||
version = "0.3.1"
|
||||
|
@ -758,9 +710,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "790b4292c72618abbab50f787a477014fe15634f96291de45672ce46afe122df"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"pear 0.2.3",
|
||||
"pear",
|
||||
"serde 1.0.130",
|
||||
"toml 0.5.8",
|
||||
"toml",
|
||||
"uncased",
|
||||
"version_check 0.9.3",
|
||||
]
|
||||
|
@ -1039,12 +991,6 @@ version = "0.26.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
|
@ -1124,6 +1070,20 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "handlebars"
|
||||
version = "3.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3"
|
||||
dependencies = [
|
||||
"log 0.4.14",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"quick-error 2.0.1",
|
||||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
|
@ -1217,7 +1177,7 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||
dependencies = [
|
||||
"quick-error",
|
||||
"quick-error 1.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2115,7 +2075,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"serde_yaml",
|
||||
"snafu 0.2.3",
|
||||
"toml 0.5.8",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2227,6 +2187,15 @@ dependencies = [
|
|||
"version_check 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "normpath"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "640c20e9df4a2d4a5adad5b47e17d76dac3e824346b181931c3ec9f7a85687b1"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.17"
|
||||
|
@ -2651,25 +2620,16 @@ dependencies = [
|
|||
"peach-lib",
|
||||
"percent-encoding 2.1.0",
|
||||
"regex",
|
||||
"rocket 0.5.0-rc.1",
|
||||
"rocket_contrib",
|
||||
"rocket",
|
||||
"rocket_dyn_templates",
|
||||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"snafu 0.6.10",
|
||||
"tera 1.15.0",
|
||||
"tera",
|
||||
"websocket",
|
||||
"xdg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pear"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a"
|
||||
dependencies = [
|
||||
"pear_codegen 0.1.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pear"
|
||||
version = "0.2.3"
|
||||
|
@ -2677,20 +2637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "15e44241c5e4c868e3eaa78b7c1848cadd6344ed4f54d029832d32b415a58702"
|
||||
dependencies = [
|
||||
"inlinable_string",
|
||||
"pear_codegen 0.2.3",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pear_codegen"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
"version_check 0.9.3",
|
||||
"pear_codegen",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
|
@ -2917,6 +2864,12 @@ version = "1.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
|
@ -3243,27 +3196,6 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a7ab1dfdc75bb8bd2be381f37796b1b300c45a3c9145b34d86715e8dd90bf28"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"base64 0.13.0",
|
||||
"log 0.4.14",
|
||||
"memchr",
|
||||
"num_cpus",
|
||||
"pear 0.1.4",
|
||||
"rocket_codegen 0.4.10",
|
||||
"rocket_http 0.4.10",
|
||||
"state 0.4.2",
|
||||
"time 0.1.44",
|
||||
"toml 0.4.10",
|
||||
"version_check 0.9.3",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket"
|
||||
version = "0.5.0-rc.1"
|
||||
|
@ -3288,11 +3220,11 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
"rand 0.8.4",
|
||||
"ref-cast",
|
||||
"rocket_codegen 0.5.0-rc.1",
|
||||
"rocket_http 0.5.0-rc.1",
|
||||
"rocket_codegen",
|
||||
"rocket_http",
|
||||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"state 0.5.2",
|
||||
"state",
|
||||
"tempfile",
|
||||
"time 0.2.27",
|
||||
"tokio 1.13.0",
|
||||
|
@ -3303,67 +3235,36 @@ dependencies = [
|
|||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_codegen"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1729e687d6d2cf434d174da84fb948f7fef4fac22d20ce94ca61c28b72dbcf9f"
|
||||
dependencies = [
|
||||
"devise 0.2.0",
|
||||
"glob 0.3.0",
|
||||
"indexmap",
|
||||
"quote 0.6.13",
|
||||
"rocket_http 0.4.10",
|
||||
"version_check 0.9.3",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_codegen"
|
||||
version = "0.5.0-rc.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66f5fa462f7eb958bba8710c17c5d774bbbd59809fa76fb1957af7e545aea8bb"
|
||||
dependencies = [
|
||||
"devise 0.3.1",
|
||||
"glob 0.3.0",
|
||||
"devise",
|
||||
"glob",
|
||||
"indexmap",
|
||||
"proc-macro2 1.0.32",
|
||||
"quote 1.0.10",
|
||||
"rocket_http 0.5.0-rc.1",
|
||||
"rocket_http",
|
||||
"syn 1.0.81",
|
||||
"unicode-xid 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_contrib"
|
||||
version = "0.4.10"
|
||||
name = "rocket_dyn_templates"
|
||||
version = "0.1.0-rc.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b6303dccab46dce6c7ac26c9b9d8d8cde1b19614b027c3f913be6611bff6d9b"
|
||||
checksum = "c83f1287ad8fa034410928297a91db37518d5c46d7cc7e1e1b4a77aec0cd8807"
|
||||
dependencies = [
|
||||
"glob 0.3.0",
|
||||
"log 0.4.14",
|
||||
"glob",
|
||||
"handlebars",
|
||||
"normpath",
|
||||
"notify",
|
||||
"rocket 0.4.10",
|
||||
"rocket",
|
||||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"tera 0.11.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_http"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6131e6e6d38a9817f4a494ff5da95971451c2eb56a53915579fc9c80f6ef0117"
|
||||
dependencies = [
|
||||
"cookie 0.11.4",
|
||||
"hyper 0.10.16",
|
||||
"indexmap",
|
||||
"pear 0.1.4",
|
||||
"percent-encoding 1.0.1",
|
||||
"smallvec 1.7.0",
|
||||
"state 0.4.2",
|
||||
"time 0.1.44",
|
||||
"unicode-xid 0.1.0",
|
||||
"tera",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3372,7 +3273,7 @@ version = "0.5.0-rc.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23c8b7d512d2fcac2316ebe590cde67573844b99e6cc9ee0f53375fa16e25ebd"
|
||||
dependencies = [
|
||||
"cookie 0.15.1",
|
||||
"cookie",
|
||||
"either",
|
||||
"http 0.2.5",
|
||||
"hyper 0.14.14",
|
||||
|
@ -3381,14 +3282,14 @@ dependencies = [
|
|||
"memchr",
|
||||
"mime 0.3.16",
|
||||
"parking_lot 0.11.2",
|
||||
"pear 0.2.3",
|
||||
"pear",
|
||||
"percent-encoding 2.1.0",
|
||||
"pin-project-lite",
|
||||
"ref-cast",
|
||||
"serde 1.0.130",
|
||||
"smallvec 1.7.0",
|
||||
"stable-pattern",
|
||||
"state 0.5.2",
|
||||
"state",
|
||||
"time 0.2.27",
|
||||
"tokio 1.13.0",
|
||||
"uncased",
|
||||
|
@ -3846,12 +3747,6 @@ dependencies = [
|
|||
"version_check 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "state"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483"
|
||||
|
||||
[[package]]
|
||||
name = "state"
|
||||
version = "0.5.2"
|
||||
|
@ -4036,27 +3931,6 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tera"
|
||||
version = "0.11.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"error-chain",
|
||||
"glob 0.2.11",
|
||||
"humansize",
|
||||
"lazy_static",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"regex",
|
||||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"slug",
|
||||
"unic-segment 0.7.0",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tera"
|
||||
version = "1.15.0"
|
||||
|
@ -4076,7 +3950,7 @@ dependencies = [
|
|||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"slug",
|
||||
"unic-segment 0.9.0",
|
||||
"unic-segment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4502,15 +4376,6 @@ dependencies = [
|
|||
"tokio 1.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||
dependencies = [
|
||||
"serde 1.0.130",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.8"
|
||||
|
@ -4673,75 +4538,34 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c"
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-property"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce36d3f7ce754afdbccccf8ff0dd0134e50fb44aaae579f96218856e9e5dbd1e"
|
||||
dependencies = [
|
||||
"unic-char-range 0.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-property"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
|
||||
dependencies = [
|
||||
"unic-char-range 0.9.0",
|
||||
"unic-char-range",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-range"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9ab85fab42ad1b26cafc03bf891f69cb4d6e15f491030e89a0122197baa8ae8"
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-range"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-common"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff8d4a7ade929ef7d971e16ced21a8cd56a63869aa6032dfb8cb083cf7d077bf"
|
||||
|
||||
[[package]]
|
||||
name = "unic-common"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-segment"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9ca47cbb09fb5fcd066b5867d11dc528302fa465277882797d6a836e1ee6f9e"
|
||||
dependencies = [
|
||||
"unic-ucd-segment 0.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-segment"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23"
|
||||
dependencies = [
|
||||
"unic-ucd-segment 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-segment"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48f1a08ce0409a9e391b88d1930118eec48af12742fc538bcec55f775865776e"
|
||||
dependencies = [
|
||||
"unic-char-property 0.7.0",
|
||||
"unic-char-range 0.7.0",
|
||||
"unic-ucd-version 0.7.0",
|
||||
"unic-ucd-segment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4750,18 +4574,9 @@ version = "0.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700"
|
||||
dependencies = [
|
||||
"unic-char-property 0.9.0",
|
||||
"unic-char-range 0.9.0",
|
||||
"unic-ucd-version 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-version"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1f5e6c6c53c2d0ece4a5964bc55fcff8602153063cb4fab20958ff32998ff6"
|
||||
dependencies = [
|
||||
"unic-common 0.7.0",
|
||||
"unic-char-property",
|
||||
"unic-char-range",
|
||||
"unic-ucd-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4770,7 +4585,7 @@ version = "0.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
|
||||
dependencies = [
|
||||
"unic-common 0.9.0",
|
||||
"unic-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -50,7 +50,11 @@ regex = "1"
|
|||
xdg = "2.2.0"
|
||||
openssl = { version = "0.10", features = ["vendored"] }
|
||||
|
||||
[dependencies.rocket_contrib]
|
||||
version = "0.4.10"
|
||||
default-features = false
|
||||
features = ["tera_templates"]
|
||||
#[dependencies.rocket_contrib]
|
||||
#version = "0.4.10"
|
||||
#default-features = false
|
||||
#features = ["tera_templates"]
|
||||
|
||||
[dependencies.rocket_dyn_templates]
|
||||
version = "0.1.0-rc.1"
|
||||
features = ["handlebars", "tera"]
|
||||
|
|
|
@ -37,7 +37,7 @@ use std::{env, thread};
|
|||
use log::{debug, error, info};
|
||||
|
||||
use rocket::{catchers, routes, Rocket, Build};
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
|
||||
use crate::routes::authentication::*;
|
||||
use crate::routes::device::*;
|
||||
|
|
|
@ -3,7 +3,7 @@ use rocket::request::{FlashMessage, Form, FromForm};
|
|||
use rocket::response::{Flash, Redirect};
|
||||
use rocket::{get, post};
|
||||
use rocket::serde::json::Json;
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use rocket::serde::{Deserialize, Serialize};
|
||||
|
||||
use peach_lib::password_utils;
|
||||
|
@ -41,8 +41,8 @@ pub fn login(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("login", &context)
|
||||
}
|
||||
|
@ -140,8 +140,8 @@ pub fn reset_password(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("password/reset_password", &context)
|
||||
}
|
||||
|
@ -186,12 +186,12 @@ pub fn reset_password_form_endpoint(
|
|||
Ok(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "New password is now saved. Return home to login.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(err) => {
|
||||
let status = "error".to_string();
|
||||
let msg = format!("{}", err);
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ pub fn send_password_reset_page(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("password/send_password_reset", &context)
|
||||
}
|
||||
|
@ -297,8 +297,8 @@ pub fn change_password(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("password/change_password", &context)
|
||||
}
|
||||
|
@ -338,12 +338,12 @@ pub fn save_password_form_endpoint(password_form: Json<PasswordForm>) -> Value {
|
|||
Ok(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Your password was successfully changed".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(err) => {
|
||||
let status = "error".to_string();
|
||||
let msg = format!("{}", err);
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use rocket::{
|
|||
response::{Flash, Redirect},
|
||||
};
|
||||
use rocket::serde::json::Json;
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
io,
|
||||
|
@ -158,8 +158,8 @@ pub fn device_stats(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("device", &context)
|
||||
|
@ -196,13 +196,13 @@ pub fn reboot_device() -> Value {
|
|||
debug!("Going down for reboot...");
|
||||
let status = "success".to_string();
|
||||
let msg = "Going down for reboot.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Reboot failed");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to reboot the device.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,13 +234,13 @@ pub fn shutdown_device() -> Value {
|
|||
debug!("Going down for shutdown...");
|
||||
let status = "success".to_string();
|
||||
let msg = "Going down for shutdown.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Shutdown failed");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to shutdown the device.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +274,8 @@ pub fn shutdown_menu(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("shutdown", &context)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use log::debug;
|
||||
use rocket::{catch, get, response::NamedFile};
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use serde::Serialize;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rocket::{get, request::FlashMessage};
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use serde::Serialize;
|
||||
|
||||
// HELPERS AND ROUTES FOR / (HOME PAGE)
|
||||
|
@ -60,8 +60,8 @@ pub fn help(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("help", &context)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Helper routes for pinging services to check that they are active
|
||||
use log::{debug, warn};
|
||||
use rocket::get;
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::{Value, Json};
|
||||
|
||||
use peach_lib::dyndns_client::is_dns_updater_online;
|
||||
use peach_lib::network_client;
|
||||
|
@ -9,7 +9,6 @@ use peach_lib::oled_client;
|
|||
use peach_lib::stats_client;
|
||||
|
||||
use crate::utils::build_json_response;
|
||||
use rocket::serde::json::Value;
|
||||
|
||||
/// Status route: useful for checking connectivity from web client.
|
||||
#[get("/api/v1/ping")]
|
||||
|
@ -17,7 +16,7 @@ pub fn ping_pong() -> Value {
|
|||
// ping pong
|
||||
let status = "success".to_string();
|
||||
let msg = "pong!".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
|
||||
/// Test route: useful for ad hoc testing.
|
||||
|
@ -26,7 +25,7 @@ pub fn test_route() -> Value {
|
|||
let val = is_dns_updater_online().unwrap();
|
||||
let status = "success".to_string();
|
||||
let msg = val.to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
|
||||
/// Status route: check availability of `peach-network` microservice.
|
||||
|
@ -37,13 +36,13 @@ pub fn ping_network() -> Value {
|
|||
debug!("peach-network responded successfully");
|
||||
let status = "success".to_string();
|
||||
let msg = "peach-network is available.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("peach-network failed to respond");
|
||||
let status = "error".to_string();
|
||||
let msg = "peach-network is unavailable.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,13 +55,13 @@ pub fn ping_oled() -> Value {
|
|||
debug!("peach-oled responded successfully");
|
||||
let status = "success".to_string();
|
||||
let msg = "peach-oled is available.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("peach-oled failed to respond");
|
||||
let status = "error".to_string();
|
||||
let msg = "peach-oled is unavailable.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,13 +74,13 @@ pub fn ping_stats() -> Value {
|
|||
debug!("peach-stats responded successfully");
|
||||
let status = "success".to_string();
|
||||
let msg = "peach-stats is available.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("peach-stats failed to respond");
|
||||
let status = "error".to_string();
|
||||
let msg = "peach-stats is unavailable.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Routes for ScuttleButt related functionality.
|
||||
|
||||
use rocket::{get, request::FlashMessage};
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use serde::Serialize;
|
||||
|
||||
// HELPERS AND ROUTES FOR /messages
|
||||
|
@ -33,8 +33,8 @@ pub fn messages(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("messages", &context)
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ pub fn peers(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("peers", &context)
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ pub fn profile(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("profile", &context)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use rocket::{
|
|||
response::{Flash, Redirect},
|
||||
uri,
|
||||
};
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use rocket::serde::{Deserialize, Serialize};
|
||||
|
||||
use peach_lib::config_manager;
|
||||
|
@ -47,8 +47,8 @@ pub fn configure_admin(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("admin/configure_admin", &context)
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ pub fn add_admin(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("admin/add_admin", &context)
|
||||
|
|
|
@ -4,7 +4,7 @@ use rocket::{
|
|||
request::{FlashMessage, Form, FromForm},
|
||||
};
|
||||
use rocket::serde::json::Json;
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_dyn_templates::Template;
|
||||
use rocket::serde::{Deserialize, Serialize};
|
||||
|
||||
use peach_lib::config_manager;
|
||||
|
@ -120,8 +120,8 @@ pub fn configure_dns(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
Template::render("configure_dns", &context)
|
||||
}
|
||||
|
@ -158,12 +158,12 @@ pub fn save_dns_configuration_endpoint(dns_form: Json<DnsForm>) -> Value {
|
|||
Ok(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "New dynamic dns configuration is now enabled".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(err) => {
|
||||
let status = "error".to_string();
|
||||
let msg = format!("{}", err);
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use rocket::{
|
|||
uri, UriDisplayQuery,
|
||||
};
|
||||
use rocket::serde::json::{json, Json};
|
||||
use rocket_contrib::{templates::Template};
|
||||
use rocket_dyn_templates::Template;
|
||||
use rocket::serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
@ -99,8 +99,8 @@ pub fn wifi_password(ssid: &RawStr, flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_modify", &context)
|
||||
|
@ -285,8 +285,8 @@ pub fn network_home(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_card", &context)
|
||||
|
@ -385,8 +385,8 @@ pub fn wifi_list(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_list", &context)
|
||||
|
@ -553,8 +553,8 @@ pub fn network_detail(ssid: &RawStr, flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_detail", &context)
|
||||
|
@ -583,8 +583,8 @@ pub fn network_add_wifi(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_add", &context)
|
||||
|
@ -623,8 +623,8 @@ pub fn network_add_ssid(ssid: &RawStr, flash: Option<FlashMessage>) -> Template
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_add", &context)
|
||||
|
@ -733,8 +733,8 @@ pub fn wifi_usage(flash: Option<FlashMessage>) -> Template {
|
|||
// check to see if there is a flash message to display
|
||||
if let Some(flash) = flash {
|
||||
// add flash message contents to the context object
|
||||
context.flash_name = Some(flash.name().to_string());
|
||||
context.flash_msg = Some(flash.msg().to_string());
|
||||
context.flash_name = Some(flash.kind().to_string());
|
||||
context.flash_msg = Some(flash.message().to_string());
|
||||
};
|
||||
// template_dir is set in Rocket.toml
|
||||
Template::render("network_usage", &context)
|
||||
|
@ -767,13 +767,13 @@ pub fn update_wifi_alerts(thresholds: Json<Threshold>) -> Value {
|
|||
debug!("WiFi data usage thresholds updated.");
|
||||
let status = "success".to_string();
|
||||
let msg = "Updated alert threshold and flags.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Failed to update WiFi data usage thresholds.");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to update WiFi data usage thresholds.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -797,13 +797,13 @@ pub fn reset_data_total() -> Value {
|
|||
let data = json!(current_traffic);
|
||||
let status = "success".to_string();
|
||||
let msg = "Reset network data usage total.".to_string();
|
||||
build_json_responses(status, Some(data), Some(msg))
|
||||
build_json_response(status, Some(data), Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Failed to reset network data usage total.");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to reset network data usage total.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ pub fn activate_ap() -> Value {
|
|||
Err(_) => {
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to activate WiFi access point.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ pub fn activate_client() -> Value {
|
|||
Err(_) => {
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to activate WiFi client mode.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -860,14 +860,14 @@ pub fn add_wifi(wifi: Json<WiFi>) -> Value {
|
|||
// json response for successful update
|
||||
let status = "success".to_string();
|
||||
let msg = "WiFi credentials added.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
debug!("Failed to add WiFi credentials.");
|
||||
// json response for failed update
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to add WiFi credentials.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -881,18 +881,18 @@ pub fn connect_ap(ssid: Json<Ssid>) -> Value {
|
|||
Ok(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Connected to chosen network.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to connect to chosen network.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to retrieve the network ID.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -904,12 +904,12 @@ pub fn disconnect_ap(ssid: Json<Ssid>) -> Value {
|
|||
Ok(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Disconnected from WiFi network.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to disconnect from WiFi network.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -922,13 +922,13 @@ pub fn forget_ap(network: Json<Ssid>) -> Value {
|
|||
debug!("Removed WiFi credentials for chosen network.");
|
||||
let status = "success".to_string();
|
||||
let msg = "WiFi network credentials removed.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Failed to remove WiFi credentials.");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to remove WiFi network credentials.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -945,13 +945,13 @@ pub fn modify_password(wifi: Json<WiFi>) -> Value {
|
|||
debug!("WiFi password updated for chosen network.");
|
||||
let status = "success".to_string();
|
||||
let msg = "WiFi password updated.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Failed to update WiFi password.");
|
||||
let status = "error".to_string();
|
||||
let msg = "Failed to update WiFi password.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ pub fn return_rssi() -> Value {
|
|||
Err(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Not currently connected to an access point.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1007,7 +1007,7 @@ pub fn return_ssid() -> Value {
|
|||
Err(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Not currently connected to an access point.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1044,13 +1044,13 @@ pub fn return_status() -> Value {
|
|||
Err(_) => {
|
||||
let status = "success".to_string();
|
||||
let msg = "Not currently connected to an access point.".to_string();
|
||||
build_json_responses(status, None, Some(msg))
|
||||
build_json_response(status, None, Some(msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/api/v1/network/wifi")]
|
||||
pub fn scan_networks() -> JsonResponse {
|
||||
pub fn scan_networks() -> Value {
|
||||
// retrieve scan results for access-points within range of wlan0
|
||||
match network_client::available_networks("wlan0") {
|
||||
Ok(networks) => {
|
||||
|
|
Loading…
Reference in New Issue