~lthms/grimoar

374843000d13e7f6348aa1f552b43aaa70b71cd3 — Thomas Letan 2 months ago a26f8a8 main
Start using typed-urls
M Cargo.lock => Cargo.lock +125 -82
@@ 7,7 7,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570"
dependencies = [
 "bitflags",
 "bytes",
 "bytes 0.5.6",
 "futures-core",
 "futures-sink",
 "log",


@@ 45,7 45,7 @@ dependencies = [
 "actix-service",
 "actix-web",
 "bitflags",
 "bytes",
 "bytes 0.5.6",
 "derive_more",
 "futures-core",
 "futures-util",


@@ 71,7 71,7 @@ dependencies = [
 "base64",
 "bitflags",
 "brotli2",
 "bytes",
 "bytes 0.5.6",
 "cookie",
 "copyless",
 "derive_more",


@@ 136,7 136,7 @@ dependencies = [
 "actix-service",
 "actix-utils",
 "actix-web",
 "bytes",
 "bytes 0.5.6",
 "derive_more",
 "futures-util",
 "httparse",


@@ 254,7 254,7 @@ dependencies = [
 "actix-rt",
 "actix-service",
 "bitflags",
 "bytes",
 "bytes 0.5.6",
 "either",
 "futures-channel",
 "futures-sink",


@@ 283,7 283,7 @@ dependencies = [
 "actix-utils",
 "actix-web-codegen",
 "awc",
 "bytes",
 "bytes 0.5.6",
 "derive_more",
 "encoding_rs",
 "futures-channel",


@@ 385,9 385,9 @@ dependencies = [

[[package]]
name = "aho-corasick"
version = "0.7.13"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d"
dependencies = [
 "memchr",
]


@@ 449,7 449,7 @@ checksum = "4c8cea09c1fb10a317d1b5af8024eeba256d6554763e85ecd90ff8df31c7bbda"
dependencies = [
 "async-io",
 "blocking",
 "cfg-if",
 "cfg-if 0.1.10",
 "event-listener",
 "futures-lite",
 "once_cell",


@@ 459,9 459,9 @@ dependencies = [

[[package]]
name = "async-task"
version = "4.0.2"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518"
checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"

[[package]]
name = "async-trait"


@@ 497,7 497,7 @@ dependencies = [
 "actix-rt",
 "actix-service",
 "base64",
 "bytes",
 "bytes 0.5.6",
 "derive_more",
 "futures-core",
 "log",


@@ 511,12 511,12 @@ dependencies = [

[[package]]
name = "backtrace"
version = "0.3.52"
version = "0.3.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f813291114c186a042350e787af10c26534601062603d888be110f59f85ef8fa"
checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e"
dependencies = [
 "addr2line",
 "cfg-if",
 "cfg-if 1.0.0",
 "libc",
 "miniz_oxide",
 "object",


@@ 616,9 616,9 @@ dependencies = [

[[package]]
name = "bstr"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931"
checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf"
dependencies = [
 "memchr",
]


@@ 629,7 629,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6ae7069aad07c7cdefe6a22a671f00650728bd2331a4cc62e1e5d0becdf9ca4"
dependencies = [
 "bytes",
 "bytes 0.5.6",
]

[[package]]


@@ 657,12 657,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"

[[package]]
name = "bytes"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16"

[[package]]
name = "bytestring"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363"
dependencies = [
 "bytes",
 "bytes 0.5.6",
]

[[package]]


@@ 684,6 690,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"

[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chrono"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 761,11 773,11 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"

[[package]]
name = "crc32fast"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
dependencies = [
 "cfg-if",
 "cfg-if 1.0.0",
]

[[package]]


@@ 775,7 787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
 "autocfg",
 "cfg-if",
 "cfg-if 0.1.10",
 "lazy_static",
]



@@ 872,7 884,7 @@ version = "0.8.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
]

[[package]]


@@ 914,7 926,7 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "crc32fast",
 "libc",
 "miniz_oxide",


@@ 992,9 1004,9 @@ checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c"

[[package]]
name = "futures-lite"
version = "1.11.1"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "381a7ad57b1bad34693f63f6f377e1abded7a9c85c9d3eb6771e11c60aaadab9"
checksum = "5e6c079abfac3ab269e2927ec048dabc89d009ebfdda6b8ee86624f30c689658"
dependencies = [
 "fastrand",
 "futures-core",


@@ 1086,7 1098,7 @@ version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "libc",
 "wasi 0.9.0+wasi-snapshot-preview1",
]


@@ 1108,9 1120,9 @@ checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"

[[package]]
name = "globset"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a"
dependencies = [
 "aho-corasick",
 "bstr",


@@ 1140,7 1152,7 @@ dependencies = [
 "actix-web",
 "anyhow",
 "async-process",
 "bytes",
 "bytes 0.6.0",
 "diesel",
 "futures",
 "futures-lite",


@@ 1156,6 1168,8 @@ dependencies = [
 "serde_json",
 "tera",
 "thiserror",
 "typed-urls",
 "typed-urls-tera",
]

[[package]]


@@ 1179,7 1193,7 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53"
dependencies = [
 "bytes",
 "bytes 0.5.6",
 "fnv",
 "futures-core",
 "futures-sink",


@@ 1253,7 1267,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9"
dependencies = [
 "bytes",
 "bytes 0.5.6",
 "fnv",
 "itoa",
]


@@ 1315,7 1329,7 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
]

[[package]]


@@ 1375,7 1389,7 @@ checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616"
dependencies = [
 "arrayvec",
 "bitflags",
 "cfg-if",
 "cfg-if 0.1.10",
 "ryu",
 "static_assertions",
]


@@ 1407,7 1421,7 @@ version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
]

[[package]]


@@ 1484,7 1498,7 @@ version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "fuchsia-zircon",
 "fuchsia-zircon-sys",
 "iovec",


@@ 1536,7 1550,7 @@ version = "0.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "libc",
 "winapi 0.3.9",
]


@@ 1593,9 1607,9 @@ dependencies = [

[[package]]
name = "object"
version = "0.20.0"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"

[[package]]
name = "ogmarkup"


@@ 1647,7 1661,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "cloudabi",
 "instant",
 "libc",


@@ 1716,18 1730,18 @@ dependencies = [

[[package]]
name = "pin-project"
version = "0.4.26"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13fbdfd6bdee3dc9be46452f86af4a4072975899cf8592466668620bebfbcc17"
checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15"
dependencies = [
 "pin-project-internal",
]

[[package]]
name = "pin-project-internal"
version = "0.4.26"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c82fb1329f632c3552cf352d14427d57a511b1cf41db93b3a7d77906a82dcc8e"
checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
dependencies = [
 "proc-macro2",
 "quote",


@@ 1736,9 1750,9 @@ dependencies = [

[[package]]
name = "pin-project-lite"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95"
checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"

[[package]]
name = "pin-utils"


@@ 1748,11 1762,11 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "polling"
version = "2.0.1"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab773feb154f12c49ffcfd66ab8bdcf9a1843f950db48b0d8be9d4393783b058"
checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "libc",
 "log",
 "wepoll-sys",


@@ 1765,7 1779,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "universal-hash",
]



@@ 1889,9 1903,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"

[[package]]
name = "regex"
version = "1.3.9"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b"
dependencies = [
 "aho-corasick",
 "memchr",


@@ 1901,9 1915,9 @@ dependencies = [

[[package]]
name = "regex-syntax"
version = "0.6.18"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c"

[[package]]
name = "resolv-conf"


@@ 1917,9 1931,9 @@ dependencies = [

[[package]]
name = "rustc-demangle"
version = "0.1.17"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b"
checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"

[[package]]
name = "rustc_version"


@@ 1977,18 1991,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"

[[package]]
name = "serde"
version = "1.0.116"
version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
dependencies = [
 "serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.116"
version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
dependencies = [
 "proc-macro2",
 "quote",


@@ 1997,9 2011,9 @@ dependencies = [

[[package]]
name = "serde_json"
version = "1.0.58"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a230ea9107ca2220eea9d46de97eddcb04cd00e92d13dda78e478dd33fa82bd4"
checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
dependencies = [
 "itoa",
 "ryu",


@@ 2037,7 2051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770"
dependencies = [
 "block-buffer 0.9.0",
 "cfg-if",
 "cfg-if 0.1.10",
 "cpuid-bool",
 "digest 0.9.0",
 "opaque-debug 0.3.0",


@@ 2056,7 2070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
dependencies = [
 "block-buffer 0.9.0",
 "cfg-if",
 "cfg-if 0.1.10",
 "cpuid-bool",
 "digest 0.9.0",
 "opaque-debug 0.3.0",


@@ 2109,7 2123,7 @@ version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "libc",
 "redox_syscall",
 "winapi 0.3.9",


@@ 2187,9 2201,9 @@ checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"

[[package]]
name = "syn"
version = "1.0.43"
version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e2e59c50ed8f6b050b071aa7b6865293957a9af6b58b94f97c1c9434ad440ea"
checksum = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942"
dependencies = [
 "proc-macro2",
 "quote",


@@ 2332,7 2346,7 @@ version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd"
dependencies = [
 "bytes",
 "bytes 0.5.6",
 "futures-core",
 "iovec",
 "lazy_static",


@@ 2352,7 2366,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
dependencies = [
 "bytes",
 "bytes 0.5.6",
 "futures-core",
 "futures-sink",
 "log",


@@ 2366,7 2380,7 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "log",
 "pin-project-lite",
 "tracing-core",


@@ 2408,7 2422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77"
dependencies = [
 "backtrace",
 "cfg-if",
 "cfg-if 0.1.10",
 "futures",
 "ipconfig",
 "lazy_static",


@@ 2432,6 2446,35 @@ dependencies = [
]

[[package]]
name = "typed-urls"
version = "0.1.0"
source = "git+https://git.sr.ht/~lthms/typed-urls?branch=main#1f203c30307c611503efa32cc92f1bf5ebf8a0eb"
dependencies = [
 "serde",
 "serde_json",
 "typed-urls-derive",
]

[[package]]
name = "typed-urls-derive"
version = "0.1.0"
source = "git+https://git.sr.ht/~lthms/typed-urls?branch=main#1f203c30307c611503efa32cc92f1bf5ebf8a0eb"
dependencies = [
 "quote",
 "syn",
]

[[package]]
name = "typed-urls-tera"
version = "0.1.0"
source = "git+https://git.sr.ht/~lthms/typed-urls?branch=main#1f203c30307c611503efa32cc92f1bf5ebf8a0eb"
dependencies = [
 "serde_json",
 "tera",
 "typed-urls",
]

[[package]]
name = "typenum"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2561,9 2604,9 @@ dependencies = [

[[package]]
name = "v_escape"
version = "0.13.1"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b6314c83e6ae8556969799ae20138813dfc3d0959c16208d867cbdd7fe73eb3"
checksum = "039a44473286eb84e4e74f90165feff67c802dbeced7ee4c5b00d719b0d0475e"
dependencies = [
 "buf-min",
 "v_escape_derive",


@@ 2571,9 2614,9 @@ dependencies = [

[[package]]
name = "v_escape_derive"
version = "0.8.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b84a391de8678b76ec6c1ff762a77688a6132f6ea58a35c744afd8ad070786c2"
checksum = "c860ad1273f4eee7006cee05db20c9e60e5d24cba024a32e1094aa8e574f3668"
dependencies = [
 "nom 4.2.3",
 "proc-macro2",


@@ 2583,11 2626,11 @@ dependencies = [

[[package]]
name = "v_htmlescape"
version = "0.10.3"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ed178900cccc57f65a0f6515376b8673a2f165ddfa0b509c708c761a372b4b"
checksum = "11d7c2a33ed7cf0dc1b42bcf39e01b6512f9df08f09e1cd8a49d9dc49a6a9482"
dependencies = [
 "cfg-if",
 "cfg-if 1.0.0",
 "v_escape",
]



@@ 2650,7 2693,7 @@ version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [
 "cfg-if",
 "cfg-if 0.1.10",
 "wasm-bindgen-macro",
]



@@ 2700,9 2743,9 @@ checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"

[[package]]
name = "wepoll-sys"
version = "3.0.0"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "142bc2cba3fe88be1a8fcb55c727fa4cd5b0cf2d7438722792e22f26f04bc1e0"
checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff"
dependencies = [
 "cc",
]

M Cargo.toml => Cargo.toml +3 -1
@@ 29,4 29,6 @@ r2d2 = "0.8"
rand = "*"
async-process = "*"
futures-lite = "*"
grimoar-shared = { path = 'shared/' }
\ No newline at end of file
grimoar-shared = { path = 'shared/' }
typed-urls = { git = "https://git.sr.ht/~lthms/typed-urls", branch = "main" }
typed-urls-tera = { git = "https://git.sr.ht/~lthms/typed-urls", branch = "main" }
\ No newline at end of file

M src/editor.rs => src/editor.rs +3 -3
@@ 21,13 21,13 @@ use crate::error::Result;
use crate::html::Response;
use crate::models::users::UserSummary;
use crate::page::{context, PageInfo};
use crate::routes::Uri;
use crate::routes::Url;

#[derive(Serialize)]
pub struct Editor {
    pub action : Uri,
    pub action : Url,
    pub world_key : String,
    pub style : Uri,
    pub style : Url,
    pub raw_content : String,
    pub html_content : String,
}

M src/html.rs => src/html.rs +2 -2
@@ 20,7 20,7 @@ use actix_web::http::StatusCode;
use actix_web::{HttpRequest, HttpResponse, Responder};
use futures::future::{ok, Ready};

use crate::routes::Uri;
use crate::routes::Url;

pub enum Response {
    Text {


@@ 33,7 33,7 @@ pub enum Response {
        content : Vec<u8>,
        mime_type : &'static str,
    },
    Redirect(Uri),
    Redirect(Url),
}

impl Response {

M src/main.rs => src/main.rs +4 -3
@@ 41,18 41,19 @@ use anyhow::Result as AnyResult;
use diesel::r2d2::Pool;
use rand::Rng;
use tera::Tera;
use typed_urls_tera::register_typed_url;

use crate::database::PgConnectionManager;
use crate::error::Result;
use crate::html::Response;
use crate::routes::{login, world, worlds, Endpoint, Uri};
use crate::routes::{login, world, worlds, Url};

async fn run() -> AnyResult<()> {
    let mngr =
        PgConnectionManager::new("postgres://grimoar:@localhost/grimoar");

    let mut tera = Tera::new("templates/**/*")?;
    Endpoint::register_to_tera(&mut tera);
    register_typed_url::<Url>(&mut tera);

    let pool = Pool::builder().build(mngr)?;



@@ 102,7 103,7 @@ async fn run() -> AnyResult<()> {

#[get("/")]
async fn get_index() -> Result<Response> {
    Ok(Response::Redirect(Uri::Worlds))
    Ok(Response::Redirect(Url::Worlds))
}

#[actix_web::main]

M src/routes.rs => src/routes.rs +58 -365
@@ 15,379 15,72 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use serde::{Serialize, Serializer};
use serde_json::Value;
use std::collections::HashMap;
use tera::{Error, Function, Tera};
use actix_web::{web::resource, Resource};
use typed_urls::TypedUrl;

pub mod login;
pub mod world;
pub mod worlds;

#[derive(Clone)]
pub enum Endpoint {
#[derive(TypedUrl)]
pub enum Url {
    #[routefmt = "/login"]
    Login,
    #[routefmt = "/explore"]
    Worlds,
    #[routefmt = "/worlds/new"]
    WorldsNew,
    NewText,
    EditText,
    Characters,
    CharactersNew,
    CharactersStyle,
    Character,
    CharacterEdit,
    AuthorCharacters,
    Maps,
    MapsNew,
    Map,
    MapInfo,
    MapEdit,
    MapTile,
    #[routefmt = "/world/{}/text/new"]
    NewText { world_key : String },
    #[routefmt = "/world/{}/text/{}/edit"]
    EditText { world_key : String, text_id : i32 },
    #[routefmt = "/world/{}/characters"]
    Characters { world_key : String },
    #[routefmt = "/world/{}/characters/style.css"]
    CharactersStyle { world_key : String },
    #[routefmt = "/world/{}/characters/new"]
    CharactersNew { world_key : String },
    #[routefmt = "/world/{}/character/{}"]
    Character {
        world_key : String,
        character_key : String,
    },
    #[routefmt = "/world/{}/character/{}/edit"]
    CharacterEdit {
        world_key : String,
        character_key : String,
    },
    #[routefmt = "/world/{}/author/characters"]
    AuthorCharacters { world_key : String },
    #[routefmt = "/world/{}/maps"]
    Maps { world_key : String },
    #[routefmt = "/world/{}/maps/new"]
    MapsNew { world_key : String },
    #[routefmt = "/world/{}/map/{}"]
    Map {
        world_key : String,
        map_key : String,
    },
    #[routefmt = "/world/{}/map/{}/info.json"]
    MapInfo {
        world_key : String,
        map_key : String,
    },
    #[routefmt = "/world/{}/map/{}/edit"]
    MapEdit {
        world_key : String,
        map_key : String,
    },
    #[routefmt = "/world/{}/map/{}/tile/{}/{}/{}"]
    MapTile {
        world_key : String,
        map_key : String,
        x : i32,
        y : i32,
        z : i32,
    },
}

const ENDPOINTS : &[Endpoint] = &[
    Endpoint::Login,
    Endpoint::Worlds,
    Endpoint::WorldsNew,
    Endpoint::NewText,
    Endpoint::EditText,
    Endpoint::Characters,
    Endpoint::CharactersStyle,
    Endpoint::CharactersNew,
    Endpoint::Character,
    Endpoint::CharacterEdit,
    Endpoint::AuthorCharacters,
    Endpoint::Maps,
    Endpoint::MapsNew,
    Endpoint::Map,
    Endpoint::MapInfo,
    Endpoint::MapEdit,
    Endpoint::MapTile,
];

macro_rules! endpoint {
    (Login) => {
        "/connexion"
    };
    (Worlds) => {
        "/mondes"
    };
    (WorldsNew) => {
        "/mondes/nouveau"
    };
    (NewText) => {
        "/monde/{}/textes/nouveau"
    };
    (EditText) => {
        "/monde/{}/texte/{}/modifier"
    };
    (Characters) => {
        "/monde/{}/personnages"
    };
    (CharactersNew) => {
        "/monde/{}/personnages/nouveau"
    };
    (CharactersStyle) => {
        "/monde/{}/personnages/style.css"
    };
    (Character) => {
        "/monde/{}/personnage/{}"
    };
    (CharacterEdit) => {
        "/monde/{}/personnage/{}/modifier"
    };
    (AuthorCharacters) => {
        "/monde/{}/auteur/personnages"
    };
    (Maps) => {
        "/monde/{}/cartes"
    };
    (MapsNew) => {
        "/monde/{}/cartes/nouveau"
    };
    (Map) => {
        "/monde/{}/carte/{}"
    };
    (MapInfo) => {
        "/monde/{}/carte/{}/info.json"
    };
    (MapEdit) => {
        "/monde/{}/carte/{}/modifier"
    };
    (MapTile) => {
        "/monde/{}/carte/{}/tiles/{}/{}/{}"
    };
}

pub enum Uri {
    Login,
    Worlds,
    WorldsNew,
    NewText(String),
    EditText(String, i32),
    Characters(String),
    CharactersStyle(String),
    CharactersNew(String),
    Character(String, String),
    CharacterEdit(String, String),
    AuthorCharacters(String),
    Maps(String),
    MapsNew(String),
    Map(String, String),
    MapInfo(String, String),
    MapEdit(String, String),
    MapTile(String, String, u32, u32, u32),
}

impl Endpoint {
    fn to_uri(
        &self,
        args : &HashMap<String, Value>,
    ) -> Option<Uri> {
        match self {
            Endpoint::Login => Some(Uri::Login),
            Endpoint::Worlds => Some(Uri::Worlds),
            Endpoint::WorldsNew => Some(Uri::WorldsNew),
            Endpoint::NewText => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::NewText(world_key))
            }
            Endpoint::EditText => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let text_id = args.get("text_id").and_then(Value::as_i64)?;
                Some(Uri::EditText(world_key, text_id as i32))
            }
            Endpoint::Characters => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::Characters(world_key))
            }
            Endpoint::CharactersStyle => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::CharactersStyle(world_key))
            }
            Endpoint::CharactersNew => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::CharactersNew(world_key))
            }
            Endpoint::Character => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let character_key = args
                    .get("character_key")
                    .and_then(Value::as_str)?
                    .to_owned();
                Some(Uri::Character(world_key, character_key))
            }
            Endpoint::CharacterEdit => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let character_key = args
                    .get("character_key")
                    .and_then(Value::as_str)?
                    .to_owned();
                Some(Uri::CharacterEdit(world_key, character_key))
            }
            Endpoint::AuthorCharacters => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::AuthorCharacters(world_key))
            }
            Endpoint::Maps => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::Maps(world_key))
            }
            Endpoint::MapsNew => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::MapsNew(world_key))
            }
            Endpoint::MapEdit => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let map_key =
                    args.get("map_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::MapEdit(world_key, map_key))
            }
            Endpoint::Map => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let map_key =
                    args.get("map_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::Map(world_key, map_key))
            }
            Endpoint::MapInfo => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let map_key =
                    args.get("map_key").and_then(Value::as_str)?.to_owned();
                Some(Uri::MapInfo(world_key, map_key))
            }
            Endpoint::MapTile => {
                let world_key =
                    args.get("world_key").and_then(Value::as_str)?.to_owned();
                let map_key =
                    args.get("map_key").and_then(Value::as_str)?.to_owned();
                let x = args.get("z").and_then(Value::as_i64)?;
                let y = args.get("x").and_then(Value::as_i64)?;
                let z = args.get("y").and_then(Value::as_i64)?;
                Some(Uri::MapTile(
                    world_key, map_key, z as u32, x as u32, y as u32,
                ))
            }
        }
    }

    pub fn to_string(&self) -> String {
        match self {
            Endpoint::Login => format!(endpoint!(Login)),
            Endpoint::Worlds => format!(endpoint!(Worlds)),
            Endpoint::WorldsNew => format!(endpoint!(WorldsNew)),
            Endpoint::Characters => {
                format!(endpoint!(Characters), "{world_key}")
            }
            Endpoint::CharactersStyle => {
                format!(endpoint!(CharactersStyle), "{world_key}")
            }
            Endpoint::CharactersNew => {
                format!(endpoint!(CharactersNew), "{world_key}")
            }
            Endpoint::Character => {
                format!(endpoint!(Character), "{world_key}", "{character_key}")
            }
            Endpoint::CharacterEdit => format!(
                endpoint!(CharacterEdit),
                "{world_key}", "{character_key}"
            ),
            Endpoint::AuthorCharacters => {
                format!(endpoint!(AuthorCharacters), "{world_key}")
            }
            Endpoint::NewText => format!(endpoint!(NewText), "{world_key}"),
            Endpoint::EditText => {
                format!(endpoint!(EditText), "{world_key}", "{text_id}")
            }
            Endpoint::Maps => format!(endpoint!(Maps), "{world_key}"),
            Endpoint::MapsNew => format!(endpoint!(MapsNew), "{world_key}"),
            Endpoint::Map => {
                format!(endpoint!(Map), "{world_key}", "{map_key}")
            }
            Endpoint::MapInfo => {
                format!(endpoint!(MapInfo), "{world_key}", "{map_key}")
            }
            Endpoint::MapEdit => {
                format!(endpoint!(MapEdit), "{world_key}", "{map_key}")
            }
            Endpoint::MapTile => format!(
                endpoint!(MapTile),
                "{world_key}", "{map_key}", "{z}", "{x}", "{y}"
            ),
        }
    }

    pub fn register_to_tera(tera : &mut Tera) -> () {
        for endpoint in ENDPOINTS {
            tera.register_function(
                endpoint.to_function_name(),
                endpoint.clone(),
            );
        }
    }

    fn to_function_name(&self) -> &str {
        match self {
            Endpoint::Login => "login_uri",
            Endpoint::Worlds => "worlds_uri",
            Endpoint::WorldsNew => "worlds_new_uri",
            Endpoint::Characters => "characters_uri",
            Endpoint::CharactersStyle => "characters_style_uri",
            Endpoint::CharactersNew => "characters_new_uri",
            Endpoint::Character => "character_uri",
            Endpoint::CharacterEdit => "character_edit_uri",
            Endpoint::AuthorCharacters => "author_characters_uri",
            Endpoint::NewText => "new_text_uri",
            Endpoint::EditText => "edit_text_uri",
            Endpoint::Maps => "maps_uri",
            Endpoint::MapsNew => "maps_new_uri",
            Endpoint::Map => "map_uri",
            Endpoint::MapInfo => "map_uri_info",
            Endpoint::MapEdit => "map_edit_uri",
            Endpoint::MapTile => "map_tile_uri",
        }
    }
}

impl Function for Endpoint {
    fn call(
        &self,
        args : &HashMap<String, Value>,
    ) -> Result<Value, Error> {
        let res = self
            .to_uri(args)
            .ok_or(Error::msg("missing `key_world' argument"))?;

        Ok(Value::String(res.to_string()))
    }
}

impl Uri {
    pub fn to_string(&self) -> String {
        match self {
            Uri::Login => format!(endpoint!(Login)),
            Uri::Worlds => format!(endpoint!(Worlds)),
            Uri::WorldsNew => format!(endpoint!(WorldsNew)),
            Uri::Characters(world_key) => {
                format!(endpoint!(Characters), world_key)
            }
            Uri::CharactersStyle(world_key) => {
                format!(endpoint!(CharactersStyle), world_key)
            }
            Uri::CharactersNew(world_key) => {
                format!(endpoint!(CharactersNew), world_key)
            }
            Uri::Character(world_key, character_key) => {
                format!(endpoint!(Character), world_key, character_key)
            }
            Uri::CharacterEdit(world_key, character_key) => {
                format!(endpoint!(CharacterEdit), world_key, character_key)
            }
            Uri::AuthorCharacters(world_key) => {
                format!(endpoint!(AuthorCharacters), world_key)
            }
            Uri::NewText(world_key) => format!(endpoint!(NewText), world_key),
            Uri::EditText(world_key, text_id) => {
                format!(endpoint!(EditText), world_key, text_id)
            }
            Uri::Maps(world_key) => format!(endpoint!(Maps), world_key),
            Uri::MapsNew(world_key) => format!(endpoint!(MapsNew), world_key),
            Uri::Map(world_key, map_key) => {
                format!(endpoint!(Map), world_key, map_key)
            }
            Uri::MapInfo(world_key, map_key) => {
                format!(endpoint!(MapInfo), world_key, map_key)
            }
            Uri::MapEdit(world_key, map_key) => {
                format!(endpoint!(MapEdit), world_key, map_key)
            }
            Uri::MapTile(world_key, map_key, z, x, y) => {
                format!(endpoint!(MapTile), world_key, map_key, z, x, y)
            }
        }
    }
}

impl Serialize for Uri {
    fn serialize<S>(
        &self,
        serializer : S,
    ) -> Result<S::Ok, S::Error>
    where
        S : Serializer,
    {
        serializer.serialize_str(&self.to_string())
    }
pub fn endpoint(r : Route) -> Resource {
    resource(r.to_string())
}

M src/routes/login.rs => src/routes/login.rs +7 -7
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, post, resource, Data, Form};
use actix_web::web::{get, post, Data, Form};
use actix_web::Resource;
use diesel::prelude::*;
use tera::Tera;


@@ 25,7 25,7 @@ use crate::database::PgPool;
use crate::error::Result;
use crate::html::Response;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};
use crate::schema::users;

async fn render_login_page(tera : &Tera) -> Result<String> {


@@ 34,7 34,7 @@ async fn render_login_page(tera : &Tera) -> Result<String> {
        message : None,
    };

    let content = json!({ "login_route": Uri::Login });
    let content = json!({ "login_route": Url::Login });

    let res = tera.render("login.html", &context(pageinfo, content, None)?)?;



@@ 46,7 46,7 @@ async fn get_login(
    id : Identity,
) -> Result<Response> {
    if let Some(_) = id.identity() {
        Ok(Response::Redirect(Uri::Worlds))
        Ok(Response::Redirect(Url::Worlds))
    } else {
        Ok(Response::html(render_login_page(&tera).await?))
    }


@@ 64,7 64,7 @@ async fn post_login(
    id : Identity,
) -> Result<Response> {
    if let Some(_) = id.identity() {
        Ok(Response::Redirect(Uri::Worlds))
        Ok(Response::Redirect(Url::Worlds))
    } else {
        let conn = pool.into_inner().get()?;



@@ 78,7 78,7 @@ async fn post_login(
        if user_exists {
            id.remember(form.nickname.clone());

            Ok(Response::Redirect(Uri::Worlds))
            Ok(Response::Redirect(Url::Worlds))
        } else {
            Ok(Response::html(render_login_page(&tera).await?))
        }


@@ 86,7 86,7 @@ async fn post_login(
}

pub fn routes() -> Resource {
    resource(Endpoint::Login.to_string())
    endpoint(Route::Login)
        .route(get().to(get_login))
        .route(post().to(post_login))
}

M src/routes/world/author/characters.rs => src/routes/world/author/characters.rs +3 -4
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 27,7 27,7 @@ use crate::models::characters::Character;
use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::page::{context, PageInfo};
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

async fn get_characters(
    Path(world_key) : Path<String>,


@@ 64,6 64,5 @@ async fn get_characters(
}

pub fn routes() -> Resource {
    resource(Endpoint::AuthorCharacters.to_string())
        .route(get().to(get_characters))
    endpoint(Route::AuthorCharacters).route(get().to(get_characters))
}

M src/routes/world/character.rs => src/routes/world/character.rs +3 -3
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 27,7 27,7 @@ use crate::models::characters::Character;
use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::page::{context, PageInfo};
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

pub mod edit;



@@ 66,5 66,5 @@ pub async fn get_character(
}

pub fn routes() -> Resource {
    resource(Endpoint::Character.to_string()).route(get().to(get_character))
    endpoint(Route::Character).route(get().to(get_character))
}

M src/routes/world/character/edit.rs => src/routes/world/character/edit.rs +7 -4
@@ 17,7 17,7 @@

use actix_identity::Identity;
use actix_multipart::Multipart;
use actix_web::web::{get, post, resource, Data, Path};
use actix_web::web::{get, post, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 29,7 29,7 @@ use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::multipart::FormData;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

#[derive(Deserialize)]
struct UpdateCharacterForm {


@@ 91,7 91,10 @@ async fn post_character_edit(
        .async_update(pool.get()?, character.id, character.is_primary())
        .await?;

    Ok(Response::Redirect(Uri::Character(world_key, character_key)))
    Ok(Response::Redirect(Url::Character {
        world_key,
        character_key,
    }))
}

async fn get_character_edit(


@@ 133,7 136,7 @@ async fn get_character_edit(
}

pub fn routes() -> Resource {
    resource(Endpoint::CharacterEdit.to_string())
    endpoint(Route::CharacterEdit)
        .route(get().to(get_character_edit))
        .route(post().to(post_character_edit))
}

M src/routes/world/characters.rs => src/routes/world/characters.rs +4 -4
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 27,7 27,7 @@ use crate::models::characters::CharacterSummary;
use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

pub mod new;
pub mod style;


@@ 49,7 49,7 @@ async fn get_characters(

    let content = json!({
        "characters": data,
        "add_route": Uri::Characters(key.clone()),
        "add_route": Url::Characters{world_key:key.clone()},
        "world_key": &key,
        "world_id": world_id,
    });


@@ 67,5 67,5 @@ async fn get_characters(
}

pub fn routes() -> Resource {
    resource(Endpoint::Characters.to_string()).route(get().to(get_characters))
    endpoint(Route::Characters).route(get().to(get_characters))
}

M src/routes/world/characters/new.rs => src/routes/world/characters/new.rs +7 -4
@@ 17,7 17,7 @@

use actix_identity::Identity;
use actix_multipart::Multipart;
use actix_web::web::{get, post, resource, Data, Path};
use actix_web::web::{get, post, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 31,7 31,7 @@ use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::multipart::FormData;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

struct NewCharacterForm {
    key : String,


@@ 147,11 147,14 @@ async fn post_characters_new(

    form.async_insert(&pool, world_id, user_id).await?;

    Ok(Response::Redirect(Uri::Character(key, character_key)))
    Ok(Response::Redirect(Url::Character {
        world_key : key,
        character_key : character_key,
    }))
}

pub fn routes() -> Resource {
    resource(Endpoint::CharactersNew.to_string())
    endpoint(Route::CharactersNew)
        .route(get().to(get_characters_new))
        .route(post().to(post_characters_new))
}

M src/routes/world/characters/style.rs => src/routes/world/characters/style.rs +3 -4
@@ 15,7 15,7 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::{Context, Tera};



@@ 23,7 23,7 @@ use crate::database::PgPool;
use crate::error::Result;
use crate::html::Response;
use crate::models::characters::CharacterStyle;
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

async fn get_characters_style(
    key : Path<String>,


@@ 40,6 40,5 @@ async fn get_characters_style(
}

pub fn routes() -> Resource {
    resource(Endpoint::CharactersStyle.to_string())
        .route(get().to(get_characters_style))
    endpoint(Route::CharactersStyle).route(get().to(get_characters_style))
}

M src/routes/world/map.rs => src/routes/world/map.rs +3 -3
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 25,7 25,7 @@ use crate::error::Result;
use crate::html::Response;
use crate::models::users::UserSummary;
use crate::page::{context, PageInfo};
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

pub mod edit;
pub mod info;


@@ 57,5 57,5 @@ async fn get_map(
}

pub fn routes() -> Resource {
    resource(Endpoint::Map.to_string()).route(get().to(get_map))
    endpoint(Route::Map).route(get().to(get_map))
}

M src/routes/world/map/edit.rs => src/routes/world/map/edit.rs +8 -5
@@ 17,7 17,7 @@

use actix_identity::Identity;
use actix_multipart::Multipart;
use actix_web::web::{get, post, resource, Data, Path};
use actix_web::web::{get, post, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 27,7 27,7 @@ use crate::html::Response;
use crate::models::maps::MapUpdate;
use crate::models::users::UserSummary;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

pub async fn get_map_edit(
    pool : Data<PgPool>,


@@ 45,7 45,10 @@ pub async fn get_map_edit(
    let ctx = context(
        pi,
        json!({
            "add_route" : Uri::MapEdit(world_key.clone(), map_key.clone()),
            "add_route" : Url::MapEdit {
                world_key : world_key.clone(),
                map_key : map_key.clone()
            },
            "summary" : map
        }),
        UserSummary::async_from_identity(pool.get()?, &id).await?,


@@ 66,11 69,11 @@ pub async fn post_map_edit(

    update.async_update(pool.get()?, &map_key).await?;

    Ok(Response::Redirect(Uri::Map(world_key, map_key)))
    Ok(Response::Redirect(Url::Map { world_key, map_key }))
}

pub fn routes() -> Resource {
    resource(Endpoint::MapEdit.to_string())
    endpoint(Route::MapEdit)
        .route(get().to(get_map_edit))
        .route(post().to(post_map_edit))
}

M src/routes/world/map/info.rs => src/routes/world/map/info.rs +8 -5
@@ 15,13 15,13 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::{HttpResponse, Resource};

use crate::database::PgPool;
use crate::error::Result;
use crate::models::maps::Map;
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

#[derive(Serialize)]
struct MapInfo {


@@ 29,7 29,7 @@ struct MapInfo {
    max_zoom : i32,
    width : i32,
    height : i32,
    base_url : Uri,
    base_url : Url,
}

async fn get_info(


@@ 43,10 43,13 @@ async fn get_info(
        max_zoom : summary.max_zoom,
        width : summary.width as i32,
        height : summary.height as i32,
        base_url : Uri::Map(key, map_key),
        base_url : Url::Map {
            world_key : key,
            map_key : map_key,
        },
    }))
}

pub fn routes() -> Resource {
    resource(Endpoint::MapInfo.to_string()).route(get().to(get_info))
    endpoint(Route::MapInfo).route(get().to(get_info))
}

M src/routes/world/map/tile.rs => src/routes/world/map/tile.rs +3 -3
@@ 15,14 15,14 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;

use crate::database::PgPool;
use crate::error::Result;
use crate::html::Response;
use crate::models::maps::Map;
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

async fn get_tile(
    pool : Data<PgPool>,


@@ 36,5 36,5 @@ async fn get_tile(
}

pub fn routes() -> Resource {
    resource(Endpoint::MapTile.to_string()).route(get().to(get_tile))
    endpoint(Route::MapTile).route(get().to(get_tile))
}

M src/routes/world/maps.rs => src/routes/world/maps.rs +3 -3
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data, Path};
use actix_web::web::{get, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 26,7 26,7 @@ use crate::html::Response;
use crate::models::maps::MapSummary;
use crate::models::users::UserSummary;
use crate::page::{context, PageInfo};
use crate::routes::Endpoint;
use crate::routes::{endpoint, Route};

pub mod new;



@@ 58,5 58,5 @@ pub async fn get_maps(
}

pub fn routes() -> Resource {
    resource(Endpoint::Maps.to_string()).route(get().to(get_maps))
    endpoint(Route::Maps).route(get().to(get_maps))
}

M src/routes/world/maps/new.rs => src/routes/world/maps/new.rs +8 -5
@@ 17,7 17,7 @@

use actix_identity::Identity;
use actix_multipart::Multipart;
use actix_web::web::{get, post, resource, Data, Path};
use actix_web::web::{get, post, Data, Path};
use actix_web::Resource;
use tera::Tera;



@@ 28,7 28,7 @@ use crate::models::maps::NewMap;
use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

async fn get_new(
    pool : Data<PgPool>,


@@ 45,7 45,7 @@ async fn get_new(
        pi,
        json!({
            "world_key": &world_key,
            "add_route": Uri::Maps(world_key.clone())
            "add_route": Url::Maps { world_key : world_key.clone() }
        }),
        UserSummary::async_from_identity(pool.get()?, &id).await?,
    )?;


@@ 67,11 67,14 @@ async fn post_new(

    new.async_insert(pool.get()?, world_id).await?;

    Ok(Response::Redirect(Uri::Map(world_key, key)))
    Ok(Response::Redirect(Url::Map {
        world_key : world_key,
        map_key : key,
    }))
}

pub fn routes() -> Resource {
    resource(Endpoint::MapsNew.to_string())
    endpoint(Route::MapsNew)
        .route(get().to(get_new))
        .route(post().to(post_new))
}

M src/routes/world/text/edit.rs => src/routes/world/text/edit.rs +14 -6
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, post, resource, Data, Form, Path};
use actix_web::web::{get, post, Data, Form, Path};
use actix_web::Resource;
use tera::Tera;



@@ 27,7 27,7 @@ use crate::html::Response;
use crate::models::texts::{TextSubmission, TextView};
use crate::models::users::UserSummary;
use crate::page::PageInfo;
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

pub async fn get_texts_edit(
    Path((key, tid)) : Path<(String, i32)>,


@@ 44,8 44,13 @@ pub async fn get_texts_edit(
            message : None,
        },
        Editor {
            action : Uri::EditText(key.clone(), tid),
            style : Uri::CharactersStyle(key.clone()),
            action : Url::EditText {
                world_key : key.clone(),
                text_id : tid,
            },
            style : Url::CharactersStyle {
                world_key : key.clone(),
            },
            world_key : key,
            raw_content : text_view.raw,
            html_content : text_view.html,


@@ 62,11 67,14 @@ pub async fn post_texts_edit(
) -> Result<Response> {
    input.into_inner().async_update(pool.get()?, tid).await?;

    Ok(Response::Redirect(Uri::EditText(key, tid)))
    Ok(Response::Redirect(Url::EditText {
        world_key : key,
        text_id : tid,
    }))
}

pub fn routes() -> Resource {
    resource(Endpoint::EditText.to_string())
    endpoint(Route::EditText)
        .route(get().to(get_texts_edit))
        .route(post().to(post_texts_edit))
}

M src/routes/world/texts/new.rs => src/routes/world/texts/new.rs +13 -6
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, post, resource, Data, Form, Path};
use actix_web::web::{get, post, Data, Form, Path};
use actix_web::Resource;
use tera::Tera;



@@ 28,7 28,7 @@ use crate::models::texts::TextSubmission;
use crate::models::users::UserSummary;
use crate::models::worlds::async_find_world_id;
use crate::page::PageInfo;
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

pub async fn post_texts_new(
    Path(key) : Path<String>,


@@ 39,7 39,10 @@ pub async fn post_texts_new(

    let id = input.async_insert(pool.get()?, wid).await?;

    Ok(Response::Redirect(Uri::EditText(key, id)))
    Ok(Response::Redirect(Url::EditText {
        world_key : key,
        text_id : id,
    }))
}

pub async fn get_texts_new(


@@ 59,8 62,12 @@ pub async fn get_texts_new(
            message : None,
        },
        Editor {
            action : Uri::NewText(key.clone()),
            style : Uri::CharactersStyle(key.clone()),
            action : Url::NewText {
                world_key : key.clone(),
            },
            style : Url::CharactersStyle {
                world_key : key.clone(),
            },
            world_key : key,
            raw_content : "".into(),
            html_content : "".into(),


@@ 71,7 78,7 @@ pub async fn get_texts_new(
}

pub fn routes() -> Resource {
    resource(Endpoint::NewText.to_string())
    endpoint(Route::NewText)
        .route(get().to(get_texts_new))
        .route(post().to(post_texts_new))
}

M src/routes/worlds.rs => src/routes/worlds.rs +4 -4
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, resource, Data};
use actix_web::web::{get, Data};
use actix_web::Resource;
use tera::Tera;



@@ 26,7 26,7 @@ use crate::html::Response;
use crate::models::users::UserSummary;
use crate::models::worlds::WorldSummary;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

pub mod new;



@@ 44,7 44,7 @@ async fn get_worlds(

    let content = json!({
        "worlds": data,
        "add_route": Uri::Worlds
        "add_route": Url::Worlds
    });

    let res = tera.render(


@@ 60,5 60,5 @@ async fn get_worlds(
}

pub fn routes() -> Resource {
    resource(Endpoint::Worlds.to_string()).route(get().to(get_worlds))
    endpoint(Route::Worlds).route(get().to(get_worlds))
}

M src/routes/worlds/new.rs => src/routes/worlds/new.rs +6 -4
@@ 16,7 16,7 @@
 */

use actix_identity::Identity;
use actix_web::web::{get, post, resource, Data, Form};
use actix_web::web::{get, post, Data, Form};
use actix_web::Resource;
use tera::Tera;



@@ 26,7 26,7 @@ use crate::html::Response;
use crate::models::users::UserSummary;
use crate::models::worlds::NewWorldForm;
use crate::page::{context, PageInfo};
use crate::routes::{Endpoint, Uri};
use crate::routes::{endpoint, Route, Url};

async fn post_new_world(
    pool : Data<PgPool>,


@@ 39,7 39,9 @@ async fn post_new_world(

    form.async_insert(pool.get()?).await?;

    Ok(Response::Redirect(Uri::Characters(form.key.clone())))
    Ok(Response::Redirect(Url::Characters {
        world_key : form.key.clone(),
    }))
}

async fn get_new_world(


@@ 65,7 67,7 @@ async fn get_new_world(
}

pub fn routes() -> Resource {
    resource(Endpoint::WorldsNew.to_string())
    endpoint(Route::WorldsNew)
        .route(get().to(get_new_world))
        .route(post().to(post_new_world))
}

M templates/author_characters.html => templates/author_characters.html +2 -2
@@ 5,7 5,7 @@

{% for primary in content.characters %}
  <h2>
    <a href="{{ character_uri(world_key=content.world_key,character_key=primary.key) }}">
    <a href="{{ CharacterUrl(world_key=content.world_key,character_key=primary.key) }}">
      {{ primary.name }}
    </a>
  </h2>


@@ 14,7 14,7 @@
    {% for character in primary.relation.secondaries %}
    <a class="listboard_entry"
       style="border-left: .3em solid {{ character.color }};"
       href="{{ character_uri(world_key=content.world_key,character_key=character.key) }}">
       href="{{ CharacterUrl(world_key=content.world_key,character_key=character.key) }}">
      <span class="title" style="color: {{ character.color }}">{{ character.name }}</span>
    </a>
    {% endfor %}

M templates/base.html => templates/base.html +8 -8
@@ 13,14 13,14 @@
  <body>
    <!-- Primary navigation bar -->
    <nav>
      <a class="menu_entry" href="{{ worlds_uri() }}">
      <a class="menu_entry" href="{{ WorldsUrl() }}">
        <div class="icon explore">
        <i class="fa fa-compass"></i>
        </div>
        <span class="subtitle">Explorer</span>
      </a>
      {% if user %}
      <a class="menu_entry" href="{{ worlds_new_uri() }}">
      <a class="menu_entry" href="{{ WorldsNewUrl() }}">
        <div class="icon new_world">
        <i class="fa fa-plus"></i>
        </div>


@@ 37,7 37,7 @@
        <span class="subtitle">{{ user.nickname }}</span>
      </span>
      {% else %}
      <a class="menu_entry" href="{{ login_uri() }}">
      <a class="menu_entry" href="{{ LoginUrl() }}">
        <div class="icon sign-in">
        <i class="fa fa-sign-in"></i>
        </div>


@@ 55,13 55,13 @@
        <div class="icon">
          <i class="fa fa-users"></i>
        </div>
        <a href="{{ characters_uri(world_key=content.world_key) }}">Personnages</a>
        <a href="{{ CharactersUrl(world_key=content.world_key) }}">Personnages</a>
      </div>
      <div class="menu_entry">
        <div class="icon">
          <i class="fa fa-map-o"></i>
        </div>
        <a href="{{ maps_uri(world_key=content.world_key) }}">Cartes</a>
        <a href="{{ MapsUrl(world_key=content.world_key) }}">Cartes</a>
      </div>
      {% if user %}
      <div class="menu_category">


@@ 71,13 71,13 @@
        <div class="icon">
          <i class="fa fa-users"></i>
        </div>
        <a href="{{ author_characters_uri(world_key=content.world_key) }}">Mes personnages</a>
        <a href="{{ AuthorCharactersUrl(world_key=content.world_key) }}">Mes personnages</a>
      </div>
      <div class="menu_entry">
        <div class="icon">
          <i class="fa fa-i-cursor"></i>
        </div>
        <a href="{{ new_text_uri(world_key=content.world_key) }}">Nouveau texte</a>
        <a href="{{ NewTextUrl(world_key=content.world_key) }}">Nouveau texte</a>
      </div>
      <div class="menu_category">
        Mon espace <em>Worldbuilding</em>


@@ 86,7 86,7 @@
        <div class="icon">
          <i class="fa fa-map"></i>
        </div>
        <a href="{{ maps_new_uri(world_key=content.world_key) }}">
        <a href="{{ MapsNewUrl(world_key=content.world_key) }}">
          Nouvelle carte
        </a>
      </div>

M templates/character.html => templates/character.html +2 -2
@@ 7,14 7,14 @@
  {% if content.character.relation.referrer %}
    <a class="listboard_entry"
       style="border-left: .3em solid {{ content.character.relation.referrer.color }};"
       href="{{ character_uri(world_key=content.world_key,character_key=content.character.relation.referrer.key) }}">
       href="{{ CharacterUrl(world_key=content.world_key,character_key=content.character.relation.referrer.key) }}">
      <span class="title" style="color: {{ content.character.relation.referrer.color }}">{{ content.character.relation.referrer.name }}</span>
    </a>
  {% else %}
  {% for character in content.character.relation.secondaries %}
    <a class="listboard_entry"
       style="border-left: .3em solid {{ character.color }};"
       href="{{ character_uri(world_key=content.world_key,character_key=character.key) }}">
       href="{{ CharacterUrl(world_key=content.world_key,character_key=character.key) }}">
      <span class="title" style="color: {{ character.color }}">{{ character.name }}</span>
    </a>
  {% endfor %}

M templates/character_edit.html => templates/character_edit.html +1 -1
@@ 15,6 15,6 @@
<div class="primary_container">
  <h1>Modifier un personnage</h1>

  {{ form::character(action=character_edit_uri(world_key=content.world_key, character_key=content.character.key), summary=content.character) }}
  {{ form::character(action=CharacterEditUrl(world_key=content.world_key, character_key=content.character.key), summary=content.character) }}
</div>
{% endblock content %}

M templates/characters_list.html => templates/characters_list.html +1 -1
@@ 5,7 5,7 @@
{% for character in content.characters %}
    <a class="listboard_entry"
       style="border-left: .3em solid {{ character.color }};"
       href="{{ character_uri(world_key=content.world_key,character_key=character.key) }}">
       href="{{ CharacterUrl(world_key=content.world_key,character_key=character.key) }}">
      <span class="title" style="color: {{ character.color }}">{{ character.name }}</span>
    </a>
{% endfor %}

M templates/characters_new.html => templates/characters_new.html +1 -1
@@ 14,6 14,6 @@
<div class="primary_container">
  <h1>Création de personnage</h1>

  {{ form::character(action=characters_new_uri(world_key=content.world_key), ask_key=true) }}
  {{ form::character(action=CharactersNewUrl(world_key=content.world_key), ask_key=true) }}
</div>
{% endblock content %}

M templates/map_widget.html => templates/map_widget.html +1 -1
@@ 20,6 20,6 @@
</div>
<script src="/assets/map_view.js"></script>
<script>
  install_map('mapid', '{{ map_uri(world_key=content.world_key, map_key=content.map_key) | safe }}/info.json');
  install_map('mapid', '{{ MapUrl(world_key=content.world_key, map_key=content.map_key) | safe }}/info.json');
</script>
{% endblock content %}

M templates/maps.html => templates/maps.html +1 -1
@@ 5,7 5,7 @@
{% for map in content.maps %}
    <a class="listboard_entry"
       style="border-left: .3em solid black"
       href="{{ map_uri(world_key=content.world_key, map_key=map.key) }}">
       href="{{ MapUrl(world_key=content.world_key, map_key=map.key) }}">
      <span class="title">{{ map.name }}</span>
    </a>
{% endfor %}

M templates/worlds.html => templates/worlds.html +3 -3
@@ 4,9 4,9 @@
{% for world in content.worlds %}
  <dt>{{ world.name }}</dt>
  <dd>
    <a href="{{ characters_uri(world_key=world.key) }}">Personnages</a>
    <a href="{{ maps_uri(world_key=world.key) }}">Cartes</a>
    <a href="{{ new_text_uri(world_key=world.key) }}">Nouveau texte</a>
    <a href="{{ CharactersUrl(world_key=world.key) }}">Personnages</a>
    <a href="{{ MapsUrl(world_key=world.key) }}">Cartes</a>
    <a href="{{ NewTextUrl(world_key=world.key) }}">Nouveau texte</a>
  </dd>
{% endfor %}
</dl>

M templates/worlds_new.html => templates/worlds_new.html +1 -1
@@ 4,6 4,6 @@
<div class="primary_container">
  <h1>Créer un monde</h1>

  {{ form::world(action=worlds_new_uri(), ask_key=true) }}
  {{ form::world(action=WorldsNewUrl(), ask_key=true) }}
</div>
{% endblock content %}