From 9d2b6ee10ec5359cc91769d430485c8c869ba1a8 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 24 Dec 2020 10:51:40 +0530 Subject: monorepo --- .direnv/flake-profile | 1 + .direnv/flake-profile.rc | 1506 +++++++++++++ .gitignore | 2 +- Cargo.lock | 2241 -------------------- Cargo.toml | 29 - backend/Cargo.lock | 2241 ++++++++++++++++++++ backend/Cargo.toml | 29 + backend/diesel.toml | 5 + backend/migrations/.gitkeep | 0 .../2020-09-22-104623_create_users/down.sql | 3 + .../2020-09-22-104623_create_users/up.sql | 8 + .../down.sql | 3 + .../2020-11-16-133516_create_products_table/up.sql | 8 + .../2020-12-13-140215_all_tables/down.sql | 11 + .../migrations/2020-12-13-140215_all_tables/up.sql | 47 + backend/rustfmt.toml | 15 + backend/src/bin/server.rs | 94 + backend/src/handlers/cart_items.rs | 107 + backend/src/handlers/mod.rs | 5 + backend/src/handlers/product.rs | 138 ++ backend/src/handlers/rating.rs | 91 + backend/src/handlers/smoke.rs | 15 + backend/src/handlers/users.rs | 148 ++ backend/src/lib.rs | 10 + backend/src/models.rs | 97 + backend/src/schema.rs | 61 + backend/tests/product/chair.json | 6 + backend/tests/product/dumb_sofa.json | 4 + backend/tests/product/smart_sofa.json | 6 + backend/tests/requests.txt | 21 + backend/tests/users/add_akshay.json | 8 + backend/tests/users/add_user.json | 7 + default.nix | 18 - diesel.toml | 5 - flake.lock | 44 + flake.nix | 43 + frontend/.direnv/flake-profile | 1 + frontend/.direnv/flake-profile.rc | 1473 +++++++++++++ frontend/elm-stuff/0.19.1/Cart.elmi | Bin 0 -> 4274 bytes frontend/elm-stuff/0.19.1/Cart.elmo | Bin 0 -> 6973 bytes frontend/elm-stuff/0.19.1/Catalog.elmi | Bin 0 -> 4112 bytes frontend/elm-stuff/0.19.1/Catalog.elmo | Bin 0 -> 5002 bytes frontend/elm-stuff/0.19.1/Login.elmi | Bin 0 -> 2307 bytes frontend/elm-stuff/0.19.1/Login.elmo | Bin 0 -> 5241 bytes frontend/elm-stuff/0.19.1/Main.elmi | Bin 0 -> 19391 bytes frontend/elm-stuff/0.19.1/Main.elmo | Bin 0 -> 14316 bytes frontend/elm-stuff/0.19.1/Product.elmi | Bin 0 -> 11250 bytes frontend/elm-stuff/0.19.1/Product.elmo | Bin 0 -> 15801 bytes frontend/elm-stuff/0.19.1/Signup.elmi | Bin 0 -> 3892 bytes frontend/elm-stuff/0.19.1/Signup.elmo | Bin 0 -> 8736 bytes frontend/elm-stuff/0.19.1/d.dat | Bin 0 -> 2696 bytes frontend/elm-stuff/0.19.1/i.dat | Bin 0 -> 122650 bytes frontend/elm-stuff/0.19.1/lock | 0 frontend/elm-stuff/0.19.1/o.dat | Bin 0 -> 482300 bytes frontend/elm.json | 27 + frontend/src/Cart.elm | 164 ++ frontend/src/Catalog.elm | 125 ++ frontend/src/Login.elm | 119 ++ frontend/src/Main.elm | 339 +++ frontend/src/Product.elm | 302 +++ frontend/src/Signup.elm | 194 ++ migrations/.gitkeep | 0 migrations/2020-09-22-104623_create_users/down.sql | 3 - migrations/2020-09-22-104623_create_users/up.sql | 8 - .../down.sql | 3 - .../2020-11-16-133516_create_products_table/up.sql | 8 - migrations/2020-12-13-140215_all_tables/down.sql | 11 - migrations/2020-12-13-140215_all_tables/up.sql | 47 - nix/sources.json | 50 - nix/sources.nix | 148 -- rustfmt.toml | 15 - shell.nix | 34 - src/bin/server.rs | 94 - src/handlers/cart_items.rs | 107 - src/handlers/mod.rs | 5 - src/handlers/product.rs | 138 -- src/handlers/rating.rs | 91 - src/handlers/smoke.rs | 15 - src/handlers/users.rs | 148 -- src/lib.rs | 10 - src/models.rs | 97 - src/schema.rs | 61 - tests/product/chair.json | 6 - tests/product/dumb_sofa.json | 4 - tests/product/smart_sofa.json | 6 - tests/requests.txt | 21 - tests/users/add_akshay.json | 8 - tests/users/add_user.json | 7 - 88 files changed, 7527 insertions(+), 3439 deletions(-) create mode 120000 .direnv/flake-profile create mode 100644 .direnv/flake-profile.rc delete mode 100644 Cargo.lock delete mode 100644 Cargo.toml create mode 100644 backend/Cargo.lock create mode 100644 backend/Cargo.toml create mode 100644 backend/diesel.toml create mode 100644 backend/migrations/.gitkeep create mode 100644 backend/migrations/2020-09-22-104623_create_users/down.sql create mode 100644 backend/migrations/2020-09-22-104623_create_users/up.sql create mode 100644 backend/migrations/2020-11-16-133516_create_products_table/down.sql create mode 100644 backend/migrations/2020-11-16-133516_create_products_table/up.sql create mode 100644 backend/migrations/2020-12-13-140215_all_tables/down.sql create mode 100644 backend/migrations/2020-12-13-140215_all_tables/up.sql create mode 100644 backend/rustfmt.toml create mode 100644 backend/src/bin/server.rs create mode 100644 backend/src/handlers/cart_items.rs create mode 100644 backend/src/handlers/mod.rs create mode 100644 backend/src/handlers/product.rs create mode 100644 backend/src/handlers/rating.rs create mode 100644 backend/src/handlers/smoke.rs create mode 100644 backend/src/handlers/users.rs create mode 100644 backend/src/lib.rs create mode 100644 backend/src/models.rs create mode 100644 backend/src/schema.rs create mode 100644 backend/tests/product/chair.json create mode 100644 backend/tests/product/dumb_sofa.json create mode 100644 backend/tests/product/smart_sofa.json create mode 100644 backend/tests/requests.txt create mode 100644 backend/tests/users/add_akshay.json create mode 100644 backend/tests/users/add_user.json delete mode 100644 default.nix delete mode 100644 diesel.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 120000 frontend/.direnv/flake-profile create mode 100644 frontend/.direnv/flake-profile.rc create mode 100644 frontend/elm-stuff/0.19.1/Cart.elmi create mode 100644 frontend/elm-stuff/0.19.1/Cart.elmo create mode 100644 frontend/elm-stuff/0.19.1/Catalog.elmi create mode 100644 frontend/elm-stuff/0.19.1/Catalog.elmo create mode 100644 frontend/elm-stuff/0.19.1/Login.elmi create mode 100644 frontend/elm-stuff/0.19.1/Login.elmo create mode 100644 frontend/elm-stuff/0.19.1/Main.elmi create mode 100644 frontend/elm-stuff/0.19.1/Main.elmo create mode 100644 frontend/elm-stuff/0.19.1/Product.elmi create mode 100644 frontend/elm-stuff/0.19.1/Product.elmo create mode 100644 frontend/elm-stuff/0.19.1/Signup.elmi create mode 100644 frontend/elm-stuff/0.19.1/Signup.elmo create mode 100644 frontend/elm-stuff/0.19.1/d.dat create mode 100644 frontend/elm-stuff/0.19.1/i.dat create mode 100644 frontend/elm-stuff/0.19.1/lock create mode 100644 frontend/elm-stuff/0.19.1/o.dat create mode 100644 frontend/elm.json create mode 100644 frontend/src/Cart.elm create mode 100644 frontend/src/Catalog.elm create mode 100644 frontend/src/Login.elm create mode 100644 frontend/src/Main.elm create mode 100644 frontend/src/Product.elm create mode 100644 frontend/src/Signup.elm delete mode 100644 migrations/.gitkeep delete mode 100644 migrations/2020-09-22-104623_create_users/down.sql delete mode 100644 migrations/2020-09-22-104623_create_users/up.sql delete mode 100644 migrations/2020-11-16-133516_create_products_table/down.sql delete mode 100644 migrations/2020-11-16-133516_create_products_table/up.sql delete mode 100644 migrations/2020-12-13-140215_all_tables/down.sql delete mode 100644 migrations/2020-12-13-140215_all_tables/up.sql delete mode 100644 nix/sources.json delete mode 100644 nix/sources.nix delete mode 100644 rustfmt.toml delete mode 100644 shell.nix delete mode 100644 src/bin/server.rs delete mode 100644 src/handlers/cart_items.rs delete mode 100644 src/handlers/mod.rs delete mode 100644 src/handlers/product.rs delete mode 100644 src/handlers/rating.rs delete mode 100644 src/handlers/smoke.rs delete mode 100644 src/handlers/users.rs delete mode 100644 src/lib.rs delete mode 100644 src/models.rs delete mode 100644 src/schema.rs delete mode 100644 tests/product/chair.json delete mode 100644 tests/product/dumb_sofa.json delete mode 100644 tests/product/smart_sofa.json delete mode 100644 tests/requests.txt delete mode 100644 tests/users/add_akshay.json delete mode 100644 tests/users/add_user.json diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..0daa2d1 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +/nix/store/5fywra260fcw272j6vwwvq7lzy609srb-furby-env \ No newline at end of file diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc new file mode 100644 index 0000000..dc6ae31 --- /dev/null +++ b/.direnv/flake-profile.rc @@ -0,0 +1,1506 @@ +unset shellHook +nix_saved_PATH="$PATH" +AR=ar +export AR +AS=as +export AS +BASH=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +CC=gcc +export CC +CONFIG_SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export CONFIG_SHELL +CXX=g++ +export CXX +DETERMINISTIC_BUILD=1 +export DETERMINISTIC_BUILD +DIRSTACK=() +GROUPS=() +HOSTTYPE=x86_64 +HOST_PATH=/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0/bin:/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/bin:/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2/bin:/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin/bin:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/bin:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/bin:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/bin:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/bin:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/bin:/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin/bin:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/bin:/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/bin:/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin/bin:/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0/bin:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/bin:/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin +export HOST_PATH +IFS=$' \t\n' +IN_NIX_SHELL=impure +export IN_NIX_SHELL +LD=ld +export LD +MACHTYPE=x86_64-unknown-linux-gnu +NIX_BINTOOLS=/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1 +export NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 +export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_BUILD_CORES=8 +export NIX_BUILD_CORES +NIX_CC=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 +export NIX_CC +NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 +export NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_CFLAGS_COMPILE=' -isystem /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/include -isystem /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/include -isystem /nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/include -isystem /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/include -isystem /nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/include -isystem /nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/include -isystem /nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/include -isystem /nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/include -isystem /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/include -isystem /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev/include -isystem /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/include -isystem /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/include -isystem /nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/include -isystem /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/include -isystem /nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/include -isystem /nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/include -isystem /nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/include -isystem /nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/include -isystem /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/include -isystem /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev/include' +export NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE=1 +export NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow' +export NIX_HARDENING_ENABLE +NIX_INDENT_MAKE=1 +export NIX_INDENT_MAKE +NIX_LDFLAGS='-rpath /home/np/code/rust/furby/outputs/out/lib64 -rpath /home/np/code/rust/furby/outputs/out/lib -L/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/lib -L/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g/lib -L/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/lib -L/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0/lib -L/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0/lib -L/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib/lib -L/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/lib -L/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g/lib -L/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib -L/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3/lib -L/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib/lib -L/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11/lib -L/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/lib -L/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0/lib -L/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0/lib -L/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib/lib' +export NIX_LDFLAGS +NIX_LIB64_IN_SELF_RPATH=1 +NIX_NO_SELF_RPATH=1 +NIX_STORE=/nix/store +export NIX_STORE +NM=nm +export NM +OBJCOPY=objcopy +export OBJCOPY +OBJDUMP=objdump +export OBJDUMP +OPTERR=1 +OPTIND=1 +OSTYPE=linux-gnu +PATH=/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9/bin:/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0/bin:/nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1/bin:/nix/store/hrkc2sf2883l16d5yq3zg0y339kfw4xv-binutils-2.31.1/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0/bin:/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84/bin:/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2/bin:/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin/bin:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/bin:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/bin:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/bin:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/bin:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/bin:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/bin:/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin/bin:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/bin:/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17/bin:/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin/bin:/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0/bin:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/bin:/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin +export PATH +PIPESTATUS=([0]="0") +PKG_CONFIG_PATH=/nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev/lib/pkgconfig:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/pkgconfig:/nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev/lib/pkgconfig:/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev/lib/pkgconfig:/nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev/lib/pkgconfig:/nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev/lib/pkgconfig:/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev/lib/pkgconfig:/nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev/lib/pkgconfig:/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5/lib/pkgconfig +export PKG_CONFIG_PATH +PS4='+ ' +PYTHONHASHSEED=0 +export PYTHONHASHSEED +PYTHONNOUSERSITE=1 +export PYTHONNOUSERSITE +PYTHONPATH=/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages:/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0/lib/python3.7/site-packages +export PYTHONPATH +RANLIB=ranlib +export RANLIB +READELF=readelf +export READELF +SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export SHELL +SIZE=size +export SIZE +SOURCE_DATE_EPOCH=1 +export SOURCE_DATE_EPOCH +STRINGS=strings +export STRINGS +STRIP=strip +export STRIP +_=export +buildInputs='/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1 /nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3 /nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3 /nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1 /nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2 /nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0 /nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84 /nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2 /nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev /nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0 /nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev /nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0 /nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5 /nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev /nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6' +export buildInputs +builder=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export builder +commonStripFlags=--enable-deterministic-archives +configureFlags= +export configureFlags +defaultBuildInputs= +defaultNativeBuildInputs='/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9 /nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh /nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh /nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh /nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0' +depsBuildBuild= +export depsBuildBuild +depsBuildBuildPropagated= +export depsBuildBuildPropagated +depsBuildTarget= +export depsBuildTarget +depsBuildTargetPropagated= +export depsBuildTargetPropagated +depsHostHost= +export depsHostHost +depsHostHostPropagated= +export depsHostHostPropagated +depsTargetTarget= +export depsTargetTarget +depsTargetTargetPropagated= +export depsTargetTargetPropagated +doCheck= +export doCheck +doInstallCheck= +export doInstallCheck +dontAddDisableDepTrack=1 +export dontAddDisableDepTrack +envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="addPythonPath" [3]="addPythonPath") +envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="addPythonPath" [3]="addPythonPath") +envTargetTargetHooks=([0]="addPkgConfigPath") +fixupOutputHooks=([0]="if [ -z \"\${dontPatchELF-}\" ]; then patchELF \"\$prefix\"; fi" [1]="_makeSymlinksRelative" [2]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [3]="_doStrip" [4]="patchShebangsAuto" [5]="_pruneLibtoolFiles" [6]="if [[ -z \"\${noAuditTmpdir-}\" && -e \"\$prefix\" ]]; then auditTmpdir \"\$prefix\"; fi" [7]="_moveSbin" [8]="_moveLib64") +initialPath='/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31 /nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0 /nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7 /nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8 /nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4 /nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1 /nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32 /nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10 /nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin /nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1 /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23 /nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6 /nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin' +name=furby +export name +nativeBuildInputs= +export nativeBuildInputs +out=/home/np/code/rust/furby/outputs/out +export out +outputBin=out +outputDev=out +outputDevdoc=REMOVE +outputDevman=out +outputDoc=out +outputInclude=out +outputInfo=out +outputLib=out +outputMan=out +outputs=out +export outputs +patches= +export patches +pkg=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 +pkgsBuildHost=([0]="/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9" [1]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [2]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [3]="/nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh" [4]="/nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh" [5]="/nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh" [6]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [7]="/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh" [8]="/nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh" [9]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [10]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [11]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [12]="/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0" [13]="/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1") +pkgsHostTarget=([0]="/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1" [1]="/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3" [2]="/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3" [3]="/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1" [4]="/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2" [5]="/nix/store/p60x886haaibkxg99mkaby1hyc9dal7w-cargo-1.41.0" [6]="/nix/store/zgqj5vbrw9lq6dyczd5ixrvq8hcbrn6r-rust-1.50.0-nightly-2020-12-22-bb1fbbf84" [7]="/nix/store/6dacwd7ldb2jazc218d11v2w2g55hba8-pkg-config-0.29.2" [8]="/nix/store/jzfmcy71n7msc1jq9bixg7hw8dghl94b-openssl-1.1.1g-dev" [9]="/nix/store/cfkappcqwnk1kmnnqqwxrg73fjdsa2am-openssl-1.1.1g-bin" [10]="/nix/store/0x3bf23q5lmdq77x5icr7c0ngvz25ms3-openssl-1.1.1g" [11]="/nix/store/397rckak3lmv21878y58r6iyjmiwsq9a-httpie-2.0.0" [12]="/nix/store/wh1jpkqaj1jina7cbnl8vb3mfly5yllg-python3.7-Pygments-2.5.2" [13]="/nix/store/hdi0fgnjp73hcw03fjxqjxmdx0f0792x-python3.7-docutils-0.16" [14]="/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6" [15]="/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6" [16]="/nix/store/a6xvh7znlpdipwyncxz44sprfbvg15fa-python3.7-requests-2.22.0" [17]="/nix/store/7jlkn8dz8gsv3h18sr772x3v9n9ac10i-python3.7-urllib3-1.25.8" [18]="/nix/store/qyp3bcn7qq5lryqimd1ddlbbmd6r57zr-python3.7-pyOpenSSL-19.1.0-dev" [19]="/nix/store/pb90x5cn1znp2hpb8jdgnlamv9qwg7za-python3.7-cryptography-2.8-dev" [20]="/nix/store/0bngdpmsypycaqcgs4jwxvnpzvgw68sn-python3.7-packaging-20.1" [21]="/nix/store/4cv3k9hb741kq5f161pvzlfmnx0198sx-python3.7-pyparsing-2.4.6" [22]="/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0" [23]="/nix/store/qcg29y1va5hsk882sh68w683zgm7ma00-python3.7-six-1.14.0" [24]="/nix/store/awck465fagj1rl9xgvfg9dnclw8i4w04-python3.7-cffi-1.13.2-dev" [25]="/nix/store/jkdfz5x727qwbsc121xd95j01kx8c6v5-libffi-3.3-dev" [26]="/nix/store/j2fdy70n25zaws892dc95yhj0gfhdxg6-libffi-3.3" [27]="/nix/store/j35bi1s8azhbvcmalmmjfaxp1w1y3k6y-python3.7-pycparser-2.19" [28]="/nix/store/8wz0jhcc13q3j5cx54fkg0n95s4srr8q-python3.7-cffi-1.13.2" [29]="/nix/store/j120qpj9y4hnhch85mxy20hjzc4nfi33-python3.7-cryptography-2.8" [30]="/nix/store/faga777zw6vbvm3n63c7kyvwzzlvpikn-python3.7-pyasn1-0.4.8" [31]="/nix/store/py5py6kkf8yc3284i6v1zh1lraym2nr4-python3.7-idna-2.8" [32]="/nix/store/2qjbjrhx2lqh8jj2r5f40b46y54ic0zk-python3.7-pyOpenSSL-19.1.0" [33]="/nix/store/wmy1bka21pkcvfj24rdp883yvf12fkhs-python3.7-certifi-2019.11.28" [34]="/nix/store/zalgg8wkgnsda8l88n64wzdpmgrf5sd1-python3.7-pysocks-1.7.1" [35]="/nix/store/8dmmabfb8g3xcpsacnh4ipflkmai2465-python3.7-chardet-3.0.4" [36]="/nix/store/lhc4xx6amd80ynbhz0a0xfz5s16dq98c-python3.7-setuptools-44.0.0" [37]="/nix/store/1x1xwd4dlp6p2ddh40qnxiv22mmc8pa2-curl-7.70.0-dev" [38]="/nix/store/12xzgyza4hb47vk9gw61z90spr6712lm-nghttp2-1.40.0-dev" [39]="/nix/store/k9f38hll2169jqqj72g7wx16nxavpw04-nghttp2-1.40.0-bin" [40]="/nix/store/qkpfyg67ff3c0wjsy68a61rx01f1cc31-nghttp2-1.40.0-lib" [41]="/nix/store/fkbpg2lx585gr28fmcs610zk88jl9bd7-zlib-1.2.11-dev" [42]="/nix/store/msp4hm62a75pdidlc3s2ymma2g5hsjjk-zlib-1.2.11" [43]="/nix/store/gnqgyxda6la4gw6hjh4gpmmlcnjbqn2a-libkrb5-1.17-dev" [44]="/nix/store/bxjyac4385pw8cwrlgm7d18bmmndf4p5-libkrb5-1.17" [45]="/nix/store/6wqaybiqw6hcrlxwf9jrnjlci7kq0h6i-libssh2-1.9.0-dev" [46]="/nix/store/fnn6zvyds5sy7mgvl4h2qslmlsaf0dc8-libssh2-1.9.0" [47]="/nix/store/6vv8yimyaa41iwhwki9y79z8xrl9zwca-curl-7.70.0-bin" [48]="/nix/store/bcqgqdzmhd9smr51snjcy2q2cbrwy47j-curl-7.70.0" [49]="/nix/store/cb0msm7sk8032nm850rnv4b23j50bbmx-diesel-cli-1.4.0" [50]="/nix/store/3kbd6k80dqs6v01agxi0f2bgsq16hi13-mariadb-connector-c-3.1.5" [51]="/nix/store/88lhpbmlgpan34a8j5kgzb07sc0zlb5y-jq-1.6-dev" [52]="/nix/store/pdg3mr2vsm7g8sh0q3ysac9dw0pl3c1i-jq-1.6-bin" [53]="/nix/store/7cj4dviicvhga78l899arar4q5kggbc5-jq-1.6-lib") +postFixupHooks=([0]="_multioutPropagateDev") +postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot") +preConfigureHooks=([0]="_multioutConfig") +preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs") +prefix=/home/np/code/rust/furby/outputs/out +propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps") +propagatedBuildInputs= +export propagatedBuildInputs +propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs") +propagatedNativeBuildInputs= +export propagatedNativeBuildInputs +propagatedTargetDepFiles=([0]="propagated-target-target-deps") +shell=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export shell +src=./. +export src +stdenv=/nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux +export stdenv +strictDeps= +export strictDeps +system=x86_64-linux +export system +unpackCmdHooks=([0]="_defaultUnpack") +PATH="$PATH:$nix_saved_PATH" +_activatePkgs () +{ + local -i hostOffset targetOffset; + local pkg; + for hostOffset in "${allPlatOffsets[@]}"; + do + local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}"; + for targetOffset in "${allPlatOffsets[@]}"; + do + (( "$hostOffset" <= "$targetOffset" )) || continue; + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + activatePackage "$pkg" "$hostOffset" "$targetOffset"; + done; + done; + done +} +_addRpathPrefix () +{ + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; + if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then + export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}"; + fi; + if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then + export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}"; + fi; + fi +} +_addToEnv () +{ + local -i depHostOffset depTargetOffset; + local pkg; + for depHostOffset in "${allPlatOffsets[@]}"; + do + local hookVar="${pkgHookVarVars[$depHostOffset + 1]}"; + local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}"; + for depTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$depHostOffset" <= "$depTargetOffset" )) || continue; + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; + if [[ -z "${strictDeps-}" ]]; then + local visitedPkgs=""; + for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}; + do + if [[ "$visitedPkgs" = *"$pkg"* ]]; then + continue; + fi; + runHook "${!hookRef}" "$pkg"; + visitedPkgs+=" $pkg"; + done; + else + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + runHook "${!hookRef}" "$pkg"; + done; + fi; + done; + done +} +_allFlags () +{ + for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); + do + if (( "${NIX_DEBUG:-0}" >= 1 )); then + printf "@%s@ -> %q\n" "${varName}" "${!varName}"; + fi; + args+=("--subst-var" "$varName"); + done +} +_assignFirst () +{ + local varName="$1"; + local REMOVE=REMOVE; + shift; + while (( $# )); do + if [ -n "${!1-}" ]; then + eval "${varName}"="$1"; + return; + fi; + shift; + done; + echo "Error: _assignFirst found no valid variant!"; + return 1 +} +_callImplicitHook () +{ + local def="$1"; + local hookName="$2"; + if declare -F "$hookName" > /dev/null; then + "$hookName"; + else + if type -p "$hookName" > /dev/null; then + source "$hookName"; + else + if [ -n "${!hookName:-}" ]; then + eval "${!hookName}"; + else + return "$def"; + fi; + fi; + fi +} +_defaultUnpack () +{ + local fn="$1"; + if [ -d "$fn" ]; then + cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"; + else + case "$fn" in + *.tar.xz | *.tar.lzma | *.txz) + xz -d < "$fn" | tar xf - + ;; + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) + tar xf "$fn" + ;; + *) + return 1 + ;; + esac; + fi +} +_doStrip () +{ + local -ra flags=(dontStripHost dontStripTarget); + local -ra stripCmds=(STRIP TARGET_STRIP); + if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then + dontStripTarget+=1; + fi; + local i; + for i in ${!stripCmds[@]}; + do + local -n flag="${flags[$i]}"; + local -n stripCmd="${stripCmds[$i]}"; + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then + continue; + fi; + stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}; + if [ -n "$stripDebugList" ]; then + stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"; + fi; + stripAllList=${stripAllList:-}; + if [ -n "$stripAllList" ]; then + stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"; + fi; + done +} +_eval () +{ + if declare -F "$1" > /dev/null 2>&1; then + "$@"; + else + eval "$1"; + fi +} +_makeSymlinksRelative () +{ + local symlinkTarget; + if [ -n "${dontRewriteSymlinks-}" ]; then + return 0; + fi; + while IFS= read -r -d '' f; do + symlinkTarget=$(readlink "$f"); + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then + continue; + fi; + if [ ! -e "$symlinkTarget" ]; then + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; + fi; + echo "rewriting symlink $f to be relative to $prefix"; + ln -snrf "$symlinkTarget" "$f"; + done < <(find $prefix -type l -print0) +} +_moveLib64 () +{ + if [ "${dontMoveLib64-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then + return; + fi; + echo "moving $prefix/lib64/* to $prefix/lib"; + mkdir -p $prefix/lib; + shopt -s dotglob; + for i in $prefix/lib64/*; + do + mv --no-clobber "$i" $prefix/lib; + done; + shopt -u dotglob; + rmdir $prefix/lib64; + ln -s lib $prefix/lib64 +} +_moveSbin () +{ + if [ "${dontMoveSbin-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then + return; + fi; + echo "moving $prefix/sbin/* to $prefix/bin"; + mkdir -p $prefix/bin; + shopt -s dotglob; + for i in $prefix/sbin/*; + do + mv "$i" $prefix/bin; + done; + shopt -u dotglob; + rmdir $prefix/sbin; + ln -s bin $prefix/sbin +} +_moveToShare () +{ + forceShare=${forceShare:=man doc info}; + if [ -z "$forceShare" -o -z "$out" ]; then + return; + fi; + for d in $forceShare; + do + if [ -d "$out/$d" ]; then + if [ -d "$out/share/$d" ]; then + echo "both $d/ and share/$d/ exist!"; + else + echo "moving $out/$d to $out/share/$d"; + mkdir -p $out/share; + mv $out/$d $out/share/; + fi; + fi; + done +} +_multioutConfig () +{ + if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then + return; + fi; + if [ -z "$shareDocName" ]; then + local confScript="$configureScript"; + if [ -z "$confScript" ] && [ -x ./configure ]; then + confScript=./configure; + fi; + if [ -f "$confScript" ]; then + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; + fi; + if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; + fi; + fi; + configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info --docdir=${!outputDoc}/share/doc/${shareDocName} --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec --localedir=${!outputLib}/share/locale $configureFlags"; + installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags" +} +_multioutDevs () +{ + if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then + return; + fi; + moveToOutput include "${!outputInclude}"; + moveToOutput lib/pkgconfig "${!outputDev}"; + moveToOutput share/pkgconfig "${!outputDev}"; + moveToOutput lib/cmake "${!outputDev}"; + moveToOutput share/aclocal "${!outputDev}"; + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; + do + echo "Patching '$f' includedir to output ${!outputInclude}"; + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; + done +} +_multioutDocs () +{ + local REMOVE=REMOVE; + moveToOutput share/info "${!outputInfo}"; + moveToOutput share/doc "${!outputDoc}"; + moveToOutput share/gtk-doc "${!outputDevdoc}"; + moveToOutput share/devhelp/books "${!outputDevdoc}"; + moveToOutput share/man "${!outputMan}"; + moveToOutput share/man/man3 "${!outputDevman}" +} +_multioutPropagateDev () +{ + if [ "$outputs" = "out" ]; then + return; + fi; + local outputFirst; + for outputFirst in $outputs; + do + break; + done; + local propagaterOutput="$outputDev"; + if [ -z "$propagaterOutput" ]; then + propagaterOutput="$outputFirst"; + fi; + if [ -z "${propagatedBuildOutputs+1}" ]; then + local po_dirty="$outputBin $outputInclude $outputLib"; + set +o pipefail; + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; + set -o pipefail; + fi; + if [ -z "$propagatedBuildOutputs" ]; then + return; + fi; + mkdir -p "${!propagaterOutput}"/nix-support; + for output in $propagatedBuildOutputs; + do + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; + done +} +_overrideFirst () +{ + if [ -z "${!1-}" ]; then + _assignFirst "$@"; + fi +} +_pruneLibtoolFiles () +{ + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; +} +_updateSourceDateEpochFromSourceRoot () +{ + if [ -n "$sourceRoot" ]; then + updateSourceDateEpoch "$sourceRoot"; + fi +} +activatePackage () +{ + local pkg="$1"; + local -ri hostOffset="$2"; + local -ri targetOffset="$3"; + (( "$hostOffset" <= "$targetOffset" )) || exit -1; + if [ -f "$pkg" ]; then + source "$pkg"; + fi; + if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then + addToSearchPath _PATH "$pkg/bin"; + fi; + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then + addToSearchPath _HOST_PATH "$pkg/bin"; + fi; + if [[ -f "$pkg/nix-support/setup-hook" ]]; then + source "$pkg/nix-support/setup-hook"; + fi +} +addEnvHooks () +{ + local depHostOffset="$1"; + shift; + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; + local pkgHookVar; + for pkgHookVar in "${!pkgHookVarsSlice}"; + do + eval "${pkgHookVar}s"'+=("$@")'; + done +} +addPkgConfigPath () +{ + addToSearchPath PKG_CONFIG_PATH $1/lib/pkgconfig; + addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig +} +addPythonPath () +{ + addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.7/site-packages +} +addToSearchPath () +{ + addToSearchPathWithCustomDelimiter ":" "$@" +} +addToSearchPathWithCustomDelimiter () +{ + local delimiter="$1"; + local varName="$2"; + local dir="$3"; + if [ -d "$dir" ]; then + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; + fi +} +auditTmpdir () +{ + local dir="$1"; + [ -e "$dir" ] || return 0; + header "checking for references to $TMPDIR/ in $dir..."; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if isELF "$i"; then + if { + printf :; + patchelf --print-rpath "$i" + } | grep -q -F ":$TMPDIR/"; then + echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + if isScript "$i"; then + if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then + if grep -q -F "$TMPDIR/" "$i"; then + echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + fi; + done < <(find "$dir" -type f -print0); + stopNest +} +bintoolsWrapper_addLDVars () +{ + local role_post role_pre; + getHostRoleEnvHook; + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_${role_pre}LDFLAGS+=" -L$1/lib64"; + fi; + if [[ -d "$1/lib" ]]; then + local -a glob=($1/lib/lib*); + if [ "${#glob[*]}" -gt 0 ]; then + export NIX_${role_pre}LDFLAGS+=" -L$1/lib"; + fi; + fi +} +buildPhase () +{ + runHook preBuild; + : ${makeFlags=}; + if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile, doing nothing"; + else + foundMakefile=1; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}); + echoCmd 'build flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postBuild +} +ccWrapper_addCVars () +{ + local role_post role_pre; + getHostRoleEnvHook; + if [ -d "$1/include" ]; then + export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include"; + fi; + if [ -d "$1/Library/Frameworks" ]; then + export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks"; + fi +} +checkPhase () +{ + runHook preCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + runHook postCheck; + return; + fi; + if [[ -z "${checkTarget:-}" ]]; then + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then + checkTarget=check; + else + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then + checkTarget=test; + fi; + fi; + fi; + if [[ -z "${checkTarget:-}" ]]; then + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget}); + echoCmd 'check flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postCheck +} +closeNest () +{ + true +} +compressManPages () +{ + local dir="$1"; + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then + return; + fi; + echo "gzipping man pages under $dir/share/man/"; + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do + if gzip -c -n "$f" > "$f".gz; then + rm "$f"; + else + rm "$f".gz; + fi; + done; + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do + local target; + target="$(readlink -f "$f")"; + if [ -f "$target".gz ]; then + ln -sf "$target".gz "$f".gz && rm "$f"; + fi; + done +} +configurePhase () +{ + runHook preConfigure; + : ${configureScript=}; + : ${configureFlags=}; + if [[ -z "$configureScript" && -x ./configure ]]; then + configureScript=./configure; + fi; + if [ -z "${dontFixLibtool:-}" ]; then + local i; + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do + echo "fixing libtool script $i"; + fixLibtool "$i"; + done; + fi; + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then + configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"; + fi; + if [ -z "${dontAddDisableDepTrack:-}" ]; then + if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then + configureFlags="--disable-dependency-tracking $configureFlags"; + fi; + fi; + if [ -z "${dontDisableStatic:-}" ]; then + if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then + configureFlags="--disable-static $configureFlags"; + fi; + fi; + if [ -n "$configureScript" ]; then + local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"}); + echoCmd 'configure flags' "${flagsArray[@]}"; + $configureScript "${flagsArray[@]}"; + unset flagsArray; + else + echo "no configure script, doing nothing"; + fi; + runHook postConfigure +} +consumeEntire () +{ + if IFS='' read -r -N 0 $1; then + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; + return 1; + fi +} +distPhase () +{ + runHook preDist; + local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}); + echo 'dist flags: %q' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + if [ "${dontCopyDist:-0}" != 1 ]; then + mkdir -p "$out/tarballs"; + cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"; + fi; + runHook postDist +} +dumpVars () +{ + if [ "${noDumpEnvVars:-0}" != 1 ]; then + export > "$NIX_BUILD_TOP/env-vars" || true; + fi +} +echoCmd () +{ + printf "%s:" "$1"; + shift; + printf ' %q' "$@"; + echo +} +exitHandler () +{ + exitCode="$?"; + set +e; + if [ -n "${showBuildStats:-}" ]; then + times > "$NIX_BUILD_TOP/.times"; + local -a times=($(cat "$NIX_BUILD_TOP/.times")); + echo "build time elapsed: " "${times[@]}"; + fi; + if (( "$exitCode" != 0 )); then + runHook failureHook; + if [ -n "${succeedOnFailure:-}" ]; then + echo "build failed with exit code $exitCode (ignored)"; + mkdir -p "$out/nix-support"; + printf "%s" "$exitCode" > "$out/nix-support/failed"; + exit 0; + fi; + else + runHook exitHook; + fi; + exit "$exitCode" +} +findInputs () +{ + local -r pkg="$1"; + local -ri hostOffset="$2"; + local -ri targetOffset="$3"; + (( "$hostOffset" <= "$targetOffset" )) || exit -1; + local varVar="${pkgAccumVarVars[$hostOffset + 1]}"; + local varRef="$varVar[\$targetOffset - \$hostOffset]"; + local var="${!varRef}"; + unset -v varVar varRef; + local varSlice="$var[*]"; + case "${!varSlice-}" in + *" $pkg "*) + return 0 + ;; + esac; + unset -v varSlice; + eval "$var"'+=("$pkg")'; + if ! [ -e "$pkg" ]; then + echo "build input $pkg does not exist" 1>&2; + exit 1; + fi; + local -i mapOffsetResult; + function mapOffset () + { + local -ri inputOffset="$1"; + if (( "$inputOffset" <= 0 )); then + local -ri outputOffset="$inputOffset + $hostOffset"; + else + local -ri outputOffset="$inputOffset - 1 + $targetOffset"; + fi; + mapOffsetResult="$outputOffset" + }; + local -i relHostOffset; + for relHostOffset in "${allPlatOffsets[@]}"; + do + local files="${propagatedDepFilesVars[$relHostOffset + 1]}"; + mapOffset relHostOffset; + local -i hostOffsetNext="$mapOffsetResult"; + [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue; + local -i relTargetOffset; + for relTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; + local file="${!fileRef}"; + unset -v fileRef; + mapOffset relTargetOffset; + local -i targetOffsetNext="$mapOffsetResult"; + [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue; + [[ -f "$pkg/nix-support/$file" ]] || continue; + local pkgNext; + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; + for pkgNext in $pkgNext; + do + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; + done; + done; + done +} +fixLibtool () +{ + sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1" +} +fixupPhase () +{ + local output; + for output in $outputs; + do + if [ -e "${!output}" ]; then + chmod -R u+w "${!output}"; + fi; + done; + runHook preFixup; + local output; + for output in $outputs; + do + prefix="${!output}" runHook fixupOutput; + done; + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); + local propagatedInputsIndex; + for propagatedInputsIndex in "${!flatVars[@]}"; + do + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; + [[ -n "${!propagatedInputsSlice}" ]] || continue; + mkdir -p "${!outputDev}/nix-support"; + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; + done; + if [ -n "${setupHook:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; + fi; + if [ -n "${setupHooks:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + local hook; + for hook in $setupHooks; + do + local content; + consumeEntire content < "$hook"; + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; + unset -v content; + done; + unset -v hook; + fi; + if [ -n "${propagatedUserEnvPkgs:-}" ]; then + mkdir -p "${!outputBin}/nix-support"; + printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; + fi; + runHook postFixup +} +genericBuild () +{ + if [ -f "${buildCommandPath:-}" ]; then + source "$buildCommandPath"; + return; + fi; + if [ -n "${buildCommand:-}" ]; then + eval "$buildCommand"; + return; + fi; + if [ -z "${phases:-}" ]; then + phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}"; + fi; + for curPhase in $phases; + do + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then + continue; + fi; + if [[ -n $NIX_LOG_FD ]]; then + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD; + fi; + showPhaseHeader "$curPhase"; + dumpVars; + eval "${!curPhase:-$curPhase}"; + if [ "$curPhase" = unpackPhase ]; then + cd "${sourceRoot:-.}"; + fi; + done +} +getHostRole () +{ + getRole "$hostOffset" +} +getHostRoleEnvHook () +{ + getRole "$depHostOffset" +} +getRole () +{ + case $1 in + -1) + role_pre='BUILD_'; + role_post='_FOR_BUILD' + ;; + 0) + role_pre=''; + role_post='' + ;; + 1) + role_pre='TARGET_'; + role_post='_FOR_TARGET' + ;; + *) + echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; + return 1 + ;; + esac +} +getTargetRole () +{ + getRole "$targetOffset" +} +getTargetRoleEnvHook () +{ + getRole "$depTargetOffset" +} +getTargetRoleWrapper () +{ + case $targetOffset in + -1) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_BUILD=1 + ;; + 0) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 + ;; + 1) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_TARGET=1 + ;; + *) + echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; + return 1 + ;; + esac +} +header () +{ + echo "$1" +} +installCheckPhase () +{ + runHook preInstallCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + else + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck}); + echoCmd 'installcheck flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + fi; + runHook postInstallCheck +} +installPhase () +{ + runHook preInstall; + if [ -n "$prefix" ]; then + mkdir -p "$prefix"; + fi; + local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install}); + echoCmd 'install flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + runHook postInstall +} +isELF () +{ + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [ "$magic" = 'ELF' ]; then + return 0; + else + return 1; + fi +} +isScript () +{ + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 2 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" =~ \#! ]]; then + return 0; + else + return 1; + fi +} +mapOffset () +{ + local -ri inputOffset="$1"; + if (( "$inputOffset" <= 0 )); then + local -ri outputOffset="$inputOffset + $hostOffset"; + else + local -ri outputOffset="$inputOffset - 1 + $targetOffset"; + fi; + mapOffsetResult="$outputOffset" +} +moveToOutput () +{ + local patt="$1"; + local dstOut="$2"; + local output; + for output in $outputs; + do + if [ "${!output}" = "$dstOut" ]; then + continue; + fi; + local srcPath; + for srcPath in "${!output}"/$patt; + do + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then + continue; + fi; + if [ "$dstOut" = REMOVE ]; then + echo "Removing $srcPath"; + rm -r "$srcPath"; + else + local dstPath="$dstOut${srcPath#${!output}}"; + echo "Moving $srcPath to $dstPath"; + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then + rmdir "$srcPath" --ignore-fail-on-non-empty; + if [ -d "$srcPath" ]; then + mv -t "$dstPath" "$srcPath"/*; + rmdir "$srcPath"; + fi; + else + mkdir -p "$(readlink -m "$dstPath/..")"; + mv "$srcPath" "$dstPath"; + fi; + fi; + local srcParent="$(readlink -m "$srcPath/..")"; + if rmdir "$srcParent"; then + echo "Removing empty $srcParent/ and (possibly) its parents"; + rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true; + fi; + done; + done +} +patchELF () +{ + local dir="$1"; + [ -e "$dir" ] || return 0; + header "shrinking RPATHs of ELF executables and libraries in $dir"; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if ! isELF "$i"; then + continue; + fi; + echo "shrinking $i"; + patchelf --shrink-rpath "$i" || true; + done < <(find "$dir" -type f -print0); + stopNest +} +patchPhase () +{ + runHook prePatch; + for i in ${patches:-}; + do + header "applying patch $i" 3; + local uncompress=cat; + case "$i" in + *.gz) + uncompress="gzip -d" + ;; + *.bz2) + uncompress="bzip2 -d" + ;; + *.xz) + uncompress="xz -d" + ;; + *.lzma) + uncompress="lzma -d" + ;; + esac; + $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1}; + done; + runHook postPatch +} +patchShebangs () +{ + local pathName; + if [ "$1" = "--host" ]; then + pathName=HOST_PATH; + shift; + else + if [ "$1" = "--build" ]; then + pathName=PATH; + shift; + fi; + fi; + echo "patching script interpreter paths in $@"; + local f; + local oldPath; + local newPath; + local arg0; + local args; + local oldInterpreterLine; + local newInterpreterLine; + if [ $# -eq 0 ]; then + echo "No arguments supplied to patchShebangs" > 0; + return 0; + fi; + local f; + while IFS= read -r -d '' f; do + isScript "$f" || continue; + oldInterpreterLine=$(head -1 "$f" | tail -c+3); + read -r oldPath arg0 args <<< "$oldInterpreterLine"; + if [ -z "$pathName" ]; then + if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then + pathName=HOST_PATH; + else + pathName=PATH; + fi; + fi; + if $(echo "$oldPath" | grep -q "/bin/env$"); then + if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" > 0; + exit 1; + fi; + newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; + else + if [ "$oldPath" = "" ]; then + oldPath="/bin/sh"; + fi; + newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; + args="$arg0 $args"; + fi; + newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"; + if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then + if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; + escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g'); + timestamp=$(mktemp); + touch -r "$f" "$timestamp"; + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; + touch -r "$timestamp" "$f"; + rm "$timestamp"; + fi; + fi; + done < <(find "$@" -type f -perm -0100 -print0); + stopNest +} +patchShebangsAuto () +{ + if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then + if [ "$output" != out ] && [ "$output" = "$outputDev" ]; then + patchShebangs --build "$prefix"; + else + patchShebangs --host "$prefix"; + fi; + fi +} +printLines () +{ + (( "$#" > 0 )) || return 0; + printf '%s\n' "$@" +} +printWords () +{ + (( "$#" > 0 )) || return 0; + printf '%s ' "$@" +} +runHook () +{ + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook; + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _eval "$hook" "$@"; + done; + return 0 +} +runOneHook () +{ + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook ret=1; + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + if _eval "$hook" "$@"; then + ret=0; + break; + fi; + done; + return "$ret" +} +showPhaseHeader () +{ + local phase="$1"; + case "$phase" in + unpackPhase) + header "unpacking sources" + ;; + patchPhase) + header "patching sources" + ;; + configurePhase) + header "configuring" + ;; + buildPhase) + header "building" + ;; + checkPhase) + header "running tests" + ;; + installPhase) + header "installing" + ;; + fixupPhase) + header "post-installation fixup" + ;; + installCheckPhase) + header "running install tests" + ;; + *) + header "$phase" + ;; + esac +} +stopNest () +{ + true +} +stripDirs () +{ + local cmd="$1"; + local dirs="$2"; + local stripFlags="$3"; + local dirsNew=; + local d; + for d in ${dirs}; + do + if [ -d "$prefix/$d" ]; then + dirsNew="${dirsNew} $prefix/$d "; + fi; + done; + dirs=${dirsNew}; + if [ -n "${dirs}" ]; then + header "stripping (with command $cmd and flags $stripFlags) in$dirs"; + find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2> /dev/null || true; + stopNest; + fi +} +stripHash () +{ + local strippedName casematchOpt=0; + strippedName="$(basename -- "$1")"; + shopt -q nocasematch && casematchOpt=1; + shopt -u nocasematch; + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then + echo "${strippedName:33}"; + else + echo "$strippedName"; + fi; + if (( casematchOpt )); then + shopt -s nocasematch; + fi +} +substitute () +{ + local input="$1"; + local output="$2"; + shift 2; + if [ ! -f "$input" ]; then + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; + return 1; + fi; + local content; + consumeEntire content < "$input"; + if [ -e "$output" ]; then + chmod +w "$output"; + fi; + substituteStream content "file '$input'" "$@" > "$output" +} +substituteAll () +{ + local input="$1"; + local output="$2"; + local -a args=(); + _allFlags; + substitute "$input" "$output" "${args[@]}" +} +substituteAllInPlace () +{ + local fileName="$1"; + shift; + substituteAll "$fileName" "$fileName" "$@" +} +substituteAllStream () +{ + local -a args=(); + _allFlags; + substituteStream "$1" "$2" "${args[@]}" +} +substituteInPlace () +{ + local fileName="$1"; + shift; + substitute "$fileName" "$fileName" "$@" +} +substituteStream () +{ + local var=$1; + local description=$2; + shift 2; + while (( "$#" )); do + case "$1" in + --replace) + pattern="$2"; + replacement="$3"; + shift 3; + local savedvar; + savedvar="${!var}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + if [ "$pattern" != "$replacement" ]; then + if [ "${!var}" == "$savedvar" ]; then + echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2; + fi; + fi + ;; + --subst-var) + local varName="$2"; + shift 2; + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then + echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; + return 1; + fi; + if [ -z ${!varName+x} ]; then + echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; + return 1; + fi; + pattern="@$varName@"; + replacement="${!varName}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var-by) + pattern="@$2@"; + replacement="$3"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + shift 3 + ;; + *) + echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; + return 1 + ;; + esac; + done; + printf "%s" "${!var}" +} +toPythonPath () +{ + local paths="$1"; + local result=; + for i in $paths; + do + p="$i/lib/python3.7/site-packages"; + result="${result}${result:+:}$p"; + done; + echo $result +} +unpackFile () +{ + curSrc="$1"; + header "unpacking source archive $curSrc" 3; + if ! runOneHook unpackCmd "$curSrc"; then + echo "do not know how to unpack source archive $curSrc"; + exit 1; + fi +} +unpackPhase () +{ + runHook preUnpack; + if [ -z "${srcs:-}" ]; then + if [ -z "${src:-}" ]; then + echo 'variable $src or $srcs should point to the source'; + exit 1; + fi; + srcs="$src"; + fi; + local dirsBefore=""; + for i in *; + do + if [ -d "$i" ]; then + dirsBefore="$dirsBefore $i "; + fi; + done; + for i in $srcs; + do + unpackFile "$i"; + done; + : ${sourceRoot=}; + if [ -n "${setSourceRoot:-}" ]; then + runOneHook setSourceRoot; + else + if [ -z "$sourceRoot" ]; then + for i in *; + do + if [ -d "$i" ]; then + case $dirsBefore in + *\ $i\ *) + + ;; + *) + if [ -n "$sourceRoot" ]; then + echo "unpacker produced multiple directories"; + exit 1; + fi; + sourceRoot="$i" + ;; + esac; + fi; + done; + fi; + fi; + if [ -z "$sourceRoot" ]; then + echo "unpacker appears to have produced no directories"; + exit 1; + fi; + echo "source root is $sourceRoot"; + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then + chmod -R u+w -- "$sourceRoot"; + fi; + runHook postUnpack +} +updateSourceDateEpoch () +{ + local path="$1"; + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); + local time="${res[0]//\.[0-9]*/}"; + local newestFile="${res[1]}"; + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; + export SOURCE_DATE_EPOCH="$time"; + local now="$(date +%s)"; + if [ "$time" -gt $((now - 60)) ]; then + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; + fi; + fi +} + +export NIX_BUILD_TOP="$(mktemp -d --tmpdir nix-shell.XXXXXX)" +export TMP="$NIX_BUILD_TOP" +export TMPDIR="$NIX_BUILD_TOP" +export TEMP="$NIX_BUILD_TOP" +export TEMPDIR="$NIX_BUILD_TOP" +eval "$shellHook" diff --git a/.gitignore b/.gitignore index 2b728a5..f0d321e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/target +target/ .envrc result diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 2f6aaaa..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2241 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "actix-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" -dependencies = [ - "bitflags", - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project 0.4.23", - "tokio", - "tokio-util", -] - -[[package]] -name = "actix-connect" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures-util", - "http", - "log", - "trust-dns-proto", - "trust-dns-resolver", -] - -[[package]] -name = "actix-cors" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3a3d5493dbc9b8769fe88c030d057ef8d2edc5728e5e26267780e8fc5db0be" -dependencies = [ - "actix-web", - "derive_more", - "futures-util", - "log", - "once_cell", - "tinyvec 1.1.0", -] - -[[package]] -name = "actix-http" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05dd80ba8f27c4a34357c07e338c8f5c38f8520e6d626ca1727d8fecc41b0cab" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt", - "actix-service", - "actix-threadpool", - "actix-utils", - "base64", - "bitflags", - "brotli2", - "bytes", - "cookie", - "copyless", - "derive_more", - "either", - "encoding_rs", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2", - "http", - "httparse", - "indexmap", - "itoa", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding 2.1.0", - "pin-project 0.4.23", - "rand", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "sha-1", - "slab", - "time 0.2.21", -] - -[[package]] -name = "actix-identity" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3263fe74cf505c6f9e18209c89fbdba5569cfd3905a7e907b42aa1c85c18fae5" -dependencies = [ - "actix-service", - "actix-web", - "futures-util", - "serde", - "serde_json", - "time 0.2.21", -] - -[[package]] -name = "actix-macros" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd1f7dbda1645bf7da33554db60891755f6c01c1b2169e2f4c492098d30c235" -dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", -] - -[[package]] -name = "actix-rt" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" -dependencies = [ - "actix-macros", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec", - "tokio", -] - -[[package]] -name = "actix-server" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "futures-channel", - "futures-util", - "log", - "mio", - "mio-uds", - "num_cpus", - "slab", - "socket2", -] - -[[package]] -name = "actix-service" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" -dependencies = [ - "futures-util", - "pin-project 0.4.23", -] - -[[package]] -name = "actix-testing" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" -dependencies = [ - "actix-macros", - "actix-rt", - "actix-server", - "actix-service", - "log", - "socket2", -] - -[[package]] -name = "actix-threadpool" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" -dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot", - "threadpool", -] - -[[package]] -name = "actix-tls" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "futures-util", -] - -[[package]] -name = "actix-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "bitflags", - "bytes", - "either", - "futures-channel", - "futures-sink", - "futures-util", - "log", - "pin-project 0.4.23", - "slab", -] - -[[package]] -name = "actix-web" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36de80175eb1f0a5c518024ce0d23646b54a23008279e090ca1848f6f1448bf4" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes", - "derive_more", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "log", - "mime", - "pin-project 0.4.23", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "socket2", - "time 0.2.21", - "tinyvec 0.3.4", - "url 2.1.1", -] - -[[package]] -name = "actix-web-codegen" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "750ca8fb60bbdc79491991650ba5d2ae7cd75f3fc00ead51390cfe9efda0d4d8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "addr2line" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" -dependencies = [ - "aes-soft", - "aesni", - "block-cipher 0.7.1", -] - -[[package]] -name = "aes-gcm" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" -dependencies = [ - "aead", - "aes", - "block-cipher 0.7.1", - "ghash", - "subtle", -] - -[[package]] -name = "aes-soft" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" -dependencies = [ - "block-cipher 0.7.1", - "byteorder", - "opaque-debug 0.2.3", -] - -[[package]] -name = "aesni" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" -dependencies = [ - "block-cipher 0.7.1", - "opaque-debug 0.2.3", -] - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - -[[package]] -name = "async-trait" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "awc" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150e00c06683ab44c5f97d033950e5d87a7a042d06d77f5eecb443cbd23d0575" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "base64", - "bytes", - "derive_more", - "futures-core", - "log", - "mime", - "percent-encoding 2.1.0", - "rand", - "serde", - "serde_json", - "serde_urlencoded", -] - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base-x" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "bcrypt" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2cab630912253fb9dc92c0e2fabd0a7b51f5a5a4007177cfa31e517015b7204" -dependencies = [ - "base64", - "blowfish", - "byteorder", - "getrandom", -] - -[[package]] -name = "bigdecimal" -version = "0.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "679e21a6734fdfc63378aea80c2bf31e6ac8ced21ed33e1ee37f8f7bf33c2056" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "bigdecimal" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1374191e2dd25f9ae02e3aa95041ed5d747fc77b3c102b49fe2dd9a8117a6244" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-cipher" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blowfish" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f06850ba969bc59388b2cc0a4f186fc6d9d37208863b15b84ae3866ac90ac06" -dependencies = [ - "block-cipher 0.8.0", - "byteorder", - "opaque-debug 0.3.0", -] - -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -dependencies = [ - "brotli-sys", - "libc", -] - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "bytestring" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" -dependencies = [ - "bytes", -] - -[[package]] -name = "cc" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "serde", - "time 0.1.44", - "winapi 0.3.9", -] - -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[package]] -name = "const_fn" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" - -[[package]] -name = "cookie" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0" -dependencies = [ - "aes-gcm", - "base64", - "hkdf", - "hmac", - "percent-encoding 2.1.0", - "rand", - "sha2", - "time 0.2.21", - "version_check", -] - -[[package]] -name = "copyless" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "derive_more" -version = "0.99.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dcfabdab475c16a93d669dddfc393027803e347d09663f524447f642fbb84ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2de9deab977a153492a1468d1b1c0662c1cf39e5ea87d0c060ecd59ef18d8c" -dependencies = [ - "bigdecimal 0.1.2", - "byteorder", - "chrono", - "diesel_derives", - "mysqlclient-sys", - "num-bigint", - "num-integer", - "num-traits", - "r2d2", - "url 1.7.2", -] - -[[package]] -name = "diesel_derives" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "dtoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "encoding_rs" -version = "0.8.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-as-inner" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "flate2" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" -dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "furby" -version = "0.1.0" -dependencies = [ - "actix-cors", - "actix-identity", - "actix-web", - "bcrypt", - "bigdecimal 0.0.14", - "chrono", - "diesel", - "log", - "pretty_env_logger", - "rand", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "futures" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" - -[[package]] -name = "futures-io" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" - -[[package]] -name = "futures-macro" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" - -[[package]] -name = "futures-task" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" -dependencies = [ - "once_cell", -] - -[[package]] -name = "futures-util" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project 1.0.2", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "ghash" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" -dependencies = [ - "polyval", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - -[[package]] -name = "h2" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" -dependencies = [ - "libc", -] - -[[package]] -name = "hkdf" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe1149865383e4526a43aee8495f9a325f0b806c63ce6427d06336a590abbbc9" -dependencies = [ - "digest", - "hmac", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2", - "widestring", - "winapi 0.3.9", - "winreg", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" - -[[package]] -name = "linked-hash-map" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" - -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "miniz_oxide" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "mysqlclient-sys" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9637d93448044078aaafea7419aed69d301b4a12bcc4aa0ae856eb169bef85" -dependencies = [ - "pkg-config", - "vcpkg", -] - -[[package]] -name = "net2" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "once_cell" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if", - "cloudabi", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pin-project" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" -dependencies = [ - "pin-project-internal 0.4.23", -] - -[[package]] -name = "pin-project" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" -dependencies = [ - "pin-project-internal 1.0.2", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" - -[[package]] -name = "polyval" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" -dependencies = [ - "cfg-if", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" - -[[package]] -name = "pretty_env_logger" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" -dependencies = [ - "env_logger", - "log", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" - -[[package]] -name = "proc-macro2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "resolv-conf" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" -dependencies = [ - "hostname", - "quick-error", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" -dependencies = [ - "dtoa", - "itoa", - "serde", - "url 2.1.1", -] - -[[package]] -name = "sha-1" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" -dependencies = [ - "block-buffer", - "cfg-if", - "cpuid-bool", - "digest", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - -[[package]] -name = "sha2" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" -dependencies = [ - "block-buffer", - "cfg-if", - "cpuid-bool", - "digest", - "opaque-debug 0.3.0", -] - -[[package]] -name = "signal-hook-registry" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" -dependencies = [ - "arc-swap", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "smallvec" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" - -[[package]] -name = "socket2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.9", -] - -[[package]] -name = "standback" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a71ea1ea5f8747d1af1979bfb7e65c3a025a70609f04ceb78425bc5adad8e6" -dependencies = [ - "version_check", -] - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - -[[package]] -name = "subtle" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" - -[[package]] -name = "syn" -version = "1.0.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "termcolor" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - -[[package]] -name = "tinyvec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" - -[[package]] -name = "tinyvec" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" -dependencies = [ - "bytes", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-uds", - "pin-project-lite", - "signal-hook-registry", - "slab", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tracing" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" -dependencies = [ - "cfg-if", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "trust-dns-proto" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd7061ba6f4d4d9721afedffbfd403f20f39a4301fee1b70d6fcd09cca69f28" -dependencies = [ - "async-trait", - "backtrace", - "enum-as-inner", - "futures", - "idna 0.2.0", - "lazy_static", - "log", - "rand", - "smallvec", - "thiserror", - "tokio", - "url 2.1.1", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77" -dependencies = [ - "backtrace", - "cfg-if", - "futures", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "trust-dns-proto", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" -dependencies = [ - "tinyvec 0.3.4", -] - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "universal-hash" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - -[[package]] -name = "url" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" -dependencies = [ - "idna 0.2.0", - "matches", - "percent-encoding 2.1.0", -] - -[[package]] -name = "vcpkg" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasm-bindgen" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "widestring" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a763e303c0e0f23b0da40888724762e802a8ffefbc22de4127ef42493c2ea68c" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 8ce728b..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "furby" -version = "0.1.0" -authors = ["Akshay "] -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -actix-web = "3" -bcrypt = "0.8" -serde = "1.0" -serde_derive = "1.0" -serde_json = "1.0" -log = "0.4" -pretty_env_logger = "0.4" -actix-identity = "0.3.1" -actix-cors = "0.5" -bigdecimal = "0.0.14" -rand = "0.7" - -[dependencies.diesel] -version = "1.4.2" -features = ["mysql", "r2d2", "numeric", "chrono"] -default-features = false - -[dependencies.chrono] -version = "0.4" -features = ["serde"] diff --git a/backend/Cargo.lock b/backend/Cargo.lock new file mode 100644 index 0000000..2f6aaaa --- /dev/null +++ b/backend/Cargo.lock @@ -0,0 +1,2241 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "actix-codec" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project 0.4.23", + "tokio", + "tokio-util", +] + +[[package]] +name = "actix-connect" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "derive_more", + "either", + "futures-util", + "http", + "log", + "trust-dns-proto", + "trust-dns-resolver", +] + +[[package]] +name = "actix-cors" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3a3d5493dbc9b8769fe88c030d057ef8d2edc5728e5e26267780e8fc5db0be" +dependencies = [ + "actix-web", + "derive_more", + "futures-util", + "log", + "once_cell", + "tinyvec 1.1.0", +] + +[[package]] +name = "actix-http" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05dd80ba8f27c4a34357c07e338c8f5c38f8520e6d626ca1727d8fecc41b0cab" +dependencies = [ + "actix-codec", + "actix-connect", + "actix-rt", + "actix-service", + "actix-threadpool", + "actix-utils", + "base64", + "bitflags", + "brotli2", + "bytes", + "cookie", + "copyless", + "derive_more", + "either", + "encoding_rs", + "flate2", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "h2", + "http", + "httparse", + "indexmap", + "itoa", + "language-tags", + "lazy_static", + "log", + "mime", + "percent-encoding 2.1.0", + "pin-project 0.4.23", + "rand", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "sha-1", + "slab", + "time 0.2.21", +] + +[[package]] +name = "actix-identity" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3263fe74cf505c6f9e18209c89fbdba5569cfd3905a7e907b42aa1c85c18fae5" +dependencies = [ + "actix-service", + "actix-web", + "futures-util", + "serde", + "serde_json", + "time 0.2.21", +] + +[[package]] +name = "actix-macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-router" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd1f7dbda1645bf7da33554db60891755f6c01c1b2169e2f4c492098d30c235" +dependencies = [ + "bytestring", + "http", + "log", + "regex", + "serde", +] + +[[package]] +name = "actix-rt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" +dependencies = [ + "actix-macros", + "actix-threadpool", + "copyless", + "futures-channel", + "futures-util", + "smallvec", + "tokio", +] + +[[package]] +name = "actix-server" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "futures-channel", + "futures-util", + "log", + "mio", + "mio-uds", + "num_cpus", + "slab", + "socket2", +] + +[[package]] +name = "actix-service" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" +dependencies = [ + "futures-util", + "pin-project 0.4.23", +] + +[[package]] +name = "actix-testing" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" +dependencies = [ + "actix-macros", + "actix-rt", + "actix-server", + "actix-service", + "log", + "socket2", +] + +[[package]] +name = "actix-threadpool" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" +dependencies = [ + "derive_more", + "futures-channel", + "lazy_static", + "log", + "num_cpus", + "parking_lot", + "threadpool", +] + +[[package]] +name = "actix-tls" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" +dependencies = [ + "actix-codec", + "actix-service", + "actix-utils", + "futures-util", +] + +[[package]] +name = "actix-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "bitflags", + "bytes", + "either", + "futures-channel", + "futures-sink", + "futures-util", + "log", + "pin-project 0.4.23", + "slab", +] + +[[package]] +name = "actix-web" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36de80175eb1f0a5c518024ce0d23646b54a23008279e090ca1848f6f1448bf4" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-testing", + "actix-threadpool", + "actix-tls", + "actix-utils", + "actix-web-codegen", + "awc", + "bytes", + "derive_more", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "log", + "mime", + "pin-project 0.4.23", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "socket2", + "time 0.2.21", + "tinyvec 0.3.4", + "url 2.1.1", +] + +[[package]] +name = "actix-web-codegen" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "750ca8fb60bbdc79491991650ba5d2ae7cd75f3fc00ead51390cfe9efda0d4d8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "addr2line" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" +dependencies = [ + "aes-soft", + "aesni", + "block-cipher 0.7.1", +] + +[[package]] +name = "aes-gcm" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" +dependencies = [ + "aead", + "aes", + "block-cipher 0.7.1", + "ghash", + "subtle", +] + +[[package]] +name = "aes-soft" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" +dependencies = [ + "block-cipher 0.7.1", + "byteorder", + "opaque-debug 0.2.3", +] + +[[package]] +name = "aesni" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" +dependencies = [ + "block-cipher 0.7.1", + "opaque-debug 0.2.3", +] + +[[package]] +name = "aho-corasick" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +dependencies = [ + "memchr", +] + +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + +[[package]] +name = "async-trait" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "awc" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "150e00c06683ab44c5f97d033950e5d87a7a042d06d77f5eecb443cbd23d0575" +dependencies = [ + "actix-codec", + "actix-http", + "actix-rt", + "actix-service", + "base64", + "bytes", + "derive_more", + "futures-core", + "log", + "mime", + "percent-encoding 2.1.0", + "rand", + "serde", + "serde_json", + "serde_urlencoded", +] + +[[package]] +name = "backtrace" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base-x" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "bcrypt" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2cab630912253fb9dc92c0e2fabd0a7b51f5a5a4007177cfa31e517015b7204" +dependencies = [ + "base64", + "blowfish", + "byteorder", + "getrandom", +] + +[[package]] +name = "bigdecimal" +version = "0.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "679e21a6734fdfc63378aea80c2bf31e6ac8ced21ed33e1ee37f8f7bf33c2056" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bigdecimal" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1374191e2dd25f9ae02e3aa95041ed5d747fc77b3c102b49fe2dd9a8117a6244" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-cipher" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-cipher" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blowfish" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f06850ba969bc59388b2cc0a4f186fc6d9d37208863b15b84ae3866ac90ac06" +dependencies = [ + "block-cipher 0.8.0", + "byteorder", + "opaque-debug 0.3.0", +] + +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +dependencies = [ + "brotli-sys", + "libc", +] + +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + +[[package]] +name = "byteorder" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bytestring" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" +dependencies = [ + "bytes", +] + +[[package]] +name = "cc" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time 0.1.44", + "winapi 0.3.9", +] + +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + +[[package]] +name = "const_fn" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" + +[[package]] +name = "cookie" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0" +dependencies = [ + "aes-gcm", + "base64", + "hkdf", + "hmac", + "percent-encoding 2.1.0", + "rand", + "sha2", + "time 0.2.21", + "version_check", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "derive_more" +version = "0.99.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dcfabdab475c16a93d669dddfc393027803e347d09663f524447f642fbb84ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diesel" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2de9deab977a153492a1468d1b1c0662c1cf39e5ea87d0c060ecd59ef18d8c" +dependencies = [ + "bigdecimal 0.1.2", + "byteorder", + "chrono", + "diesel_derives", + "mysqlclient-sys", + "num-bigint", + "num-integer", + "num-traits", + "r2d2", + "url 1.7.2", +] + +[[package]] +name = "diesel_derives" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "dtoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "encoding_rs" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "flate2" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" +dependencies = [ + "cfg-if", + "crc32fast", + "libc", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "furby" +version = "0.1.0" +dependencies = [ + "actix-cors", + "actix-identity", + "actix-web", + "bcrypt", + "bigdecimal 0.0.14", + "chrono", + "diesel", + "log", + "pretty_env_logger", + "rand", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" + +[[package]] +name = "futures-io" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" + +[[package]] +name = "futures-macro" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" + +[[package]] +name = "futures-task" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project 1.0.2", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "ghash" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" +dependencies = [ + "polyval", +] + +[[package]] +name = "gimli" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" + +[[package]] +name = "h2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" +dependencies = [ + "libc", +] + +[[package]] +name = "hkdf" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe1149865383e4526a43aee8495f9a325f0b806c63ce6427d06336a590abbbc9" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2", + "widestring", + "winapi 0.3.9", + "winreg", +] + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" + +[[package]] +name = "linked-hash-map" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" + +[[package]] +name = "lock_api" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "miniz_oxide" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "mysqlclient-sys" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9637d93448044078aaafea7419aed69d301b4a12bcc4aa0ae856eb169bef85" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "net2" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" + +[[package]] +name = "once_cell" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if", + "cloudabi", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" +dependencies = [ + "pin-project-internal 0.4.23", +] + +[[package]] +name = "pin-project" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" +dependencies = [ + "pin-project-internal 1.0.2", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" + +[[package]] +name = "polyval" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" +dependencies = [ + "cfg-if", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" + +[[package]] +name = "pretty_env_logger" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +dependencies = [ + "env_logger", + "log", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r2d2" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" +dependencies = [ + "log", + "parking_lot", + "scheduled-thread-pool", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "regex" +version = "1.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" + +[[package]] +name = "resolv-conf" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" +dependencies = [ + "hostname", + "quick-error", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scheduled-thread-pool" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +dependencies = [ + "dtoa", + "itoa", + "serde", + "url 2.1.1", +] + +[[package]] +name = "sha-1" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +dependencies = [ + "block-buffer", + "cfg-if", + "cpuid-bool", + "digest", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sha2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer", + "cfg-if", + "cpuid-bool", + "digest", + "opaque-debug 0.3.0", +] + +[[package]] +name = "signal-hook-registry" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" +dependencies = [ + "arc-swap", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "smallvec" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" + +[[package]] +name = "socket2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.9", +] + +[[package]] +name = "standback" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a71ea1ea5f8747d1af1979bfb7e65c3a025a70609f04ceb78425bc5adad8e6" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "subtle" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" + +[[package]] +name = "syn" +version = "1.0.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "termcolor" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi 0.3.9", +] + +[[package]] +name = "time" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + +[[package]] +name = "tinyvec" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" + +[[package]] +name = "tinyvec" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +dependencies = [ + "bytes", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-uds", + "pin-project-lite", + "signal-hook-registry", + "slab", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" +dependencies = [ + "cfg-if", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "trust-dns-proto" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd7061ba6f4d4d9721afedffbfd403f20f39a4301fee1b70d6fcd09cca69f28" +dependencies = [ + "async-trait", + "backtrace", + "enum-as-inner", + "futures", + "idna 0.2.0", + "lazy_static", + "log", + "rand", + "smallvec", + "thiserror", + "tokio", + "url 2.1.1", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77" +dependencies = [ + "backtrace", + "cfg-if", + "futures", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "trust-dns-proto", +] + +[[package]] +name = "typenum" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +dependencies = [ + "tinyvec 0.3.4", +] + +[[package]] +name = "unicode-segmentation" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + +[[package]] +name = "url" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +dependencies = [ + "idna 0.2.0", + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "vcpkg" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" + +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" + +[[package]] +name = "widestring" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a763e303c0e0f23b0da40888724762e802a8ffefbc22de4127ef42493c2ea68c" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/backend/Cargo.toml b/backend/Cargo.toml new file mode 100644 index 0000000..8ce728b --- /dev/null +++ b/backend/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "furby" +version = "0.1.0" +authors = ["Akshay "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +actix-web = "3" +bcrypt = "0.8" +serde = "1.0" +serde_derive = "1.0" +serde_json = "1.0" +log = "0.4" +pretty_env_logger = "0.4" +actix-identity = "0.3.1" +actix-cors = "0.5" +bigdecimal = "0.0.14" +rand = "0.7" + +[dependencies.diesel] +version = "1.4.2" +features = ["mysql", "r2d2", "numeric", "chrono"] +default-features = false + +[dependencies.chrono] +version = "0.4" +features = ["serde"] diff --git a/backend/diesel.toml b/backend/diesel.toml new file mode 100644 index 0000000..92267c8 --- /dev/null +++ b/backend/diesel.toml @@ -0,0 +1,5 @@ +# For documentation on how to configure this file, +# see diesel.rs/guides/configuring-diesel-cli + +[print_schema] +file = "src/schema.rs" diff --git a/backend/migrations/.gitkeep b/backend/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/backend/migrations/2020-09-22-104623_create_users/down.sql b/backend/migrations/2020-09-22-104623_create_users/down.sql new file mode 100644 index 0000000..2c92cb7 --- /dev/null +++ b/backend/migrations/2020-09-22-104623_create_users/down.sql @@ -0,0 +1,3 @@ +-- This file should undo anything in `up.sql` + +DROP TABLE members; diff --git a/backend/migrations/2020-09-22-104623_create_users/up.sql b/backend/migrations/2020-09-22-104623_create_users/up.sql new file mode 100644 index 0000000..dfd27d9 --- /dev/null +++ b/backend/migrations/2020-09-22-104623_create_users/up.sql @@ -0,0 +1,8 @@ +-- Your SQL goes here +CREATE TABLE members ( + id INTEGER PRIMARY KEY AUTO_INCREMENT, + username VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL, + phone_number VARCHAR(10) NOT NULL, + email_id VARCHAR(255) NOT NULL +) diff --git a/backend/migrations/2020-11-16-133516_create_products_table/down.sql b/backend/migrations/2020-11-16-133516_create_products_table/down.sql new file mode 100644 index 0000000..7d99a98 --- /dev/null +++ b/backend/migrations/2020-11-16-133516_create_products_table/down.sql @@ -0,0 +1,3 @@ +-- This file should undo anything in `up.sql` + +DROP TABLE product; diff --git a/backend/migrations/2020-11-16-133516_create_products_table/up.sql b/backend/migrations/2020-11-16-133516_create_products_table/up.sql new file mode 100644 index 0000000..829c5be --- /dev/null +++ b/backend/migrations/2020-11-16-133516_create_products_table/up.sql @@ -0,0 +1,8 @@ +-- Your SQL goes here +CREATE TABLE product ( + id INTEGER PRIMARY KEY AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + kind VARCHAR(255), + price FLOAT NOT NULL, + description VARCHAR(255) +) diff --git a/backend/migrations/2020-12-13-140215_all_tables/down.sql b/backend/migrations/2020-12-13-140215_all_tables/down.sql new file mode 100644 index 0000000..9c554a2 --- /dev/null +++ b/backend/migrations/2020-12-13-140215_all_tables/down.sql @@ -0,0 +1,11 @@ +-- This file should undo anything in `up.sql` + +drop table customer; + +drop table product; + +drop table cart_items; + +drop table rating; + +drop table transaction; diff --git a/backend/migrations/2020-12-13-140215_all_tables/up.sql b/backend/migrations/2020-12-13-140215_all_tables/up.sql new file mode 100644 index 0000000..527b926 --- /dev/null +++ b/backend/migrations/2020-12-13-140215_all_tables/up.sql @@ -0,0 +1,47 @@ +-- Your SQL goes here + +create table customer ( + id integer primary key auto_increment, + username varchar(255) not null unique, + password varchar(255) not null, + phone_number varchar(10) not null, + email_id varchar(255) not null, + address text(500) +); + +create table product ( + id integer primary key auto_increment, + name varchar(255) not null, + kind varchar(255), + price float not null, + description varchar(255) +); + +create table cart_items ( + cart_id integer, + product_id integer, + constraint cart_items_pk primary key (cart_id, product_id), + foreign key (cart_id) references customer(id), + foreign key (product_id) references product(id) +); + +create table rating ( + id integer primary key auto_increment, + comment_text text(500), + comment_date date default curdate(), + product_id integer, + customer_id integer, + + stars integer check (stars >= 0 AND stars <= 5), + foreign key (customer_id) references customer(id), + foreign key (product_id) references product(id) +); + +create table transaction ( + id integer primary key auto_increment, + payment_type varchar(255) not null, + amount float not null, + customer_id integer, + + foreign key (customer_id) references customer(id) +); diff --git a/backend/rustfmt.toml b/backend/rustfmt.toml new file mode 100644 index 0000000..be4296e --- /dev/null +++ b/backend/rustfmt.toml @@ -0,0 +1,15 @@ +max_width = 80 +hard_tabs = false +tab_spaces = 4 +newline_style = "Auto" +use_small_heuristics = "Default" +reorder_imports = true +reorder_modules = true +remove_nested_parens = true +fn_args_layout = "Tall" +edition = "2018" +merge_derives = true +use_try_shorthand = false +use_field_init_shorthand = false +force_explicit_abi = true + diff --git a/backend/src/bin/server.rs b/backend/src/bin/server.rs new file mode 100644 index 0000000..7c67e4f --- /dev/null +++ b/backend/src/bin/server.rs @@ -0,0 +1,94 @@ +use actix_cors::Cors; +use actix_identity::{CookieIdentityPolicy, IdentityService}; +use actix_web::middleware; +use actix_web::{web, App, HttpServer}; +use diesel::r2d2::{ConnectionManager, Pool}; +use diesel::MysqlConnection; +use furby::handlers::smoke::manual_hello; +use furby::handlers::{cart_items, product, rating, users}; +use rand::Rng; + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + pretty_env_logger::init(); + + let db_url = env!("DATABASE_URL"); + let manager = ConnectionManager::::new(db_url); + let pool = Pool::builder() + .build(manager) + .expect("Failed to create pool."); + + let private_key = rand::thread_rng().gen::<[u8; 32]>(); + HttpServer::new(move || { + App::new() + .wrap(IdentityService::new( + CookieIdentityPolicy::new(&private_key) + .name("user-login") + .domain("127.0.0.1") + .path("/") + .same_site(actix_web::cookie::SameSite::None) + .http_only(true) + .secure(false), + )) + .wrap( + Cors::default() + .allowed_origin("http://127.0.0.1:8000") + .allowed_origin("http://localhost:8000") + .allow_any_method() + .allow_any_header(), + ) + .wrap( + middleware::DefaultHeaders::new() + .header("Access-Control-Allow-Credentials", "true") + .header("Access-Control-Expose-Headers", "set-cookie"), + ) + .wrap(middleware::Logger::default()) + .data(pool.clone()) + .service( + web::scope("/user") + .route("/existing", web::post().to(users::name_exists)) + .route("/login", web::post().to(users::login)) + .route("/{uname}", web::get().to(users::user_details)) + .route("/new", web::post().to(users::new_user)) + .route( + "/change_password", + web::post().to(users::change_password), + ), + ) + .service( + web::scope("/product") + .route("/catalog", web::get().to(product::get_all_products)) + .route("/new", web::post().to(product::new_product)) + .route("/{id}", web::get().to(product::product_details)) + .route( + "/reviews/{id}", + web::get().to(product::get_product_reviews), + ) + .route( + "/update_product/{id}", + web::post().to(product::update_product), + ), + ) + .service( + web::scope("/cart") + .route( + "/items", + web::get().to(cart_items::get_user_cart_items), + ) + .route("/add", web::post().to(cart_items::add_to_cart)) + .route( + "/remove", + web::post().to(cart_items::remove_from_cart), + ), + ) + .service( + web::scope("/rating") + .route("/add", web::post().to(rating::add_rating)) + .route("/remove", web::post().to(rating::remove_rating)), + ) + .route("/hey", web::get().to(manual_hello)) + }) + .bind("127.0.0.1:7878")? + .run() + .await +} diff --git a/backend/src/handlers/cart_items.rs b/backend/src/handlers/cart_items.rs new file mode 100644 index 0000000..25baaeb --- /dev/null +++ b/backend/src/handlers/cart_items.rs @@ -0,0 +1,107 @@ +use crate::models::{AddCartItem, CartItem, Customer, Product}; +use crate::schema::product::dsl as prod; +use crate::schema::{cart_items::dsl::*, customer::dsl::*}; +use crate::TPool; + +use actix_identity::Identity; +use actix_web::{web, HttpResponse, Responder}; +use diesel::prelude::*; +use log::{error, info}; +use serde::Deserialize; + +pub async fn add_to_cart( + cookie: Identity, + item_id: String, + pool: web::Data, +) -> impl Responder { + let item_details = item_id.parse::().unwrap_or(-1); + info!("Add to cart hit: {:?}", item_details); + info!("[cart] Current user: {:?}", cookie.identity()); + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + let new_cart_item = AddCartItem { + cart_id: selected_user.id, + product_id: item_details, + }; + info!( + "cart id: {:?}, product id {:?}", + selected_user.id, item_details + ); + diesel::insert_into(cart_items) + .values((cart_id.eq(selected_user.id), product_id.eq(item_details))) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Inserted successfully!") + } else { + error!("Unauthorized add to cart action!"); + return HttpResponse::Unauthorized() + .body("Need to be logged in to add to cart!"); + } +} + +pub async fn remove_from_cart( + cookie: Identity, + item_id: String, + pool: web::Data, +) -> impl Responder { + info!("Remove from cart hit: {:?}", item_id); + let item_details = item_id.parse::().unwrap_or(-1); + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + + diesel::delete( + cart_items + .filter(cart_id.eq(selected_user.id)) + .filter(product_id.eq(item_details)), + ) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Removed successfully!") + } else { + error!("Unauthorized add to cart action!"); + return HttpResponse::Unauthorized() + .body("Need to be logged in to add to cart!"); + } +} + +pub async fn get_user_cart_items( + cookie: Identity, + pool: web::Data, +) -> impl Responder { + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + let user_cart_items = cart_items + .filter(cart_id.eq(selected_user.id)) + .load::(&conn) + .expect("Couldn't connect to DB"); + let cart_products = user_cart_items + .into_iter() + .map(|item| { + prod::product + .filter(prod::id.eq(item.product_id)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to db") + }) + .collect::>(); + return HttpResponse::Ok().json(&cart_products); + } else { + return HttpResponse::Unauthorized() + .body("Need to be logged in to add to cart!"); + } +} diff --git a/backend/src/handlers/mod.rs b/backend/src/handlers/mod.rs new file mode 100644 index 0000000..9416857 --- /dev/null +++ b/backend/src/handlers/mod.rs @@ -0,0 +1,5 @@ +pub mod cart_items; +pub mod product; +pub mod rating; +pub mod smoke; +pub mod users; diff --git a/backend/src/handlers/product.rs b/backend/src/handlers/product.rs new file mode 100644 index 0000000..41a47a0 --- /dev/null +++ b/backend/src/handlers/product.rs @@ -0,0 +1,138 @@ +use crate::models::{Customer, NewProduct, Product, Rating, UpdateProduct}; +use crate::schema::customer::dsl as cust; +use crate::schema::product::dsl::*; +use crate::schema::rating::dsl as rating; +use crate::TPool; + +use actix_web::{web, HttpResponse, Responder}; +use chrono::naive::NaiveDate; +use diesel::prelude::*; +use log::{error, info}; +use serde::{Deserialize, Serialize}; + +pub async fn new_product( + pool: web::Data, + item: web::Json, +) -> impl Responder { + info!("New product hit: {:?}", item.name); + let conn = pool.get().unwrap(); + diesel::insert_into(product) + .values(item.into_inner()) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Inserted successfully!") +} + +pub async fn product_details( + pool: web::Data, + product_id: web::Path, +) -> impl Responder { + let conn = pool.get().unwrap(); + let product_id = product_id.into_inner(); + info!("Fetching product details for {}", product_id); + let selected_product = product + .filter(id.eq(&product_id)) + .limit(1) + .first::(&conn); + match selected_product { + Ok(m) => { + info!("Found product: {}", product_id); + HttpResponse::Ok().json(m) + } + Err(_) => { + error!("Product not found: {}", product_id); + HttpResponse::NotFound().finish() + } + } +} + +pub async fn update_product( + pool: web::Data, + product_id: web::Path, + product_details: web::Json, +) -> impl Responder { + let conn = pool.get().unwrap(); + let product_id = product_id.into_inner(); + let product_details = product_details.into_inner(); + info!("Updating product: {:?}", product_id); + match diesel::update(product.filter(id.eq(product_id))) + .set(( + name.eq(product_details.name), + kind.eq(product_details.kind), + price.eq(product_details.price), + description.eq(product_details.description), + )) + .execute(&conn) + { + Ok(_) => { + return HttpResponse::Ok().body("Changed product successfully") + } + _ => { + return HttpResponse::InternalServerError() + .body("Unable to update record") + } + } +} + +pub async fn get_all_products(pool: web::Data) -> impl Responder { + let conn = pool.get().unwrap(); + info!("Generating and returning catalog ..."); + match product.load::(&conn) { + Ok(products) => return HttpResponse::Ok().json(&products), + Err(_) => { + return HttpResponse::InternalServerError() + .body("Unable to fetch product catalog") + } + } +} + +#[derive(Serialize, Deserialize, Debug)] +struct ProductRating { + pub comment_text: Option, + pub comment_date: NaiveDate, + pub product_name: String, + pub customer_name: String, + pub stars: Option, +} + +pub async fn get_product_reviews( + pool: web::Data, + product_id: web::Path, +) -> impl Responder { + let conn = pool.get().unwrap(); + info!("Fetching product reviews for {}", product_id); + let pid = product_id.into_inner(); + let rating_entries = rating::rating + .filter(rating::product_id.eq(pid)) + .load::(&conn) + .expect("Couldn't connect to DB"); + let json_ratings = rating_entries + .into_iter() + .map(move |p| { + let selected_product = product + .filter(id.eq(&p.product_id.unwrap())) + .limit(1) + .first::(&conn) + .unwrap() + .name + .clone(); + + let selected_customer = cust::customer + .filter(cust::id.eq(&p.customer_id.unwrap())) + .limit(1) + .first::(&conn) + .unwrap() + .username + .clone(); + + ProductRating { + comment_text: p.comment_text, + comment_date: p.comment_date.unwrap(), + product_name: selected_product, + customer_name: selected_customer, + stars: p.stars, + } + }) + .collect::>(); + return HttpResponse::Ok().json(&json_ratings); +} diff --git a/backend/src/handlers/rating.rs b/backend/src/handlers/rating.rs new file mode 100644 index 0000000..dfbeb3e --- /dev/null +++ b/backend/src/handlers/rating.rs @@ -0,0 +1,91 @@ +use crate::models::{AddRating, Customer, Rating}; +use crate::schema::rating::dsl as rating; +use crate::schema::{customer::dsl::*, product::dsl::*}; +use crate::TPool; + +use actix_identity::Identity; +use actix_web::{web, HttpResponse, Responder}; +use diesel::prelude::*; +use log::{error, info}; +use serde::Deserialize; + +#[derive(Deserialize, Debug)] +pub struct AddRatingJson { + pub comment_text: Option, + pub stars: Option, + pub product_id: i32, +} + +pub async fn add_rating( + cookie: Identity, + rating_details: web::Json, + pool: web::Data, +) -> impl Responder { + info!("Add rating hit: {:?}", rating_details.product_id); + info!("{:?}", cookie.identity()); + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + let rating_details = rating_details.into_inner(); + let new_rating = AddRating { + comment_text: rating_details.comment_text, + stars: rating_details.stars, + product_id: rating_details.product_id, + customer_id: selected_user.id, + }; + diesel::insert_into(rating::rating) + .values(new_rating) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Inserted rating successfully!") + } else { + error!("Unauthorized add rating action!"); + return HttpResponse::Unauthorized() + .body("Need to be logged in to add rating!"); + } +} + +#[derive(Deserialize, Debug)] +pub struct RemoveRating { + rating_id: i32, +} + +pub async fn remove_rating( + cookie: Identity, + rating_details: web::Json, + pool: web::Data, +) -> impl Responder { + info!("Remove rating hit: {:?}", rating_details.rating_id); + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + + diesel::delete( + rating::rating + .filter(rating::customer_id.eq(selected_user.id)) + .filter(rating::id.eq(rating_details.rating_id)), + ) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Removed successfully!") + } else { + error!("Unauthorized add to cart action!"); + return HttpResponse::Unauthorized() + .body("Need to be logged in to add to cart!"); + } +} + +// pub async fn get_product_reviews( +// product: web::Json, +// pool: web::Data, +// ) -> impl Responder { +// unimplemented!() +// } diff --git a/backend/src/handlers/smoke.rs b/backend/src/handlers/smoke.rs new file mode 100644 index 0000000..d0a1038 --- /dev/null +++ b/backend/src/handlers/smoke.rs @@ -0,0 +1,15 @@ +use actix_web::{get, post, HttpResponse, Responder}; + +#[get("/")] +async fn hello() -> impl Responder { + HttpResponse::Ok().body("Hello world!") +} + +#[post("/echo")] +async fn echo(req_body: String) -> impl Responder { + HttpResponse::Ok().body(req_body) +} + +pub async fn manual_hello() -> impl Responder { + HttpResponse::Ok().body("Hey there!") +} diff --git a/backend/src/handlers/users.rs b/backend/src/handlers/users.rs new file mode 100644 index 0000000..24fb591 --- /dev/null +++ b/backend/src/handlers/users.rs @@ -0,0 +1,148 @@ +use crate::models::{Customer, NewCustomer}; +use crate::schema::customer::dsl::*; +use crate::TPool; + +use actix_identity::Identity; +use actix_web::{web, HttpResponse, Responder}; +use bcrypt::{hash, verify, DEFAULT_COST}; +use diesel::prelude::*; +use log::{error, info}; +use serde::Deserialize; + +pub async fn new_user( + pool: web::Data, + item: web::Json, +) -> impl Responder { + info!("Creating ... {:?}", item.username); + let conn = pool.get().unwrap(); + let hashed_item = NewCustomer { + password: hash(&item.password, DEFAULT_COST).unwrap(), + ..(item.into_inner()) + }; + diesel::insert_into(customer) + .values(hashed_item) + .execute(&conn) + .expect("Coundn't connect to DB"); + HttpResponse::Ok().body("Inserted successfully!") +} + +pub async fn name_exists( + pool: web::Data, + item: String, +) -> impl Responder { + let conn = pool.get().unwrap(); + info!("target: {:?}", item); + if (customer + .filter(username.eq(&item)) + .limit(1) + .load::(&conn) + .expect("Coundn't connect to DB")) + .len() + > 0 + { + HttpResponse::Ok().body("true") + } else { + HttpResponse::Ok().body("false") + } +} + +#[derive(Deserialize)] +pub struct Login { + username: String, + password: String, +} + +pub async fn login( + pool: web::Data, + cookie: Identity, + login_details: web::Json, +) -> impl Responder { + info!("Login hit"); + if let Some(uname) = cookie.identity() { + info!("Found existing cookie: {:?}", cookie.identity()); + return HttpResponse::Ok().finish(); + } + let conn = pool.get().unwrap(); + let entered_pass = &login_details.password; + let selected_user = customer + .filter(username.eq(&login_details.username)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + let hashed_pass = selected_user.password; + if verify(entered_pass, &hashed_pass).unwrap() { + cookie.remember(login_details.username.clone()); + info!( + "Successful login: {} {}", + selected_user.username, selected_user.email_id + ); + HttpResponse::Ok().finish() + } else { + HttpResponse::Unauthorized().finish() + } +} + +pub async fn logout(cookie: Identity) -> impl Responder { + cookie.forget(); + HttpResponse::Found().header("location", "/").finish() +} + +pub async fn user_details( + uname: web::Path, + pool: web::Data, +) -> impl Responder { + let conn = pool.get().unwrap(); + let uname = uname.into_inner(); + info!("Fetching info for: \"{}\"", uname); + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn); + match selected_user { + Ok(m) => { + info!("Found user: {}", uname); + HttpResponse::Ok().json(m) + } + Err(_) => { + error!("User not found: {}", uname); + HttpResponse::NotFound().finish() + } + } +} + +#[derive(Deserialize, Debug)] +pub struct ChangePassword { + old_password: String, + new_password: String, +} + +pub async fn change_password( + cookie: Identity, + password_details: web::Json, + pool: web::Data, +) -> impl Responder { + info!("Change password request: {:?}", password_details); + let conn = pool.get().unwrap(); + if let Some(uname) = cookie.identity() { + let entered_pass = &password_details.old_password; + let new_password = &password_details.new_password; + let selected_user = customer + .filter(username.eq(&uname)) + .limit(1) + .first::(&conn) + .expect("Couldn't connect to DB"); + let hashed_pass = selected_user.password; + if verify(entered_pass, &hashed_pass).unwrap() { + let hashed_new_password = + hash(&new_password, DEFAULT_COST).unwrap(); + diesel::update(customer.filter(id.eq(selected_user.id))) + .set(password.eq(hashed_new_password)) + .execute(&conn) + .unwrap(); + return HttpResponse::Ok().body("Changed password successfully"); + } else { + return HttpResponse::Ok().body("Invalid password"); + } + } + return HttpResponse::Unauthorized().body("Login first"); +} diff --git a/backend/src/lib.rs b/backend/src/lib.rs new file mode 100644 index 0000000..d956a3f --- /dev/null +++ b/backend/src/lib.rs @@ -0,0 +1,10 @@ +#[macro_use] +extern crate diesel; + +pub mod handlers; +pub mod models; +pub mod schema; + +use diesel::r2d2::{self, ConnectionManager}; +use diesel::MysqlConnection; +pub type TPool = r2d2::Pool>; diff --git a/backend/src/models.rs b/backend/src/models.rs new file mode 100644 index 0000000..a104209 --- /dev/null +++ b/backend/src/models.rs @@ -0,0 +1,97 @@ +use super::schema::{cart_items, customer, product, rating, transaction}; + +use chrono::naive::{NaiveDate, NaiveDateTime}; +use diesel::{Insertable, Queryable}; +use serde::{Deserialize, Serialize}; + +/* Member */ +#[derive(Queryable, Serialize)] +pub struct Customer { + pub id: i32, + pub username: String, + pub password: String, + pub phone_number: String, + pub email_id: String, + pub address: Option, +} + +#[derive(Insertable, Deserialize)] +#[table_name = "customer"] +pub struct NewCustomer { + pub username: String, + pub password: String, + pub phone_number: String, + pub email_id: String, + + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option, +} + +/* Product */ +#[derive(Queryable, Serialize)] +pub struct Product { + pub id: i32, + pub name: String, + pub kind: Option, + pub price: f32, + pub description: Option, +} + +#[derive(Insertable, Deserialize)] +#[table_name = "product"] +pub struct NewProduct { + pub name: String, + + #[serde(skip_serializing_if = "Option::is_none")] + pub kind: Option, + pub price: f32, + + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, +} + +#[derive(Deserialize)] +pub struct UpdateProduct { + pub name: String, + pub kind: Option, + pub price: f32, + pub description: Option, +} + +/* Cart Items */ +#[derive(Queryable, Serialize)] +pub struct CartItem { + pub cart_id: i32, + pub product_id: i32, +} + +#[derive(Insertable, Deserialize)] +#[table_name = "cart_items"] +pub struct AddCartItem { + pub cart_id: i32, + pub product_id: i32, +} + +/* Rating */ +#[derive(Queryable, Serialize)] +pub struct Rating { + pub id: i32, + pub comment_text: Option, + pub comment_date: Option, + pub product_id: Option, + pub customer_id: Option, + pub stars: Option, +} + +#[derive(Insertable, Deserialize)] +#[table_name = "rating"] +pub struct AddRating { + #[serde(skip_serializing_if = "Option::is_none")] + pub comment_text: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub stars: Option, + + pub product_id: i32, + pub customer_id: i32, +} diff --git a/backend/src/schema.rs b/backend/src/schema.rs new file mode 100644 index 0000000..f08221a --- /dev/null +++ b/backend/src/schema.rs @@ -0,0 +1,61 @@ +table! { + cart_items (cart_id, product_id) { + cart_id -> Integer, + product_id -> Integer, + } +} + +table! { + customer (id) { + id -> Integer, + username -> Varchar, + password -> Varchar, + phone_number -> Varchar, + email_id -> Varchar, + address -> Nullable, + } +} + +table! { + product (id) { + id -> Integer, + name -> Varchar, + kind -> Nullable, + price -> Float, + description -> Nullable, + } +} + +table! { + rating (id) { + id -> Integer, + comment_text -> Nullable, + comment_date -> Nullable, + product_id -> Nullable, + customer_id -> Nullable, + stars -> Nullable, + } +} + +table! { + transaction (id) { + id -> Integer, + payment_type -> Varchar, + amount -> Float, + customer_id -> Nullable, + } +} + +joinable!(cart_items -> customer (cart_id)); +joinable!(cart_items -> product (product_id)); +joinable!(rating -> customer (customer_id)); +joinable!(rating -> product (product_id)); +joinable!(transaction -> customer (customer_id)); + +allow_tables_to_appear_in_same_query!( + cart_items, + customer, + product, + rating, + transaction, +); diff --git a/backend/tests/product/chair.json b/backend/tests/product/chair.json new file mode 100644 index 0000000..bb13c8b --- /dev/null +++ b/backend/tests/product/chair.json @@ -0,0 +1,6 @@ +{ + "name": "Urban Ladder Teak Chair", + "kind": "Chair", + "price": 3500, + "description": "Sleek, modern chair for offices and workplaces" +} diff --git a/backend/tests/product/dumb_sofa.json b/backend/tests/product/dumb_sofa.json new file mode 100644 index 0000000..2b09a58 --- /dev/null +++ b/backend/tests/product/dumb_sofa.json @@ -0,0 +1,4 @@ +{ + "name": "Home Town Leather Sofa", + "price": 5400 +} diff --git a/backend/tests/product/smart_sofa.json b/backend/tests/product/smart_sofa.json new file mode 100644 index 0000000..5d7f7d4 --- /dev/null +++ b/backend/tests/product/smart_sofa.json @@ -0,0 +1,6 @@ +{ + "name": "Home Town Leather Sofa", + "kind": "Sofa", + "description": "Comfortable, authentic leather, wooden frame sofa, for living rooms", + "price": 5400 +} diff --git a/backend/tests/requests.txt b/backend/tests/requests.txt new file mode 100644 index 0000000..7e2ca5c --- /dev/null +++ b/backend/tests/requests.txt @@ -0,0 +1,21 @@ +http POST :7878/user/login username=akshay password=password + +http POST :7878/user/login username=akshay password=nigga + +http POST :7878/user/change_password Cookie: old_password=nigga new_password=nigga + +http :7878/user/change_password username=akshay password=password + +http :7878/product/catalog + +http :7878/product/1 + +http POST :7878/cart/add Cookie: product_id:=1 + +http :7878/cart/items Cookie: + +http POST :7878/cart/remove Cookie: product_id:=1 + +http POST :7878/rating/add Cookie: product_id:=1 stars:=3 comment_text=Very good functional chair + +http :7878/product/reviews/1 diff --git a/backend/tests/users/add_akshay.json b/backend/tests/users/add_akshay.json new file mode 100644 index 0000000..1d6c405 --- /dev/null +++ b/backend/tests/users/add_akshay.json @@ -0,0 +1,8 @@ + +{ + "username": "Akshay", + "password": "akshay", + "phone_number": "123454234", + "email_id": "aks@hay.com", + "address": "Rv College of Engineering, Mysuru Road, 560087, Near Metro station" +} diff --git a/backend/tests/users/add_user.json b/backend/tests/users/add_user.json new file mode 100644 index 0000000..1f481e9 --- /dev/null +++ b/backend/tests/users/add_user.json @@ -0,0 +1,7 @@ +{ + "username": "Ramu Kaka", + "password": "ramu123", + "phone_number": "123454234", + "email_id": "ramu@kaka.com", + "address": "RA-602, Purva Riviera" +} diff --git a/default.nix b/default.nix deleted file mode 100644 index 11d6ca7..0000000 --- a/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -let - sources = import ./nix/sources.nix; - nixpkgs-mozilla = import sources.nixpkgs-mozilla; - pkgs = import sources.nixpkgs { - overlays = - [ - nixpkgs-mozilla - (self: super: - { - rustc = self.latest.rustChannels.nightly.rust; - cargo = self.latest.rustChannels.nightly.rust; - } - ) - ]; - }; - naersk = pkgs.callPackage sources.naersk {}; -in - naersk.buildPackage ./. diff --git a/diesel.toml b/diesel.toml deleted file mode 100644 index 92267c8..0000000 --- a/diesel.toml +++ /dev/null @@ -1,5 +0,0 @@ -# For documentation on how to configure this file, -# see diesel.rs/guides/configuring-diesel-cli - -[print_schema] -file = "src/schema.rs" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8a14f41 --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "mozillapkgs": { + "flake": false, + "locked": { + "lastModified": 1603906276, + "narHash": "sha256-RsNPnEKd7BcogwkqhaV5kI/HuNC4flH/OQCC/4W5y/8=", + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "rev": "8c007b60731c07dd7a052cce508de3bb1ae849b4", + "type": "github" + }, + "original": { + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1608136118, + "narHash": "sha256-yvnnBQrVsrWkRAEZDM3LiAVPSKBgk9ZgiSaa6NYmJX4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "929768261a3ede470eafb58d5b819e1a848aa8bf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-20.03", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "mozillapkgs": "mozillapkgs", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4799770 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "Frontend and backend for Furby"; + + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-20.03; + mozillapkgs = { + url = "github:mozilla/nixpkgs-mozilla"; + flake = false; + }; + }; + + + outputs = { self, nixpkgs, mozillapkgs }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; + rust = (mozilla.rustChannelOf { + date = "2020-12-23"; # get the current date with `date -I` + channel = "nightly"; + sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E="; + }).rust; + frontendPackages = with pkgs; [ + elmPackages.elm + elmPackages.elm-language-server + elmPackages.elm-format + nodePackages.elm-oracle + elmPackages.elm-test + ]; + backendPackages = with pkgs; [ + cargo rust pkg-config + openssl httpie curl diesel-cli + libmysqlclient jq python3 + ]; + in + with pkgs; + { + defaultPackage.x86_64-linux = stdenv.mkDerivation { + name = "furby"; + src = "./."; + buildInputs = frontendPackages ++ backendPackages; + }; + }; +} diff --git a/frontend/.direnv/flake-profile b/frontend/.direnv/flake-profile new file mode 120000 index 0000000..6e8a8e9 --- /dev/null +++ b/frontend/.direnv/flake-profile @@ -0,0 +1 @@ +/nix/store/m4z2i7h8x7xwac09q8gw4km9vhmi88ka-furby-env \ No newline at end of file diff --git a/frontend/.direnv/flake-profile.rc b/frontend/.direnv/flake-profile.rc new file mode 100644 index 0000000..dff177f --- /dev/null +++ b/frontend/.direnv/flake-profile.rc @@ -0,0 +1,1473 @@ +unset shellHook +nix_saved_PATH="$PATH" +AR=ar +export AR +AS=as +export AS +BASH=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +CC=gcc +export CC +CONFIG_SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export CONFIG_SHELL +CXX=g++ +export CXX +DIRSTACK=() +GROUPS=() +HOSTTYPE=x86_64 +HOST_PATH=/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin +export HOST_PATH +IFS=$' \t\n' +IN_NIX_SHELL=impure +export IN_NIX_SHELL +LD=ld +export LD +MACHTYPE=x86_64-unknown-linux-gnu +NIX_BINTOOLS=/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1 +export NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 +export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_BUILD_CORES=8 +export NIX_BUILD_CORES +NIX_CC=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 +export NIX_CC +NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 +export NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_ENFORCE_NO_NATIVE=1 +export NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow' +export NIX_HARDENING_ENABLE +NIX_INDENT_MAKE=1 +export NIX_INDENT_MAKE +NIX_LDFLAGS='-rpath /home/np/code/elmstuff/app-furby/outputs/out/lib64 -rpath /home/np/code/elmstuff/app-furby/outputs/out/lib ' +export NIX_LDFLAGS +NIX_LIB64_IN_SELF_RPATH=1 +NIX_NO_SELF_RPATH=1 +NIX_STORE=/nix/store +export NIX_STORE +NM=nm +export NM +OBJCOPY=objcopy +export OBJCOPY +OBJDUMP=objdump +export OBJDUMP +OPTERR=1 +OPTIND=1 +OSTYPE=linux-gnu +PATH=/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9/bin:/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0/bin:/nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1/bin:/nix/store/hrkc2sf2883l16d5yq3zg0y339kfw4xv-binutils-2.31.1/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin +export PATH +PIPESTATUS=([0]="0") +PS4='+ ' +RANLIB=ranlib +export RANLIB +READELF=readelf +export READELF +SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export SHELL +SIZE=size +export SIZE +SOURCE_DATE_EPOCH=1 +export SOURCE_DATE_EPOCH +STRINGS=strings +export STRINGS +STRIP=strip +export STRIP +_=export +buildInputs='/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1 /nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3 /nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3 /nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1 /nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2' +export buildInputs +builder=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export builder +commonStripFlags=--enable-deterministic-archives +configureFlags= +export configureFlags +defaultBuildInputs= +defaultNativeBuildInputs='/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9 /nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh /nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh /nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh /nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0' +depsBuildBuild= +export depsBuildBuild +depsBuildBuildPropagated= +export depsBuildBuildPropagated +depsBuildTarget= +export depsBuildTarget +depsBuildTargetPropagated= +export depsBuildTargetPropagated +depsHostHost= +export depsHostHost +depsHostHostPropagated= +export depsHostHostPropagated +depsTargetTarget= +export depsTargetTarget +depsTargetTargetPropagated= +export depsTargetTargetPropagated +doCheck= +export doCheck +doInstallCheck= +export doInstallCheck +dontAddDisableDepTrack=1 +export dontAddDisableDepTrack +envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars") +envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars") +fixupOutputHooks=([0]="if [ -z \"\${dontPatchELF-}\" ]; then patchELF \"\$prefix\"; fi" [1]="_makeSymlinksRelative" [2]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [3]="_doStrip" [4]="patchShebangsAuto" [5]="_pruneLibtoolFiles" [6]="if [[ -z \"\${noAuditTmpdir-}\" && -e \"\$prefix\" ]]; then auditTmpdir \"\$prefix\"; fi" [7]="_moveSbin" [8]="_moveLib64") +initialPath='/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31 /nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0 /nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7 /nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8 /nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4 /nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1 /nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32 /nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10 /nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin /nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1 /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23 /nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6 /nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin' +name=furby +export name +nativeBuildInputs= +export nativeBuildInputs +out=/home/np/code/elmstuff/app-furby/outputs/out +export out +outputBin=out +outputDev=out +outputDevdoc=REMOVE +outputDevman=out +outputDoc=out +outputInclude=out +outputInfo=out +outputLib=out +outputMan=out +outputs=out +export outputs +patches= +export patches +pkg=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 +pkgsBuildHost=([0]="/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9" [1]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [2]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [3]="/nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh" [4]="/nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh" [5]="/nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh" [6]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [7]="/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh" [8]="/nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh" [9]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [10]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [11]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [12]="/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0" [13]="/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1") +pkgsHostTarget=([0]="/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1" [1]="/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3" [2]="/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3" [3]="/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1" [4]="/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2") +postFixupHooks=([0]="_multioutPropagateDev") +postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot") +preConfigureHooks=([0]="_multioutConfig") +preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs") +prefix=/home/np/code/elmstuff/app-furby/outputs/out +propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps") +propagatedBuildInputs= +export propagatedBuildInputs +propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs") +propagatedNativeBuildInputs= +export propagatedNativeBuildInputs +propagatedTargetDepFiles=([0]="propagated-target-target-deps") +shell=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash +export shell +src=./. +export src +stdenv=/nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux +export stdenv +strictDeps= +export strictDeps +system=x86_64-linux +export system +unpackCmdHooks=([0]="_defaultUnpack") +PATH="$PATH:$nix_saved_PATH" +_activatePkgs () +{ + local -i hostOffset targetOffset; + local pkg; + for hostOffset in "${allPlatOffsets[@]}"; + do + local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}"; + for targetOffset in "${allPlatOffsets[@]}"; + do + (( "$hostOffset" <= "$targetOffset" )) || continue; + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + activatePackage "$pkg" "$hostOffset" "$targetOffset"; + done; + done; + done +} +_addRpathPrefix () +{ + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; + if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then + export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}"; + fi; + if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then + export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}"; + fi; + fi +} +_addToEnv () +{ + local -i depHostOffset depTargetOffset; + local pkg; + for depHostOffset in "${allPlatOffsets[@]}"; + do + local hookVar="${pkgHookVarVars[$depHostOffset + 1]}"; + local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}"; + for depTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$depHostOffset" <= "$depTargetOffset" )) || continue; + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; + if [[ -z "${strictDeps-}" ]]; then + local visitedPkgs=""; + for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}; + do + if [[ "$visitedPkgs" = *"$pkg"* ]]; then + continue; + fi; + runHook "${!hookRef}" "$pkg"; + visitedPkgs+=" $pkg"; + done; + else + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + runHook "${!hookRef}" "$pkg"; + done; + fi; + done; + done +} +_allFlags () +{ + for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); + do + if (( "${NIX_DEBUG:-0}" >= 1 )); then + printf "@%s@ -> %q\n" "${varName}" "${!varName}"; + fi; + args+=("--subst-var" "$varName"); + done +} +_assignFirst () +{ + local varName="$1"; + local REMOVE=REMOVE; + shift; + while (( $# )); do + if [ -n "${!1-}" ]; then + eval "${varName}"="$1"; + return; + fi; + shift; + done; + echo "Error: _assignFirst found no valid variant!"; + return 1 +} +_callImplicitHook () +{ + local def="$1"; + local hookName="$2"; + if declare -F "$hookName" > /dev/null; then + "$hookName"; + else + if type -p "$hookName" > /dev/null; then + source "$hookName"; + else + if [ -n "${!hookName:-}" ]; then + eval "${!hookName}"; + else + return "$def"; + fi; + fi; + fi +} +_defaultUnpack () +{ + local fn="$1"; + if [ -d "$fn" ]; then + cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"; + else + case "$fn" in + *.tar.xz | *.tar.lzma | *.txz) + xz -d < "$fn" | tar xf - + ;; + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) + tar xf "$fn" + ;; + *) + return 1 + ;; + esac; + fi +} +_doStrip () +{ + local -ra flags=(dontStripHost dontStripTarget); + local -ra stripCmds=(STRIP TARGET_STRIP); + if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then + dontStripTarget+=1; + fi; + local i; + for i in ${!stripCmds[@]}; + do + local -n flag="${flags[$i]}"; + local -n stripCmd="${stripCmds[$i]}"; + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then + continue; + fi; + stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}; + if [ -n "$stripDebugList" ]; then + stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"; + fi; + stripAllList=${stripAllList:-}; + if [ -n "$stripAllList" ]; then + stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"; + fi; + done +} +_eval () +{ + if declare -F "$1" > /dev/null 2>&1; then + "$@"; + else + eval "$1"; + fi +} +_makeSymlinksRelative () +{ + local symlinkTarget; + if [ -n "${dontRewriteSymlinks-}" ]; then + return 0; + fi; + while IFS= read -r -d '' f; do + symlinkTarget=$(readlink "$f"); + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then + continue; + fi; + if [ ! -e "$symlinkTarget" ]; then + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; + fi; + echo "rewriting symlink $f to be relative to $prefix"; + ln -snrf "$symlinkTarget" "$f"; + done < <(find $prefix -type l -print0) +} +_moveLib64 () +{ + if [ "${dontMoveLib64-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then + return; + fi; + echo "moving $prefix/lib64/* to $prefix/lib"; + mkdir -p $prefix/lib; + shopt -s dotglob; + for i in $prefix/lib64/*; + do + mv --no-clobber "$i" $prefix/lib; + done; + shopt -u dotglob; + rmdir $prefix/lib64; + ln -s lib $prefix/lib64 +} +_moveSbin () +{ + if [ "${dontMoveSbin-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then + return; + fi; + echo "moving $prefix/sbin/* to $prefix/bin"; + mkdir -p $prefix/bin; + shopt -s dotglob; + for i in $prefix/sbin/*; + do + mv "$i" $prefix/bin; + done; + shopt -u dotglob; + rmdir $prefix/sbin; + ln -s bin $prefix/sbin +} +_moveToShare () +{ + forceShare=${forceShare:=man doc info}; + if [ -z "$forceShare" -o -z "$out" ]; then + return; + fi; + for d in $forceShare; + do + if [ -d "$out/$d" ]; then + if [ -d "$out/share/$d" ]; then + echo "both $d/ and share/$d/ exist!"; + else + echo "moving $out/$d to $out/share/$d"; + mkdir -p $out/share; + mv $out/$d $out/share/; + fi; + fi; + done +} +_multioutConfig () +{ + if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then + return; + fi; + if [ -z "$shareDocName" ]; then + local confScript="$configureScript"; + if [ -z "$confScript" ] && [ -x ./configure ]; then + confScript=./configure; + fi; + if [ -f "$confScript" ]; then + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; + fi; + if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; + fi; + fi; + configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info --docdir=${!outputDoc}/share/doc/${shareDocName} --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec --localedir=${!outputLib}/share/locale $configureFlags"; + installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags" +} +_multioutDevs () +{ + if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then + return; + fi; + moveToOutput include "${!outputInclude}"; + moveToOutput lib/pkgconfig "${!outputDev}"; + moveToOutput share/pkgconfig "${!outputDev}"; + moveToOutput lib/cmake "${!outputDev}"; + moveToOutput share/aclocal "${!outputDev}"; + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; + do + echo "Patching '$f' includedir to output ${!outputInclude}"; + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; + done +} +_multioutDocs () +{ + local REMOVE=REMOVE; + moveToOutput share/info "${!outputInfo}"; + moveToOutput share/doc "${!outputDoc}"; + moveToOutput share/gtk-doc "${!outputDevdoc}"; + moveToOutput share/devhelp/books "${!outputDevdoc}"; + moveToOutput share/man "${!outputMan}"; + moveToOutput share/man/man3 "${!outputDevman}" +} +_multioutPropagateDev () +{ + if [ "$outputs" = "out" ]; then + return; + fi; + local outputFirst; + for outputFirst in $outputs; + do + break; + done; + local propagaterOutput="$outputDev"; + if [ -z "$propagaterOutput" ]; then + propagaterOutput="$outputFirst"; + fi; + if [ -z "${propagatedBuildOutputs+1}" ]; then + local po_dirty="$outputBin $outputInclude $outputLib"; + set +o pipefail; + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; + set -o pipefail; + fi; + if [ -z "$propagatedBuildOutputs" ]; then + return; + fi; + mkdir -p "${!propagaterOutput}"/nix-support; + for output in $propagatedBuildOutputs; + do + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; + done +} +_overrideFirst () +{ + if [ -z "${!1-}" ]; then + _assignFirst "$@"; + fi +} +_pruneLibtoolFiles () +{ + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; +} +_updateSourceDateEpochFromSourceRoot () +{ + if [ -n "$sourceRoot" ]; then + updateSourceDateEpoch "$sourceRoot"; + fi +} +activatePackage () +{ + local pkg="$1"; + local -ri hostOffset="$2"; + local -ri targetOffset="$3"; + (( "$hostOffset" <= "$targetOffset" )) || exit -1; + if [ -f "$pkg" ]; then + source "$pkg"; + fi; + if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then + addToSearchPath _PATH "$pkg/bin"; + fi; + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then + addToSearchPath _HOST_PATH "$pkg/bin"; + fi; + if [[ -f "$pkg/nix-support/setup-hook" ]]; then + source "$pkg/nix-support/setup-hook"; + fi +} +addEnvHooks () +{ + local depHostOffset="$1"; + shift; + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; + local pkgHookVar; + for pkgHookVar in "${!pkgHookVarsSlice}"; + do + eval "${pkgHookVar}s"'+=("$@")'; + done +} +addToSearchPath () +{ + addToSearchPathWithCustomDelimiter ":" "$@" +} +addToSearchPathWithCustomDelimiter () +{ + local delimiter="$1"; + local varName="$2"; + local dir="$3"; + if [ -d "$dir" ]; then + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; + fi +} +auditTmpdir () +{ + local dir="$1"; + [ -e "$dir" ] || return 0; + header "checking for references to $TMPDIR/ in $dir..."; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if isELF "$i"; then + if { + printf :; + patchelf --print-rpath "$i" + } | grep -q -F ":$TMPDIR/"; then + echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + if isScript "$i"; then + if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then + if grep -q -F "$TMPDIR/" "$i"; then + echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + fi; + done < <(find "$dir" -type f -print0); + stopNest +} +bintoolsWrapper_addLDVars () +{ + local role_post role_pre; + getHostRoleEnvHook; + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_${role_pre}LDFLAGS+=" -L$1/lib64"; + fi; + if [[ -d "$1/lib" ]]; then + local -a glob=($1/lib/lib*); + if [ "${#glob[*]}" -gt 0 ]; then + export NIX_${role_pre}LDFLAGS+=" -L$1/lib"; + fi; + fi +} +buildPhase () +{ + runHook preBuild; + : ${makeFlags=}; + if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile, doing nothing"; + else + foundMakefile=1; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}); + echoCmd 'build flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postBuild +} +ccWrapper_addCVars () +{ + local role_post role_pre; + getHostRoleEnvHook; + if [ -d "$1/include" ]; then + export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include"; + fi; + if [ -d "$1/Library/Frameworks" ]; then + export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks"; + fi +} +checkPhase () +{ + runHook preCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + runHook postCheck; + return; + fi; + if [[ -z "${checkTarget:-}" ]]; then + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then + checkTarget=check; + else + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then + checkTarget=test; + fi; + fi; + fi; + if [[ -z "${checkTarget:-}" ]]; then + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget}); + echoCmd 'check flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postCheck +} +closeNest () +{ + true +} +compressManPages () +{ + local dir="$1"; + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then + return; + fi; + echo "gzipping man pages under $dir/share/man/"; + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do + if gzip -c -n "$f" > "$f".gz; then + rm "$f"; + else + rm "$f".gz; + fi; + done; + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do + local target; + target="$(readlink -f "$f")"; + if [ -f "$target".gz ]; then + ln -sf "$target".gz "$f".gz && rm "$f"; + fi; + done +} +configurePhase () +{ + runHook preConfigure; + : ${configureScript=}; + : ${configureFlags=}; + if [[ -z "$configureScript" && -x ./configure ]]; then + configureScript=./configure; + fi; + if [ -z "${dontFixLibtool:-}" ]; then + local i; + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do + echo "fixing libtool script $i"; + fixLibtool "$i"; + done; + fi; + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then + configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"; + fi; + if [ -z "${dontAddDisableDepTrack:-}" ]; then + if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then + configureFlags="--disable-dependency-tracking $configureFlags"; + fi; + fi; + if [ -z "${dontDisableStatic:-}" ]; then + if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then + configureFlags="--disable-static $configureFlags"; + fi; + fi; + if [ -n "$configureScript" ]; then + local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"}); + echoCmd 'configure flags' "${flagsArray[@]}"; + $configureScript "${flagsArray[@]}"; + unset flagsArray; + else + echo "no configure script, doing nothing"; + fi; + runHook postConfigure +} +consumeEntire () +{ + if IFS='' read -r -N 0 $1; then + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; + return 1; + fi +} +distPhase () +{ + runHook preDist; + local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}); + echo 'dist flags: %q' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + if [ "${dontCopyDist:-0}" != 1 ]; then + mkdir -p "$out/tarballs"; + cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"; + fi; + runHook postDist +} +dumpVars () +{ + if [ "${noDumpEnvVars:-0}" != 1 ]; then + export > "$NIX_BUILD_TOP/env-vars" || true; + fi +} +echoCmd () +{ + printf "%s:" "$1"; + shift; + printf ' %q' "$@"; + echo +} +exitHandler () +{ + exitCode="$?"; + set +e; + if [ -n "${showBuildStats:-}" ]; then + times > "$NIX_BUILD_TOP/.times"; + local -a times=($(cat "$NIX_BUILD_TOP/.times")); + echo "build time elapsed: " "${times[@]}"; + fi; + if (( "$exitCode" != 0 )); then + runHook failureHook; + if [ -n "${succeedOnFailure:-}" ]; then + echo "build failed with exit code $exitCode (ignored)"; + mkdir -p "$out/nix-support"; + printf "%s" "$exitCode" > "$out/nix-support/failed"; + exit 0; + fi; + else + runHook exitHook; + fi; + exit "$exitCode" +} +findInputs () +{ + local -r pkg="$1"; + local -ri hostOffset="$2"; + local -ri targetOffset="$3"; + (( "$hostOffset" <= "$targetOffset" )) || exit -1; + local varVar="${pkgAccumVarVars[$hostOffset + 1]}"; + local varRef="$varVar[\$targetOffset - \$hostOffset]"; + local var="${!varRef}"; + unset -v varVar varRef; + local varSlice="$var[*]"; + case "${!varSlice-}" in + *" $pkg "*) + return 0 + ;; + esac; + unset -v varSlice; + eval "$var"'+=("$pkg")'; + if ! [ -e "$pkg" ]; then + echo "build input $pkg does not exist" 1>&2; + exit 1; + fi; + local -i mapOffsetResult; + function mapOffset () + { + local -ri inputOffset="$1"; + if (( "$inputOffset" <= 0 )); then + local -ri outputOffset="$inputOffset + $hostOffset"; + else + local -ri outputOffset="$inputOffset - 1 + $targetOffset"; + fi; + mapOffsetResult="$outputOffset" + }; + local -i relHostOffset; + for relHostOffset in "${allPlatOffsets[@]}"; + do + local files="${propagatedDepFilesVars[$relHostOffset + 1]}"; + mapOffset relHostOffset; + local -i hostOffsetNext="$mapOffsetResult"; + [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue; + local -i relTargetOffset; + for relTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; + local file="${!fileRef}"; + unset -v fileRef; + mapOffset relTargetOffset; + local -i targetOffsetNext="$mapOffsetResult"; + [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue; + [[ -f "$pkg/nix-support/$file" ]] || continue; + local pkgNext; + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; + for pkgNext in $pkgNext; + do + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; + done; + done; + done +} +fixLibtool () +{ + sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1" +} +fixupPhase () +{ + local output; + for output in $outputs; + do + if [ -e "${!output}" ]; then + chmod -R u+w "${!output}"; + fi; + done; + runHook preFixup; + local output; + for output in $outputs; + do + prefix="${!output}" runHook fixupOutput; + done; + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); + local propagatedInputsIndex; + for propagatedInputsIndex in "${!flatVars[@]}"; + do + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; + [[ -n "${!propagatedInputsSlice}" ]] || continue; + mkdir -p "${!outputDev}/nix-support"; + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; + done; + if [ -n "${setupHook:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; + fi; + if [ -n "${setupHooks:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + local hook; + for hook in $setupHooks; + do + local content; + consumeEntire content < "$hook"; + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; + unset -v content; + done; + unset -v hook; + fi; + if [ -n "${propagatedUserEnvPkgs:-}" ]; then + mkdir -p "${!outputBin}/nix-support"; + printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; + fi; + runHook postFixup +} +genericBuild () +{ + if [ -f "${buildCommandPath:-}" ]; then + source "$buildCommandPath"; + return; + fi; + if [ -n "${buildCommand:-}" ]; then + eval "$buildCommand"; + return; + fi; + if [ -z "${phases:-}" ]; then + phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}"; + fi; + for curPhase in $phases; + do + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then + continue; + fi; + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then + continue; + fi; + if [[ -n $NIX_LOG_FD ]]; then + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD; + fi; + showPhaseHeader "$curPhase"; + dumpVars; + eval "${!curPhase:-$curPhase}"; + if [ "$curPhase" = unpackPhase ]; then + cd "${sourceRoot:-.}"; + fi; + done +} +getHostRole () +{ + getRole "$hostOffset" +} +getHostRoleEnvHook () +{ + getRole "$depHostOffset" +} +getRole () +{ + case $1 in + -1) + role_pre='BUILD_'; + role_post='_FOR_BUILD' + ;; + 0) + role_pre=''; + role_post='' + ;; + 1) + role_pre='TARGET_'; + role_post='_FOR_TARGET' + ;; + *) + echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; + return 1 + ;; + esac +} +getTargetRole () +{ + getRole "$targetOffset" +} +getTargetRoleEnvHook () +{ + getRole "$depTargetOffset" +} +getTargetRoleWrapper () +{ + case $targetOffset in + -1) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_BUILD=1 + ;; + 0) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 + ;; + 1) + export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_TARGET=1 + ;; + *) + echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; + return 1 + ;; + esac +} +header () +{ + echo "$1" +} +installCheckPhase () +{ + runHook preInstallCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + else + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck}); + echoCmd 'installcheck flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + fi; + runHook postInstallCheck +} +installPhase () +{ + runHook preInstall; + if [ -n "$prefix" ]; then + mkdir -p "$prefix"; + fi; + local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install}); + echoCmd 'install flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + runHook postInstall +} +isELF () +{ + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [ "$magic" = 'ELF' ]; then + return 0; + else + return 1; + fi +} +isScript () +{ + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 2 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" =~ \#! ]]; then + return 0; + else + return 1; + fi +} +mapOffset () +{ + local -ri inputOffset="$1"; + if (( "$inputOffset" <= 0 )); then + local -ri outputOffset="$inputOffset + $hostOffset"; + else + local -ri outputOffset="$inputOffset - 1 + $targetOffset"; + fi; + mapOffsetResult="$outputOffset" +} +moveToOutput () +{ + local patt="$1"; + local dstOut="$2"; + local output; + for output in $outputs; + do + if [ "${!output}" = "$dstOut" ]; then + continue; + fi; + local srcPath; + for srcPath in "${!output}"/$patt; + do + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then + continue; + fi; + if [ "$dstOut" = REMOVE ]; then + echo "Removing $srcPath"; + rm -r "$srcPath"; + else + local dstPath="$dstOut${srcPath#${!output}}"; + echo "Moving $srcPath to $dstPath"; + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then + rmdir "$srcPath" --ignore-fail-on-non-empty; + if [ -d "$srcPath" ]; then + mv -t "$dstPath" "$srcPath"/*; + rmdir "$srcPath"; + fi; + else + mkdir -p "$(readlink -m "$dstPath/..")"; + mv "$srcPath" "$dstPath"; + fi; + fi; + local srcParent="$(readlink -m "$srcPath/..")"; + if rmdir "$srcParent"; then + echo "Removing empty $srcParent/ and (possibly) its parents"; + rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true; + fi; + done; + done +} +patchELF () +{ + local dir="$1"; + [ -e "$dir" ] || return 0; + header "shrinking RPATHs of ELF executables and libraries in $dir"; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if ! isELF "$i"; then + continue; + fi; + echo "shrinking $i"; + patchelf --shrink-rpath "$i" || true; + done < <(find "$dir" -type f -print0); + stopNest +} +patchPhase () +{ + runHook prePatch; + for i in ${patches:-}; + do + header "applying patch $i" 3; + local uncompress=cat; + case "$i" in + *.gz) + uncompress="gzip -d" + ;; + *.bz2) + uncompress="bzip2 -d" + ;; + *.xz) + uncompress="xz -d" + ;; + *.lzma) + uncompress="lzma -d" + ;; + esac; + $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1}; + done; + runHook postPatch +} +patchShebangs () +{ + local pathName; + if [ "$1" = "--host" ]; then + pathName=HOST_PATH; + shift; + else + if [ "$1" = "--build" ]; then + pathName=PATH; + shift; + fi; + fi; + echo "patching script interpreter paths in $@"; + local f; + local oldPath; + local newPath; + local arg0; + local args; + local oldInterpreterLine; + local newInterpreterLine; + if [ $# -eq 0 ]; then + echo "No arguments supplied to patchShebangs" > 0; + return 0; + fi; + local f; + while IFS= read -r -d '' f; do + isScript "$f" || continue; + oldInterpreterLine=$(head -1 "$f" | tail -c+3); + read -r oldPath arg0 args <<< "$oldInterpreterLine"; + if [ -z "$pathName" ]; then + if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then + pathName=HOST_PATH; + else + pathName=PATH; + fi; + fi; + if $(echo "$oldPath" | grep -q "/bin/env$"); then + if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" > 0; + exit 1; + fi; + newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; + else + if [ "$oldPath" = "" ]; then + oldPath="/bin/sh"; + fi; + newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; + args="$arg0 $args"; + fi; + newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"; + if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then + if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; + escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g'); + timestamp=$(mktemp); + touch -r "$f" "$timestamp"; + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; + touch -r "$timestamp" "$f"; + rm "$timestamp"; + fi; + fi; + done < <(find "$@" -type f -perm -0100 -print0); + stopNest +} +patchShebangsAuto () +{ + if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then + if [ "$output" != out ] && [ "$output" = "$outputDev" ]; then + patchShebangs --build "$prefix"; + else + patchShebangs --host "$prefix"; + fi; + fi +} +printLines () +{ + (( "$#" > 0 )) || return 0; + printf '%s\n' "$@" +} +printWords () +{ + (( "$#" > 0 )) || return 0; + printf '%s ' "$@" +} +runHook () +{ + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook; + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _eval "$hook" "$@"; + done; + return 0 +} +runOneHook () +{ + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook ret=1; + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + if _eval "$hook" "$@"; then + ret=0; + break; + fi; + done; + return "$ret" +} +showPhaseHeader () +{ + local phase="$1"; + case "$phase" in + unpackPhase) + header "unpacking sources" + ;; + patchPhase) + header "patching sources" + ;; + configurePhase) + header "configuring" + ;; + buildPhase) + header "building" + ;; + checkPhase) + header "running tests" + ;; + installPhase) + header "installing" + ;; + fixupPhase) + header "post-installation fixup" + ;; + installCheckPhase) + header "running install tests" + ;; + *) + header "$phase" + ;; + esac +} +stopNest () +{ + true +} +stripDirs () +{ + local cmd="$1"; + local dirs="$2"; + local stripFlags="$3"; + local dirsNew=; + local d; + for d in ${dirs}; + do + if [ -d "$prefix/$d" ]; then + dirsNew="${dirsNew} $prefix/$d "; + fi; + done; + dirs=${dirsNew}; + if [ -n "${dirs}" ]; then + header "stripping (with command $cmd and flags $stripFlags) in$dirs"; + find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2> /dev/null || true; + stopNest; + fi +} +stripHash () +{ + local strippedName casematchOpt=0; + strippedName="$(basename -- "$1")"; + shopt -q nocasematch && casematchOpt=1; + shopt -u nocasematch; + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then + echo "${strippedName:33}"; + else + echo "$strippedName"; + fi; + if (( casematchOpt )); then + shopt -s nocasematch; + fi +} +substitute () +{ + local input="$1"; + local output="$2"; + shift 2; + if [ ! -f "$input" ]; then + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; + return 1; + fi; + local content; + consumeEntire content < "$input"; + if [ -e "$output" ]; then + chmod +w "$output"; + fi; + substituteStream content "file '$input'" "$@" > "$output" +} +substituteAll () +{ + local input="$1"; + local output="$2"; + local -a args=(); + _allFlags; + substitute "$input" "$output" "${args[@]}" +} +substituteAllInPlace () +{ + local fileName="$1"; + shift; + substituteAll "$fileName" "$fileName" "$@" +} +substituteAllStream () +{ + local -a args=(); + _allFlags; + substituteStream "$1" "$2" "${args[@]}" +} +substituteInPlace () +{ + local fileName="$1"; + shift; + substitute "$fileName" "$fileName" "$@" +} +substituteStream () +{ + local var=$1; + local description=$2; + shift 2; + while (( "$#" )); do + case "$1" in + --replace) + pattern="$2"; + replacement="$3"; + shift 3; + local savedvar; + savedvar="${!var}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + if [ "$pattern" != "$replacement" ]; then + if [ "${!var}" == "$savedvar" ]; then + echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2; + fi; + fi + ;; + --subst-var) + local varName="$2"; + shift 2; + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then + echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; + return 1; + fi; + if [ -z ${!varName+x} ]; then + echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; + return 1; + fi; + pattern="@$varName@"; + replacement="${!varName}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var-by) + pattern="@$2@"; + replacement="$3"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + shift 3 + ;; + *) + echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; + return 1 + ;; + esac; + done; + printf "%s" "${!var}" +} +unpackFile () +{ + curSrc="$1"; + header "unpacking source archive $curSrc" 3; + if ! runOneHook unpackCmd "$curSrc"; then + echo "do not know how to unpack source archive $curSrc"; + exit 1; + fi +} +unpackPhase () +{ + runHook preUnpack; + if [ -z "${srcs:-}" ]; then + if [ -z "${src:-}" ]; then + echo 'variable $src or $srcs should point to the source'; + exit 1; + fi; + srcs="$src"; + fi; + local dirsBefore=""; + for i in *; + do + if [ -d "$i" ]; then + dirsBefore="$dirsBefore $i "; + fi; + done; + for i in $srcs; + do + unpackFile "$i"; + done; + : ${sourceRoot=}; + if [ -n "${setSourceRoot:-}" ]; then + runOneHook setSourceRoot; + else + if [ -z "$sourceRoot" ]; then + for i in *; + do + if [ -d "$i" ]; then + case $dirsBefore in + *\ $i\ *) + + ;; + *) + if [ -n "$sourceRoot" ]; then + echo "unpacker produced multiple directories"; + exit 1; + fi; + sourceRoot="$i" + ;; + esac; + fi; + done; + fi; + fi; + if [ -z "$sourceRoot" ]; then + echo "unpacker appears to have produced no directories"; + exit 1; + fi; + echo "source root is $sourceRoot"; + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then + chmod -R u+w -- "$sourceRoot"; + fi; + runHook postUnpack +} +updateSourceDateEpoch () +{ + local path="$1"; + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); + local time="${res[0]//\.[0-9]*/}"; + local newestFile="${res[1]}"; + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; + export SOURCE_DATE_EPOCH="$time"; + local now="$(date +%s)"; + if [ "$time" -gt $((now - 60)) ]; then + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; + fi; + fi +} + +export NIX_BUILD_TOP="$(mktemp -d --tmpdir nix-shell.XXXXXX)" +export TMP="$NIX_BUILD_TOP" +export TMPDIR="$NIX_BUILD_TOP" +export TEMP="$NIX_BUILD_TOP" +export TEMPDIR="$NIX_BUILD_TOP" +eval "$shellHook" diff --git a/frontend/elm-stuff/0.19.1/Cart.elmi b/frontend/elm-stuff/0.19.1/Cart.elmi new file mode 100644 index 0000000..60bb740 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Cart.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Cart.elmo b/frontend/elm-stuff/0.19.1/Cart.elmo new file mode 100644 index 0000000..0500a15 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Cart.elmo differ diff --git a/frontend/elm-stuff/0.19.1/Catalog.elmi b/frontend/elm-stuff/0.19.1/Catalog.elmi new file mode 100644 index 0000000..0610f11 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Catalog.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Catalog.elmo b/frontend/elm-stuff/0.19.1/Catalog.elmo new file mode 100644 index 0000000..c5146fc Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Catalog.elmo differ diff --git a/frontend/elm-stuff/0.19.1/Login.elmi b/frontend/elm-stuff/0.19.1/Login.elmi new file mode 100644 index 0000000..75c4629 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Login.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Login.elmo b/frontend/elm-stuff/0.19.1/Login.elmo new file mode 100644 index 0000000..9a173e3 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Login.elmo differ diff --git a/frontend/elm-stuff/0.19.1/Main.elmi b/frontend/elm-stuff/0.19.1/Main.elmi new file mode 100644 index 0000000..295ad17 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Main.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Main.elmo b/frontend/elm-stuff/0.19.1/Main.elmo new file mode 100644 index 0000000..0dc3269 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Main.elmo differ diff --git a/frontend/elm-stuff/0.19.1/Product.elmi b/frontend/elm-stuff/0.19.1/Product.elmi new file mode 100644 index 0000000..396a174 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Product.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Product.elmo b/frontend/elm-stuff/0.19.1/Product.elmo new file mode 100644 index 0000000..c387bed Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Product.elmo differ diff --git a/frontend/elm-stuff/0.19.1/Signup.elmi b/frontend/elm-stuff/0.19.1/Signup.elmi new file mode 100644 index 0000000..190d9de Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Signup.elmi differ diff --git a/frontend/elm-stuff/0.19.1/Signup.elmo b/frontend/elm-stuff/0.19.1/Signup.elmo new file mode 100644 index 0000000..bcdb43d Binary files /dev/null and b/frontend/elm-stuff/0.19.1/Signup.elmo differ diff --git a/frontend/elm-stuff/0.19.1/d.dat b/frontend/elm-stuff/0.19.1/d.dat new file mode 100644 index 0000000..244afff Binary files /dev/null and b/frontend/elm-stuff/0.19.1/d.dat differ diff --git a/frontend/elm-stuff/0.19.1/i.dat b/frontend/elm-stuff/0.19.1/i.dat new file mode 100644 index 0000000..d1d1ac1 Binary files /dev/null and b/frontend/elm-stuff/0.19.1/i.dat differ diff --git a/frontend/elm-stuff/0.19.1/lock b/frontend/elm-stuff/0.19.1/lock new file mode 100644 index 0000000..e69de29 diff --git a/frontend/elm-stuff/0.19.1/o.dat b/frontend/elm-stuff/0.19.1/o.dat new file mode 100644 index 0000000..f25f55b Binary files /dev/null and b/frontend/elm-stuff/0.19.1/o.dat differ diff --git a/frontend/elm.json b/frontend/elm.json new file mode 100644 index 0000000..64ee788 --- /dev/null +++ b/frontend/elm.json @@ -0,0 +1,27 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.1", + "dependencies": { + "direct": { + "elm/browser": "1.0.2", + "elm/core": "1.0.5", + "elm/html": "1.0.0", + "elm/http": "2.0.0", + "elm/json": "1.1.3", + "elm/url": "1.0.0" + }, + "indirect": { + "elm/bytes": "1.0.8", + "elm/file": "1.0.5", + "elm/time": "1.0.0", + "elm/virtual-dom": "1.0.2" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} diff --git a/frontend/src/Cart.elm b/frontend/src/Cart.elm new file mode 100644 index 0000000..a1750f6 --- /dev/null +++ b/frontend/src/Cart.elm @@ -0,0 +1,164 @@ +module Cart exposing (..) + +import Browser +import Browser.Navigation as Nav +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Decode as D +import Json.Encode as Encode +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + +type alias Product = + { id : Int + , name : String + , kind : Maybe String + , price : Float + , description : Maybe String + } + + +type alias Model = + { pageStatus : Status + , products : List Product + } + + +type Status + = Loading + | Loaded + | NotLoaded + + +type Msg + = CartLoaded (Result Http.Error (List Product)) + | FetchCartItems + | RemoveFromCart Int + | CartItemRemoved (Result Http.Error ()) + + +init : Model +init = + Model NotLoaded [] + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + CartLoaded res -> + case res of + Ok s -> + ( { model | products = s, pageStatus = Loaded }, Cmd.none ) + + Err e -> + let + _ = + Debug.log "error" e + in + ( { model | pageStatus = NotLoaded }, Cmd.none ) + + RemoveFromCart id -> + ( model, removeProduct id ) + + CartItemRemoved _ -> + ( { model | pageStatus = Loading }, fetchCartItems ) + + FetchCartItems -> + ( { model | pageStatus = Loading }, fetchCartItems ) + + +decodeProduct : D.Decoder Product +decodeProduct = + D.map5 Product + (D.field "id" D.int) + (D.field "name" D.string) + (D.field "kind" (D.nullable D.string)) + (D.field "price" D.float) + (D.field "description" (D.nullable D.string)) + + +decodeResponse : D.Decoder (List Product) +decodeResponse = + D.list decodeProduct + + +removeProduct : Int -> Cmd Msg +removeProduct id = + let + _ = + Debug.log "cart" "fetching cart items" + in + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/cart/remove" + , body = Http.stringBody "application/json" <| String.fromInt id + , expect = Http.expectWhatever CartItemRemoved + , timeout = Nothing + , tracker = Nothing + } + + +fetchCartItems : Cmd Msg +fetchCartItems = + let + _ = + Debug.log "cart" "fetching cart items" + in + Http.riskyRequest + { method = "GET" + , headers = [] + , url = "http://127.0.0.1:7878/cart/items" + , body = Http.emptyBody + , expect = Http.expectJson CartLoaded decodeResponse + , timeout = Nothing + , tracker = Nothing + } + + +viewStatus : Status -> String +viewStatus s = + case s of + Loading -> + "Loading" + + Loaded -> + "Ready!" + + NotLoaded -> + "Not loaded ..." + + +viewProduct : Product -> Html Msg +viewProduct p = + div [] + [ text p.name + , div [] [ text <| Maybe.withDefault "" p.kind ] + , div [] [ text <| Maybe.withDefault "" p.description ] + , div [] [ text <| String.fromFloat p.price ] + , div [] [ button [ onClick (RemoveFromCart p.id) ] [ text "Remove" ] ] + , div [] [ a [ href ("/product/" ++ String.fromInt p.id) ] [ text "View Product" ] ] + ] + + +view : Model -> Html Msg +view model = + case model.pageStatus of + Loading -> + div [] [ text <| viewStatus Loading ] + + _ -> + div [] + [ let + cart = + List.map viewProduct model.products + in + if List.isEmpty cart then + text "No items in cart" + + else + ul [] cart + ] diff --git a/frontend/src/Catalog.elm b/frontend/src/Catalog.elm new file mode 100644 index 0000000..80e5e38 --- /dev/null +++ b/frontend/src/Catalog.elm @@ -0,0 +1,125 @@ +module Catalog exposing (..) + +import Browser +import Browser.Navigation as Nav +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Decode as D +import Json.Encode as Encode +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + +type alias Product = + { id : Int + , name : String + , kind : Maybe String + , price : Float + , description : Maybe String + } + + +type alias Model = + { pageStatus : Status + , products : List Product + } + + +type Status + = Loading + | Loaded + | NotLoaded + + +type Msg + = ProductsLoaded (Result Http.Error (List Product)) + | FetchProducts + + +init : Model +init = + Model NotLoaded [] + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + ProductsLoaded res -> + case res of + Ok s -> + ( { model | products = s, pageStatus = Loaded }, Cmd.none ) + + Err e -> + let + _ = + Debug.log "error" e + in + ( { model | pageStatus = NotLoaded }, Cmd.none ) + + FetchProducts -> + ( { model | pageStatus = Loading }, fetchProducts ) + + +decodeProduct : D.Decoder Product +decodeProduct = + D.map5 Product + (D.field "id" D.int) + (D.field "name" D.string) + (D.field "kind" (D.nullable D.string)) + (D.field "price" D.float) + (D.field "description" (D.nullable D.string)) + + +decodeResponse : D.Decoder (List Product) +decodeResponse = + D.list decodeProduct + + +fetchProducts : Cmd Msg +fetchProducts = + let + _ = + Debug.log "err" "fetching products" + in + Http.get + { url = "http://127.0.0.1:7878/product/catalog" + , expect = Http.expectJson ProductsLoaded decodeResponse + } + + +viewStatus : Status -> String +viewStatus s = + case s of + Loading -> + "Loading" + + Loaded -> + "Ready!" + + NotLoaded -> + "Not loaded ..." + + +viewProduct : Product -> Html Msg +viewProduct p = + div [] + [ text p.name + , text <| Maybe.withDefault "" p.kind + , text <| Maybe.withDefault "" p.description + , text <| String.fromFloat p.price + , a [ href ("/product/" ++ String.fromInt p.id) ] [ text "View Product" ] + ] + + +view : Model -> Html Msg +view model = + case model.pageStatus of + Loading -> + div [] [ text <| viewStatus Loading ] + + _ -> + div [] + [ ul [] (List.map viewProduct model.products) + ] diff --git a/frontend/src/Login.elm b/frontend/src/Login.elm new file mode 100644 index 0000000..dd168f0 --- /dev/null +++ b/frontend/src/Login.elm @@ -0,0 +1,119 @@ +module Login exposing (..) + +import Browser +import Browser.Navigation as Nav +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Encode as Encode +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + +type alias Model = + { username : String + , password : String + , loginStatus : LoginStatus + } + + +type LoginStatus + = NotLoggedIn + | LoggedIn + | InvalidLogin + | LoggingIn + + +type Msg + = PassEntered String + | UserEntered String + | LoginPressed + | LoginSuccess (Result Http.Error ()) + | LoginFail + + +init : Model +init = + Model "" "" NotLoggedIn + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + PassEntered s -> + ( { model | password = s } + , Cmd.none + ) + + UserEntered s -> + ( { model | username = s } + , Cmd.none + ) + + LoginPressed -> + ( { model | loginStatus = LoggingIn }, tryLogin model ) + + LoginSuccess res -> + case res of + Ok s -> + ( { model | loginStatus = LoggedIn }, Cmd.none ) + + Err e -> + ( { model | loginStatus = InvalidLogin }, Cmd.none ) + + LoginFail -> + ( { model | loginStatus = InvalidLogin }, Cmd.none ) + + +encodeLogin : Model -> Encode.Value +encodeLogin model = + Encode.object + [ ( "username", Encode.string model.username ) + , ( "password", Encode.string model.password ) + ] + + +tryLogin : Model -> Cmd Msg +tryLogin model = + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/user/login" + , body = model |> encodeLogin |> Http.jsonBody + , expect = Http.expectWhatever LoginSuccess + , timeout = Nothing + , tracker = Nothing + } + + +viewStatus : LoginStatus -> String +viewStatus ls = + case ls of + NotLoggedIn -> + "Not Logged In" + + InvalidLogin -> + "Invalid Login" + + LoggedIn -> + "Logged in!" + + LoggingIn -> + "Logging In ..." + + +viewInput : String -> String -> String -> (String -> msg) -> Html msg +viewInput t p v toMsg = + input [ type_ t, placeholder p, value v, onInput toMsg ] [] + + +view : Model -> Html Msg +view model = + div [] + [ div [] [ viewInput "text" "Enter name here" model.username UserEntered ] + , div [] [ viewInput "password" "Password" model.password PassEntered ] + , div [] [ button [ onClick LoginPressed ] [ text "Login" ] ] + , div [] [ text (viewStatus model.loginStatus) ] + , div [] [ text "Don't have an account? ", a [ href "/signup" ] [ text "Register now!" ] ] + ] diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm new file mode 100644 index 0000000..bf1583c --- /dev/null +++ b/frontend/src/Main.elm @@ -0,0 +1,339 @@ +module Main exposing (Model, Msg(..), init, main, subscriptions, update, view, viewLink) + +import Browser +import Browser.Navigation as Nav +import Cart +import Catalog +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Encode as Encode +import Login +import Product +import Signup +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + + +-- MAIN + + +main : Program () Model Msg +main = + Browser.application + { init = init + , view = view + , update = update + , subscriptions = subscriptions + , onUrlChange = UrlChanged + , onUrlRequest = LinkClicked + } + + + +-- MODEL + + +type Route + = LoginPage + | SignupPage + | HomePage + | CatalogPage + | CartPage + | ProductPage Int + | NotFoundPage + + +parseRoute : Parser (Route -> a) a +parseRoute = + oneOf + [ P.map LoginPage (P.s "login") + , P.map HomePage P.top + , P.map CatalogPage (P.s "catalog") + , P.map CartPage (P.s "cart") + , P.map SignupPage (P.s "signup") + , P.map ProductPage (P.s "product" P.int) + + --, P.map ProductPage (P.s "product" int) + ] + + +type alias Model = + { key : Nav.Key + , url : Url.Url + , location : Route + , loginModel : Login.Model + , catalogModel : Catalog.Model + , productModel : Product.Model + , signupModel : Signup.Model + , cartModel : Cart.Model + } + + +init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg ) +init flags url key = + let + start = + HomePage + + login = + Login.init + + catalog = + Catalog.init + + product = + Product.init + + signup = + Signup.init + + cart = + Cart.init + in + ( Model key url start login catalog product signup cart, Cmd.none ) + + + +-- UPDATE + + +type Msg + = LinkClicked Browser.UrlRequest + | UrlChanged Url.Url + | LoginMessage Login.Msg + | CatalogMessage Catalog.Msg + | ProductMessage Product.Msg + | SignupMessage Signup.Msg + | CartMessage Cart.Msg + | LogoutPressed + | LogoutSuccess (Result Http.Error ()) + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + LinkClicked urlRequest -> + case urlRequest of + Browser.Internal url -> + ( model, Nav.pushUrl model.key (Url.toString url) ) + + Browser.External href -> + ( model, Nav.load href ) + + LogoutPressed -> + ( model, tryLogout ) + + LogoutSuccess _ -> + ( model, Nav.replaceUrl model.key "/login" ) + + UrlChanged url -> + let + parsedUrl = + P.parse parseRoute url + in + case parsedUrl of + Just CatalogPage -> + ( { model | location = CatalogPage }, Cmd.map CatalogMessage Catalog.fetchProducts ) + + Just (ProductPage id) -> + let + cmds = + List.map (Cmd.map ProductMessage) + [ Product.fetchListing id + , Product.fetchRatings id + ] + in + ( { model | location = ProductPage id }, Cmd.batch cmds ) + + Just CartPage -> + let + cmd = + Cmd.map CartMessage Cart.fetchCartItems + in + ( { model | location = CartPage }, cmd ) + + Just p -> + ( { model | location = p }, Cmd.none ) + + Nothing -> + ( { model | location = NotFoundPage }, Cmd.none ) + + LoginMessage lm -> + let + ( lmn, cmd ) = + Login.update lm model.loginModel + + redir = + case lmn.loginStatus of + Login.LoggedIn -> + Nav.replaceUrl model.key "/catalog" + + _ -> + Cmd.none + in + ( { model | loginModel = lmn }, Cmd.batch [ Cmd.map LoginMessage cmd, redir ] ) + + SignupMessage sm -> + let + ( smn, cmd ) = + Signup.update sm model.signupModel + + redir = + case smn.status of + Signup.CreatedSuccessfully -> + Nav.replaceUrl model.key "/login" + + _ -> + Cmd.none + in + ( { model | signupModel = smn }, Cmd.batch [ Cmd.map SignupMessage cmd, redir ] ) + + CatalogMessage cm -> + let + ( cmn, cmd ) = + Catalog.update cm model.catalogModel + in + ( { model | catalogModel = cmn }, Cmd.map CatalogMessage cmd ) + + CartMessage cm -> + let + ( cmn, cmd ) = + Cart.update cm model.cartModel + in + ( { model | cartModel = cmn }, Cmd.map CartMessage cmd ) + + ProductMessage pm -> + let + ( pmn, cmd ) = + Product.update pm model.productModel + + redir = + case pm of + Product.AddToCartSuccess _ -> + Nav.replaceUrl model.key "/cart" + + _ -> + Cmd.none + in + ( { model | productModel = pmn }, Cmd.batch [ Cmd.map ProductMessage cmd, redir ] ) + + +tryLogout : Cmd Msg +tryLogout = + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/user/logout" + , body = Http.emptyBody + , expect = Http.expectWhatever LogoutSuccess + , timeout = Nothing + , tracker = Nothing + } + + + +-- SUBSCRIPTIONS + + +subscriptions : Model -> Sub Msg +subscriptions _ = + Sub.none + + + +-- VIEW + + +view : Model -> Browser.Document Msg +view model = + case model.location of + LoginPage -> + { title = "Login" + , body = [ Html.map LoginMessage (Login.view model.loginModel) ] + } + + SignupPage -> + { title = "Signup" + , body = [ Html.map SignupMessage (Signup.view model.signupModel) ] + } + + HomePage -> + { title = "URL Interceptor" + , body = + [ text "The current URL is: " + , b [] [ text (Url.toString model.url) ] + , ul [] + [ viewLink "/login" + , viewLink "/catalog" + , viewLink "/cart" + , viewLink "/signup" + ] + ] + } + + NotFoundPage -> + { title = "404 - Not Found" + , body = + [ text "404 - Not Found" + , a [ href "/" ] [ text "Go back >" ] + ] + } + + CatalogPage -> + { title = "Catalog" + , body = pageWrap model (Html.map CatalogMessage (Catalog.view model.catalogModel)) + } + + CartPage -> + { title = "Cart" + , body = pageWrap model (Html.map CartMessage (Cart.view model.cartModel)) + } + + ProductPage item -> + { title = "Product " ++ String.fromInt item + , body = pageWrap model (Html.map ProductMessage (Product.view model.productModel)) + } + + +viewHeader : Model -> Html Msg +viewHeader model = + let + links = + [ ( "Home", "/" ) + , ( "Catalog", "/catalog" ) + , ( "Cart", "/cart" ) + ] + in + div [] + [ List.map + (\( name, loc ) -> + li [] + [ a [ href loc ] [ text name ] + ] + ) + links + ++ [ if model.loginModel.loginStatus /= Login.LoggedIn then + li [] [ a [ href "/login" ] [ text "Login" ] ] + + else + button [ onClick LogoutPressed ] [ text "Logout" ] + ] + |> ul [] + ] + + +pageWrap : Model -> Html Msg -> List (Html Msg) +pageWrap model page = + [ div [] + [ viewHeader model + , page + ] + ] + + +viewLink : String -> Html msg +viewLink path = + li [] [ a [ href path ] [ text path ] ] diff --git a/frontend/src/Product.elm b/frontend/src/Product.elm new file mode 100644 index 0000000..0ea0ce1 --- /dev/null +++ b/frontend/src/Product.elm @@ -0,0 +1,302 @@ +module Product exposing (..) + +import Browser +import Browser.Navigation as Nav +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Decode as D +import Json.Encode as Encode +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + +type SubmitStatus + = SubmitSuccess + | SubmitFail + | Submitting + | NotSubmitted + + +type alias Product = + { id : Int + , name : String + , kind : Maybe String + , price : Float + , description : Maybe String + } + + +emptyProduct = + Product -1 "" Nothing 0 Nothing + + +type alias Rating = + { commentDate : String + , commentText : Maybe String + , customerName : String + , productName : String + , stars : Int + } + + +type alias Model = + { pageStatus : Status + , listing : Product + , ratings : List Rating + , ratingStars : Int + , ratingText : String + , addRatingStatus : SubmitStatus + } + + +type Status + = Loading + | Loaded + | NotLoaded + + +type Msg + = ListingLoaded (Result Http.Error Product) + | RatingsLoaded (Result Http.Error (List Rating)) + | FetchProduct Int + | FetchRatings Int + | AddRatingStars Int + | AddRatingComment String + | AddRatingPressed + | AddRatingSuccess (Result Http.Error ()) + | AddRatingFail + | AddToCartSuccess (Result Http.Error ()) + | AddToCartPressed + + +init : Model +init = + Model NotLoaded emptyProduct [] 0 "" NotSubmitted + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + ListingLoaded res -> + case res of + Ok s -> + ( { model | listing = s, pageStatus = Loaded }, Cmd.none ) + + Err e -> + let + _ = + Debug.log "error" e + in + ( { model | pageStatus = NotLoaded }, Cmd.none ) + + RatingsLoaded res -> + case res of + Ok s -> + ( { model | ratings = s, pageStatus = Loaded }, Cmd.none ) + + Err e -> + let + _ = + Debug.log "error" e + in + ( { model | pageStatus = NotLoaded }, Cmd.none ) + + FetchProduct id -> + ( { model | pageStatus = Loading }, fetchListing id ) + + FetchRatings id -> + ( { model | pageStatus = Loading }, fetchRatings id ) + + AddRatingStars i -> + ( { model | ratingStars = i }, Cmd.none ) + + AddRatingComment s -> + ( { model | ratingText = s }, Cmd.none ) + + AddRatingPressed -> + ( { model | addRatingStatus = Submitting } + , submitRating model + ) + + AddRatingSuccess res -> + case res of + Ok _ -> + ( { model | addRatingStatus = SubmitSuccess }, fetchRatings model.listing.id ) + + Err _ -> + ( { model | addRatingStatus = SubmitFail }, Cmd.none ) + + AddRatingFail -> + ( { model | addRatingStatus = SubmitFail }, Cmd.none ) + + AddToCartPressed -> + ( model, addToCart model ) + + AddToCartSuccess _ -> + ( model, Cmd.none ) + + +decodeProduct : D.Decoder Product +decodeProduct = + D.map5 Product + (D.field "id" D.int) + (D.field "name" D.string) + (D.field "kind" (D.nullable D.string)) + (D.field "price" D.float) + (D.field "description" (D.nullable D.string)) + + +decodeRating : D.Decoder Rating +decodeRating = + D.map5 Rating + (D.field "comment_date" D.string) + (D.field "comment_text" (D.nullable D.string)) + (D.field "customer_name" D.string) + (D.field "product_name" D.string) + (D.field "stars" D.int) + + +decodeRatings : D.Decoder (List Rating) +decodeRatings = + D.list decodeRating + + +fetchListing : Int -> Cmd Msg +fetchListing id = + let + _ = + Debug.log "err" <| "fetching listing " ++ String.fromInt id + in + Http.get + { url = "http://127.0.0.1:7878/product/" ++ String.fromInt id + , expect = Http.expectJson ListingLoaded decodeProduct + } + + +fetchRatings : Int -> Cmd Msg +fetchRatings id = + let + _ = + Debug.log "err" <| "fetching ratings " ++ String.fromInt id + in + Http.get + { url = "http://127.0.0.1:7878/product/reviews/" ++ String.fromInt id + , expect = Http.expectJson RatingsLoaded decodeRatings + } + + +encodeRatingForm : Model -> Encode.Value +encodeRatingForm model = + Encode.object + [ ( "product_id", Encode.int model.listing.id ) + , ( "stars", Encode.int model.ratingStars ) + , ( "comment_text", Encode.string model.ratingText ) + ] + + +submitRating : Model -> Cmd Msg +submitRating model = + let + _ = + Debug.log "err" <| "submitting rating for" ++ String.fromInt model.listing.id + in + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/rating/add" + , body = model |> encodeRatingForm |> Http.jsonBody + , expect = Http.expectWhatever AddRatingSuccess + , timeout = Nothing + , tracker = Nothing + } + + +addToCart : Model -> Cmd Msg +addToCart model = + let + _ = + Debug.log "err" <| "adding to cart: " ++ String.fromInt model.listing.id + in + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/cart/add" + , body = Http.stringBody "applcation/json" <| String.fromInt <| model.listing.id + , expect = Http.expectWhatever AddToCartSuccess + , timeout = Nothing + , tracker = Nothing + } + + +viewStatus : Status -> String +viewStatus s = + case s of + Loading -> + "Loading" + + Loaded -> + "Ready!" + + NotLoaded -> + "Not loaded ..." + + +viewProduct : Product -> Html Msg +viewProduct p = + div [] + [ text p.name + , text <| Maybe.withDefault "" p.kind + , text <| Maybe.withDefault "" p.description + , text <| String.fromFloat p.price + ] + + +viewRating : Rating -> Html Msg +viewRating r = + div [] + [ text <| r.customerName ++ " posted on " + , text <| r.commentDate ++ " " + , text <| Maybe.withDefault "" r.commentText + , text <| " Stars: " ++ String.fromInt r.stars + ] + + +viewInput : String -> String -> String -> (String -> msg) -> Html msg +viewInput t p v toMsg = + input [ type_ t, placeholder p, value v, onInput toMsg ] [] + + +viewStars : Html Msg +viewStars = + ul [] + (List.map + (\i -> button [ onClick (AddRatingStars i) ] [ text <| String.fromInt i ]) + [ 0, 1, 2, 3, 4, 5 ] + ) + + +view : Model -> Html Msg +view model = + case model.pageStatus of + Loading -> + div [] [ text <| viewStatus Loading ] + + _ -> + div [] + [ div [] [ viewProduct model.listing ] + , ul [] (List.map viewRating model.ratings) + , div [] [ text "Add Rating: " ] + , div [] + [ viewStars + , viewInput "text" "Enter Comment Text" model.ratingText AddRatingComment + , button [ onClick AddRatingPressed ] [ text "Submit Rating" ] + ] + , div [] + [ button [ onClick AddToCartPressed ] [ text "Add To Cart" ] + ] + , div [] + [ a [ href "/catalog" ] [ text "Back to catalog" ] + ] + ] diff --git a/frontend/src/Signup.elm b/frontend/src/Signup.elm new file mode 100644 index 0000000..6395b57 --- /dev/null +++ b/frontend/src/Signup.elm @@ -0,0 +1,194 @@ +module Signup exposing (..) + +import Browser +import Browser.Navigation as Nav +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Http +import Json.Encode as Encode +import Url +import Url.Parser as P exposing ((), Parser, int, oneOf, s, string) + + +type alias Model = + { username : String + , password : String + , phoneNumber : String + , emailId : String + , address : Maybe String + , status : Status + } + + +type Status + = UsernameTaken + | InvalidPhone + | InvalidEmail + | CreatedSuccessfully + | CreatingUser + | Empty + + +type Msg + = UserEntered String + | PassEntered String + | PhoneEntered String + | EmailEntered String + | AddressEntered String + | CreatePressed + | CreationSuccess (Result Http.Error ()) + | UsernameExists (Result Http.Error String) + | CreationFail + + +init : Model +init = + Model "" "" "" "" Nothing Empty + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + UserEntered s -> + ( { model | username = s } + , Cmd.none + ) + + PassEntered s -> + ( { model | password = s } + , Cmd.none + ) + + PhoneEntered s -> + let + status = + if String.length s /= 10 || (List.all (not << Char.isDigit) <| String.toList s) then + InvalidPhone + + else + Empty + in + ( { model | phoneNumber = s, status = status } + , Cmd.none + ) + + EmailEntered s -> + let + status = + if not <| String.contains "@" s then + InvalidEmail + + else + Empty + in + ( { model | emailId = s, status = status } + , Cmd.none + ) + + AddressEntered s -> + ( { model | address = Just s } + , Cmd.none + ) + + CreatePressed -> + ( { model | status = CreatingUser }, checkExists model ) + + CreationSuccess res -> + case res of + Ok _ -> + ( { model | status = CreatedSuccessfully }, Cmd.none ) + + Err _ -> + ( model, Cmd.none ) + + CreationFail -> + ( init, Cmd.none ) + + UsernameExists res -> + case res of + Ok "true" -> + ( { model | status = UsernameTaken }, Cmd.none ) + + Ok "false" -> + let + _ = + Debug.log "signup" "Hit create user ..." + in + ( { model | status = CreatingUser }, createUser model ) + + _ -> + ( model, Cmd.none ) + + +encodeCreateUser : Model -> Encode.Value +encodeCreateUser model = + Encode.object + [ ( "username", Encode.string model.username ) + , ( "password", Encode.string model.password ) + , ( "phone_number", Encode.string model.phoneNumber ) + , ( "email_id", Encode.string model.emailId ) + , ( "address", Encode.string <| Maybe.withDefault "" model.address ) + ] + + +checkExists : Model -> Cmd Msg +checkExists model = + Http.post + { url = "http://127.0.0.1:7878/user/existing" + , body = Http.stringBody "application/json" model.username + , expect = Http.expectString UsernameExists + } + + +createUser : Model -> Cmd Msg +createUser model = + Http.riskyRequest + { method = "POST" + , headers = [] + , url = "http://127.0.0.1:7878/user/new" + , body = model |> encodeCreateUser |> Http.jsonBody + , expect = Http.expectWhatever CreationSuccess + , timeout = Nothing + , tracker = Nothing + } + + +viewStatus : Status -> String +viewStatus s = + case s of + UsernameTaken -> + "This username is taken!" + + InvalidPhone -> + "Invalid phone number!" + + InvalidEmail -> + "Invalid email address!" + + CreatedSuccessfully -> + "User created successfully" + + CreatingUser -> + "Creating user ..." + + Empty -> + "" + + +viewInput : String -> String -> String -> (String -> msg) -> Html msg +viewInput t p v toMsg = + input [ type_ t, placeholder p, value v, onInput toMsg ] [] + + +view : Model -> Html Msg +view model = + div [] + [ viewInput "text" "Enter Username" model.username UserEntered + , viewInput "password" "Password" model.password PassEntered + , viewInput "text" "Email" model.emailId EmailEntered + , viewInput "text" "Enter your Phone number" model.phoneNumber PhoneEntered + , viewInput "text" "Enter Shipping address" (Maybe.withDefault "" model.address) AddressEntered + , button [ onClick CreatePressed ] [ text "Create" ] + , text (viewStatus model.status) + ] diff --git a/migrations/.gitkeep b/migrations/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/migrations/2020-09-22-104623_create_users/down.sql b/migrations/2020-09-22-104623_create_users/down.sql deleted file mode 100644 index 2c92cb7..0000000 --- a/migrations/2020-09-22-104623_create_users/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -DROP TABLE members; diff --git a/migrations/2020-09-22-104623_create_users/up.sql b/migrations/2020-09-22-104623_create_users/up.sql deleted file mode 100644 index dfd27d9..0000000 --- a/migrations/2020-09-22-104623_create_users/up.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Your SQL goes here -CREATE TABLE members ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - username VARCHAR(255) NOT NULL UNIQUE, - password VARCHAR(255) NOT NULL, - phone_number VARCHAR(10) NOT NULL, - email_id VARCHAR(255) NOT NULL -) diff --git a/migrations/2020-11-16-133516_create_products_table/down.sql b/migrations/2020-11-16-133516_create_products_table/down.sql deleted file mode 100644 index 7d99a98..0000000 --- a/migrations/2020-11-16-133516_create_products_table/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -DROP TABLE product; diff --git a/migrations/2020-11-16-133516_create_products_table/up.sql b/migrations/2020-11-16-133516_create_products_table/up.sql deleted file mode 100644 index 829c5be..0000000 --- a/migrations/2020-11-16-133516_create_products_table/up.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Your SQL goes here -CREATE TABLE product ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - kind VARCHAR(255), - price FLOAT NOT NULL, - description VARCHAR(255) -) diff --git a/migrations/2020-12-13-140215_all_tables/down.sql b/migrations/2020-12-13-140215_all_tables/down.sql deleted file mode 100644 index 9c554a2..0000000 --- a/migrations/2020-12-13-140215_all_tables/down.sql +++ /dev/null @@ -1,11 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table customer; - -drop table product; - -drop table cart_items; - -drop table rating; - -drop table transaction; diff --git a/migrations/2020-12-13-140215_all_tables/up.sql b/migrations/2020-12-13-140215_all_tables/up.sql deleted file mode 100644 index 527b926..0000000 --- a/migrations/2020-12-13-140215_all_tables/up.sql +++ /dev/null @@ -1,47 +0,0 @@ --- Your SQL goes here - -create table customer ( - id integer primary key auto_increment, - username varchar(255) not null unique, - password varchar(255) not null, - phone_number varchar(10) not null, - email_id varchar(255) not null, - address text(500) -); - -create table product ( - id integer primary key auto_increment, - name varchar(255) not null, - kind varchar(255), - price float not null, - description varchar(255) -); - -create table cart_items ( - cart_id integer, - product_id integer, - constraint cart_items_pk primary key (cart_id, product_id), - foreign key (cart_id) references customer(id), - foreign key (product_id) references product(id) -); - -create table rating ( - id integer primary key auto_increment, - comment_text text(500), - comment_date date default curdate(), - product_id integer, - customer_id integer, - - stars integer check (stars >= 0 AND stars <= 5), - foreign key (customer_id) references customer(id), - foreign key (product_id) references product(id) -); - -create table transaction ( - id integer primary key auto_increment, - payment_type varchar(255) not null, - amount float not null, - customer_id integer, - - foreign key (customer_id) references customer(id) -); diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index e2299f7..0000000 --- a/nix/sources.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "naersk": { - "branch": "master", - "description": "Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly.", - "homepage": "", - "owner": "nmattia", - "repo": "naersk", - "rev": "529e910a3f423a8211f8739290014b754b2555b6", - "sha256": "0bcy9nmyaan5jvp0wg80wkizc9j166ns685rdr1kbhkvdpywv46y", - "type": "tarball", - "url": "https://github.com/nmattia/naersk/archive/529e910a3f423a8211f8739290014b754b2555b6.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "niv": { - "branch": "master", - "description": "Easy dependency management for Nix projects", - "homepage": "https://github.com/nmattia/niv", - "owner": "nmattia", - "repo": "niv", - "rev": "29ddaaf4e099c3ac0647f5b652469dfc79cd3b53", - "sha256": "1va6myp07gkspgxfch8z3rs9nyvys6jmgzkys6a2c4j09qxp1bs0", - "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/29ddaaf4e099c3ac0647f5b652469dfc79cd3b53.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs": { - "branch": "release-20.03", - "description": "Nix Packages collection", - "homepage": null, - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "13a15f262a2b348d6aa976017f2cd88e3a18405d", - "sha256": "1xcfwqhvs8ai45dahlmqvvkhjf0gdk7nlnxrf7wvmzc50l90akgn", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/13a15f262a2b348d6aa976017f2cd88e3a18405d.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs-mozilla": { - "branch": "master", - "description": "mozilla related nixpkgs (extends nixos/nixpkgs repo)", - "homepage": null, - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "efda5b357451dbb0431f983cca679ae3cd9b9829", - "sha256": "11wqrg86g3qva67vnk81ynvqyfj0zxk83cbrf0p9hsvxiwxs8469", - "type": "tarball", - "url": "https://github.com/mozilla/nixpkgs-mozilla/archive/efda5b357451dbb0431f983cca679ae3cd9b9829.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index b64b8f8..0000000 --- a/nix/sources.nix +++ /dev/null @@ -1,148 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: spec: - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; } - else - pkgs.fetchurl { inherit (spec) url sha256; }; - - fetch_tarball = pkgs: name: spec: - let - ok = str: ! builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str); - # sanitize the name, though nix will still fail if name starts with period - name' = stringAsChars (x: if ! ok x then "-" else x) "${name}-src"; - in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; - - fetch_git = spec: - builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; - - fetch_local = spec: spec.path; - - fetch_builtin-tarball = name: throw - ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=tarball -a builtin=true''; - - fetch_builtin-url = name: throw - ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=file -a builtin=true''; - - # - # Various helpers - # - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: - let - sourcesNixpkgs = - import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {}; - hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; - hasThisAsNixpkgsPath = == ./.; - in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if ! builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file pkgs spec - else if spec.type == "tarball" then fetch_tarball pkgs name spec - else if spec.type == "git" then fetch_git spec - else if spec.type == "local" then fetch_local spec - else if spec.type == "builtin-tarball" then fetch_builtin-tarball name - else if spec.type == "builtin-url" then fetch_builtin-url name - else - abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # If the environment variable NIV_OVERRIDE_${name} is set, then use - # the path directly as opposed to the fetched source. - replace = name: drv: - let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; - ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; - in - if ersatz == "" then drv else ersatz; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or ( - f: set: with builtins; - listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) - ); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 - stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 - stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatStrings = builtins.concatStringsSep ""; - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, name, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchTarball; - in - if lessThan nixVersion "1.12" then - fetchTarball { inherit name url; } - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchurl; - in - if lessThan nixVersion "1.12" then - fetchurl { inherit url; } - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; - - # The "config" used by the fetchers - mkConfig = - { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) - , pkgs ? mkPkgs sources - }: rec { - # The sources, i.e. the attribute set of spec name to spec - inherit sources; - - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - inherit pkgs; - }; - -in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index be4296e..0000000 --- a/rustfmt.toml +++ /dev/null @@ -1,15 +0,0 @@ -max_width = 80 -hard_tabs = false -tab_spaces = 4 -newline_style = "Auto" -use_small_heuristics = "Default" -reorder_imports = true -reorder_modules = true -remove_nested_parens = true -fn_args_layout = "Tall" -edition = "2018" -merge_derives = true -use_try_shorthand = false -use_field_init_shorthand = false -force_explicit_abi = true - diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 9167821..0000000 --- a/shell.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs ? import {} }: - -let - sources = import ./nix/sources.nix; - nixpkgs-mozilla = import sources.nixpkgs-mozilla; - pkgs = import sources.nixpkgs { - overlays = - [ - nixpkgs-mozilla - (self: super: - { - rustc = self.latest.rustChannels.stable.rust; - cargo = self.latest.rustChannels.stable.rust; - } - ) - ]; - }; -in - pkgs.mkShell { - buildInputs = with pkgs; [ - cargo - rustc - rustfmt - pkg-config - openssl - httpie - curl - diesel-cli - libmysqlclient - jq - python3 - insomnia - ]; - } diff --git a/src/bin/server.rs b/src/bin/server.rs deleted file mode 100644 index 7c67e4f..0000000 --- a/src/bin/server.rs +++ /dev/null @@ -1,94 +0,0 @@ -use actix_cors::Cors; -use actix_identity::{CookieIdentityPolicy, IdentityService}; -use actix_web::middleware; -use actix_web::{web, App, HttpServer}; -use diesel::r2d2::{ConnectionManager, Pool}; -use diesel::MysqlConnection; -use furby::handlers::smoke::manual_hello; -use furby::handlers::{cart_items, product, rating, users}; -use rand::Rng; - -#[actix_web::main] -async fn main() -> std::io::Result<()> { - pretty_env_logger::init(); - - let db_url = env!("DATABASE_URL"); - let manager = ConnectionManager::::new(db_url); - let pool = Pool::builder() - .build(manager) - .expect("Failed to create pool."); - - let private_key = rand::thread_rng().gen::<[u8; 32]>(); - HttpServer::new(move || { - App::new() - .wrap(IdentityService::new( - CookieIdentityPolicy::new(&private_key) - .name("user-login") - .domain("127.0.0.1") - .path("/") - .same_site(actix_web::cookie::SameSite::None) - .http_only(true) - .secure(false), - )) - .wrap( - Cors::default() - .allowed_origin("http://127.0.0.1:8000") - .allowed_origin("http://localhost:8000") - .allow_any_method() - .allow_any_header(), - ) - .wrap( - middleware::DefaultHeaders::new() - .header("Access-Control-Allow-Credentials", "true") - .header("Access-Control-Expose-Headers", "set-cookie"), - ) - .wrap(middleware::Logger::default()) - .data(pool.clone()) - .service( - web::scope("/user") - .route("/existing", web::post().to(users::name_exists)) - .route("/login", web::post().to(users::login)) - .route("/{uname}", web::get().to(users::user_details)) - .route("/new", web::post().to(users::new_user)) - .route( - "/change_password", - web::post().to(users::change_password), - ), - ) - .service( - web::scope("/product") - .route("/catalog", web::get().to(product::get_all_products)) - .route("/new", web::post().to(product::new_product)) - .route("/{id}", web::get().to(product::product_details)) - .route( - "/reviews/{id}", - web::get().to(product::get_product_reviews), - ) - .route( - "/update_product/{id}", - web::post().to(product::update_product), - ), - ) - .service( - web::scope("/cart") - .route( - "/items", - web::get().to(cart_items::get_user_cart_items), - ) - .route("/add", web::post().to(cart_items::add_to_cart)) - .route( - "/remove", - web::post().to(cart_items::remove_from_cart), - ), - ) - .service( - web::scope("/rating") - .route("/add", web::post().to(rating::add_rating)) - .route("/remove", web::post().to(rating::remove_rating)), - ) - .route("/hey", web::get().to(manual_hello)) - }) - .bind("127.0.0.1:7878")? - .run() - .await -} diff --git a/src/handlers/cart_items.rs b/src/handlers/cart_items.rs deleted file mode 100644 index 25baaeb..0000000 --- a/src/handlers/cart_items.rs +++ /dev/null @@ -1,107 +0,0 @@ -use crate::models::{AddCartItem, CartItem, Customer, Product}; -use crate::schema::product::dsl as prod; -use crate::schema::{cart_items::dsl::*, customer::dsl::*}; -use crate::TPool; - -use actix_identity::Identity; -use actix_web::{web, HttpResponse, Responder}; -use diesel::prelude::*; -use log::{error, info}; -use serde::Deserialize; - -pub async fn add_to_cart( - cookie: Identity, - item_id: String, - pool: web::Data, -) -> impl Responder { - let item_details = item_id.parse::().unwrap_or(-1); - info!("Add to cart hit: {:?}", item_details); - info!("[cart] Current user: {:?}", cookie.identity()); - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - let new_cart_item = AddCartItem { - cart_id: selected_user.id, - product_id: item_details, - }; - info!( - "cart id: {:?}, product id {:?}", - selected_user.id, item_details - ); - diesel::insert_into(cart_items) - .values((cart_id.eq(selected_user.id), product_id.eq(item_details))) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Inserted successfully!") - } else { - error!("Unauthorized add to cart action!"); - return HttpResponse::Unauthorized() - .body("Need to be logged in to add to cart!"); - } -} - -pub async fn remove_from_cart( - cookie: Identity, - item_id: String, - pool: web::Data, -) -> impl Responder { - info!("Remove from cart hit: {:?}", item_id); - let item_details = item_id.parse::().unwrap_or(-1); - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - - diesel::delete( - cart_items - .filter(cart_id.eq(selected_user.id)) - .filter(product_id.eq(item_details)), - ) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Removed successfully!") - } else { - error!("Unauthorized add to cart action!"); - return HttpResponse::Unauthorized() - .body("Need to be logged in to add to cart!"); - } -} - -pub async fn get_user_cart_items( - cookie: Identity, - pool: web::Data, -) -> impl Responder { - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - let user_cart_items = cart_items - .filter(cart_id.eq(selected_user.id)) - .load::(&conn) - .expect("Couldn't connect to DB"); - let cart_products = user_cart_items - .into_iter() - .map(|item| { - prod::product - .filter(prod::id.eq(item.product_id)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to db") - }) - .collect::>(); - return HttpResponse::Ok().json(&cart_products); - } else { - return HttpResponse::Unauthorized() - .body("Need to be logged in to add to cart!"); - } -} diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs deleted file mode 100644 index 9416857..0000000 --- a/src/handlers/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod cart_items; -pub mod product; -pub mod rating; -pub mod smoke; -pub mod users; diff --git a/src/handlers/product.rs b/src/handlers/product.rs deleted file mode 100644 index 41a47a0..0000000 --- a/src/handlers/product.rs +++ /dev/null @@ -1,138 +0,0 @@ -use crate::models::{Customer, NewProduct, Product, Rating, UpdateProduct}; -use crate::schema::customer::dsl as cust; -use crate::schema::product::dsl::*; -use crate::schema::rating::dsl as rating; -use crate::TPool; - -use actix_web::{web, HttpResponse, Responder}; -use chrono::naive::NaiveDate; -use diesel::prelude::*; -use log::{error, info}; -use serde::{Deserialize, Serialize}; - -pub async fn new_product( - pool: web::Data, - item: web::Json, -) -> impl Responder { - info!("New product hit: {:?}", item.name); - let conn = pool.get().unwrap(); - diesel::insert_into(product) - .values(item.into_inner()) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Inserted successfully!") -} - -pub async fn product_details( - pool: web::Data, - product_id: web::Path, -) -> impl Responder { - let conn = pool.get().unwrap(); - let product_id = product_id.into_inner(); - info!("Fetching product details for {}", product_id); - let selected_product = product - .filter(id.eq(&product_id)) - .limit(1) - .first::(&conn); - match selected_product { - Ok(m) => { - info!("Found product: {}", product_id); - HttpResponse::Ok().json(m) - } - Err(_) => { - error!("Product not found: {}", product_id); - HttpResponse::NotFound().finish() - } - } -} - -pub async fn update_product( - pool: web::Data, - product_id: web::Path, - product_details: web::Json, -) -> impl Responder { - let conn = pool.get().unwrap(); - let product_id = product_id.into_inner(); - let product_details = product_details.into_inner(); - info!("Updating product: {:?}", product_id); - match diesel::update(product.filter(id.eq(product_id))) - .set(( - name.eq(product_details.name), - kind.eq(product_details.kind), - price.eq(product_details.price), - description.eq(product_details.description), - )) - .execute(&conn) - { - Ok(_) => { - return HttpResponse::Ok().body("Changed product successfully") - } - _ => { - return HttpResponse::InternalServerError() - .body("Unable to update record") - } - } -} - -pub async fn get_all_products(pool: web::Data) -> impl Responder { - let conn = pool.get().unwrap(); - info!("Generating and returning catalog ..."); - match product.load::(&conn) { - Ok(products) => return HttpResponse::Ok().json(&products), - Err(_) => { - return HttpResponse::InternalServerError() - .body("Unable to fetch product catalog") - } - } -} - -#[derive(Serialize, Deserialize, Debug)] -struct ProductRating { - pub comment_text: Option, - pub comment_date: NaiveDate, - pub product_name: String, - pub customer_name: String, - pub stars: Option, -} - -pub async fn get_product_reviews( - pool: web::Data, - product_id: web::Path, -) -> impl Responder { - let conn = pool.get().unwrap(); - info!("Fetching product reviews for {}", product_id); - let pid = product_id.into_inner(); - let rating_entries = rating::rating - .filter(rating::product_id.eq(pid)) - .load::(&conn) - .expect("Couldn't connect to DB"); - let json_ratings = rating_entries - .into_iter() - .map(move |p| { - let selected_product = product - .filter(id.eq(&p.product_id.unwrap())) - .limit(1) - .first::(&conn) - .unwrap() - .name - .clone(); - - let selected_customer = cust::customer - .filter(cust::id.eq(&p.customer_id.unwrap())) - .limit(1) - .first::(&conn) - .unwrap() - .username - .clone(); - - ProductRating { - comment_text: p.comment_text, - comment_date: p.comment_date.unwrap(), - product_name: selected_product, - customer_name: selected_customer, - stars: p.stars, - } - }) - .collect::>(); - return HttpResponse::Ok().json(&json_ratings); -} diff --git a/src/handlers/rating.rs b/src/handlers/rating.rs deleted file mode 100644 index dfbeb3e..0000000 --- a/src/handlers/rating.rs +++ /dev/null @@ -1,91 +0,0 @@ -use crate::models::{AddRating, Customer, Rating}; -use crate::schema::rating::dsl as rating; -use crate::schema::{customer::dsl::*, product::dsl::*}; -use crate::TPool; - -use actix_identity::Identity; -use actix_web::{web, HttpResponse, Responder}; -use diesel::prelude::*; -use log::{error, info}; -use serde::Deserialize; - -#[derive(Deserialize, Debug)] -pub struct AddRatingJson { - pub comment_text: Option, - pub stars: Option, - pub product_id: i32, -} - -pub async fn add_rating( - cookie: Identity, - rating_details: web::Json, - pool: web::Data, -) -> impl Responder { - info!("Add rating hit: {:?}", rating_details.product_id); - info!("{:?}", cookie.identity()); - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - let rating_details = rating_details.into_inner(); - let new_rating = AddRating { - comment_text: rating_details.comment_text, - stars: rating_details.stars, - product_id: rating_details.product_id, - customer_id: selected_user.id, - }; - diesel::insert_into(rating::rating) - .values(new_rating) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Inserted rating successfully!") - } else { - error!("Unauthorized add rating action!"); - return HttpResponse::Unauthorized() - .body("Need to be logged in to add rating!"); - } -} - -#[derive(Deserialize, Debug)] -pub struct RemoveRating { - rating_id: i32, -} - -pub async fn remove_rating( - cookie: Identity, - rating_details: web::Json, - pool: web::Data, -) -> impl Responder { - info!("Remove rating hit: {:?}", rating_details.rating_id); - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - - diesel::delete( - rating::rating - .filter(rating::customer_id.eq(selected_user.id)) - .filter(rating::id.eq(rating_details.rating_id)), - ) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Removed successfully!") - } else { - error!("Unauthorized add to cart action!"); - return HttpResponse::Unauthorized() - .body("Need to be logged in to add to cart!"); - } -} - -// pub async fn get_product_reviews( -// product: web::Json, -// pool: web::Data, -// ) -> impl Responder { -// unimplemented!() -// } diff --git a/src/handlers/smoke.rs b/src/handlers/smoke.rs deleted file mode 100644 index d0a1038..0000000 --- a/src/handlers/smoke.rs +++ /dev/null @@ -1,15 +0,0 @@ -use actix_web::{get, post, HttpResponse, Responder}; - -#[get("/")] -async fn hello() -> impl Responder { - HttpResponse::Ok().body("Hello world!") -} - -#[post("/echo")] -async fn echo(req_body: String) -> impl Responder { - HttpResponse::Ok().body(req_body) -} - -pub async fn manual_hello() -> impl Responder { - HttpResponse::Ok().body("Hey there!") -} diff --git a/src/handlers/users.rs b/src/handlers/users.rs deleted file mode 100644 index 24fb591..0000000 --- a/src/handlers/users.rs +++ /dev/null @@ -1,148 +0,0 @@ -use crate::models::{Customer, NewCustomer}; -use crate::schema::customer::dsl::*; -use crate::TPool; - -use actix_identity::Identity; -use actix_web::{web, HttpResponse, Responder}; -use bcrypt::{hash, verify, DEFAULT_COST}; -use diesel::prelude::*; -use log::{error, info}; -use serde::Deserialize; - -pub async fn new_user( - pool: web::Data, - item: web::Json, -) -> impl Responder { - info!("Creating ... {:?}", item.username); - let conn = pool.get().unwrap(); - let hashed_item = NewCustomer { - password: hash(&item.password, DEFAULT_COST).unwrap(), - ..(item.into_inner()) - }; - diesel::insert_into(customer) - .values(hashed_item) - .execute(&conn) - .expect("Coundn't connect to DB"); - HttpResponse::Ok().body("Inserted successfully!") -} - -pub async fn name_exists( - pool: web::Data, - item: String, -) -> impl Responder { - let conn = pool.get().unwrap(); - info!("target: {:?}", item); - if (customer - .filter(username.eq(&item)) - .limit(1) - .load::(&conn) - .expect("Coundn't connect to DB")) - .len() - > 0 - { - HttpResponse::Ok().body("true") - } else { - HttpResponse::Ok().body("false") - } -} - -#[derive(Deserialize)] -pub struct Login { - username: String, - password: String, -} - -pub async fn login( - pool: web::Data, - cookie: Identity, - login_details: web::Json, -) -> impl Responder { - info!("Login hit"); - if let Some(uname) = cookie.identity() { - info!("Found existing cookie: {:?}", cookie.identity()); - return HttpResponse::Ok().finish(); - } - let conn = pool.get().unwrap(); - let entered_pass = &login_details.password; - let selected_user = customer - .filter(username.eq(&login_details.username)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - let hashed_pass = selected_user.password; - if verify(entered_pass, &hashed_pass).unwrap() { - cookie.remember(login_details.username.clone()); - info!( - "Successful login: {} {}", - selected_user.username, selected_user.email_id - ); - HttpResponse::Ok().finish() - } else { - HttpResponse::Unauthorized().finish() - } -} - -pub async fn logout(cookie: Identity) -> impl Responder { - cookie.forget(); - HttpResponse::Found().header("location", "/").finish() -} - -pub async fn user_details( - uname: web::Path, - pool: web::Data, -) -> impl Responder { - let conn = pool.get().unwrap(); - let uname = uname.into_inner(); - info!("Fetching info for: \"{}\"", uname); - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn); - match selected_user { - Ok(m) => { - info!("Found user: {}", uname); - HttpResponse::Ok().json(m) - } - Err(_) => { - error!("User not found: {}", uname); - HttpResponse::NotFound().finish() - } - } -} - -#[derive(Deserialize, Debug)] -pub struct ChangePassword { - old_password: String, - new_password: String, -} - -pub async fn change_password( - cookie: Identity, - password_details: web::Json, - pool: web::Data, -) -> impl Responder { - info!("Change password request: {:?}", password_details); - let conn = pool.get().unwrap(); - if let Some(uname) = cookie.identity() { - let entered_pass = &password_details.old_password; - let new_password = &password_details.new_password; - let selected_user = customer - .filter(username.eq(&uname)) - .limit(1) - .first::(&conn) - .expect("Couldn't connect to DB"); - let hashed_pass = selected_user.password; - if verify(entered_pass, &hashed_pass).unwrap() { - let hashed_new_password = - hash(&new_password, DEFAULT_COST).unwrap(); - diesel::update(customer.filter(id.eq(selected_user.id))) - .set(password.eq(hashed_new_password)) - .execute(&conn) - .unwrap(); - return HttpResponse::Ok().body("Changed password successfully"); - } else { - return HttpResponse::Ok().body("Invalid password"); - } - } - return HttpResponse::Unauthorized().body("Login first"); -} diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index d956a3f..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[macro_use] -extern crate diesel; - -pub mod handlers; -pub mod models; -pub mod schema; - -use diesel::r2d2::{self, ConnectionManager}; -use diesel::MysqlConnection; -pub type TPool = r2d2::Pool>; diff --git a/src/models.rs b/src/models.rs deleted file mode 100644 index a104209..0000000 --- a/src/models.rs +++ /dev/null @@ -1,97 +0,0 @@ -use super::schema::{cart_items, customer, product, rating, transaction}; - -use chrono::naive::{NaiveDate, NaiveDateTime}; -use diesel::{Insertable, Queryable}; -use serde::{Deserialize, Serialize}; - -/* Member */ -#[derive(Queryable, Serialize)] -pub struct Customer { - pub id: i32, - pub username: String, - pub password: String, - pub phone_number: String, - pub email_id: String, - pub address: Option, -} - -#[derive(Insertable, Deserialize)] -#[table_name = "customer"] -pub struct NewCustomer { - pub username: String, - pub password: String, - pub phone_number: String, - pub email_id: String, - - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option, -} - -/* Product */ -#[derive(Queryable, Serialize)] -pub struct Product { - pub id: i32, - pub name: String, - pub kind: Option, - pub price: f32, - pub description: Option, -} - -#[derive(Insertable, Deserialize)] -#[table_name = "product"] -pub struct NewProduct { - pub name: String, - - #[serde(skip_serializing_if = "Option::is_none")] - pub kind: Option, - pub price: f32, - - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, -} - -#[derive(Deserialize)] -pub struct UpdateProduct { - pub name: String, - pub kind: Option, - pub price: f32, - pub description: Option, -} - -/* Cart Items */ -#[derive(Queryable, Serialize)] -pub struct CartItem { - pub cart_id: i32, - pub product_id: i32, -} - -#[derive(Insertable, Deserialize)] -#[table_name = "cart_items"] -pub struct AddCartItem { - pub cart_id: i32, - pub product_id: i32, -} - -/* Rating */ -#[derive(Queryable, Serialize)] -pub struct Rating { - pub id: i32, - pub comment_text: Option, - pub comment_date: Option, - pub product_id: Option, - pub customer_id: Option, - pub stars: Option, -} - -#[derive(Insertable, Deserialize)] -#[table_name = "rating"] -pub struct AddRating { - #[serde(skip_serializing_if = "Option::is_none")] - pub comment_text: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub stars: Option, - - pub product_id: i32, - pub customer_id: i32, -} diff --git a/src/schema.rs b/src/schema.rs deleted file mode 100644 index f08221a..0000000 --- a/src/schema.rs +++ /dev/null @@ -1,61 +0,0 @@ -table! { - cart_items (cart_id, product_id) { - cart_id -> Integer, - product_id -> Integer, - } -} - -table! { - customer (id) { - id -> Integer, - username -> Varchar, - password -> Varchar, - phone_number -> Varchar, - email_id -> Varchar, - address -> Nullable, - } -} - -table! { - product (id) { - id -> Integer, - name -> Varchar, - kind -> Nullable, - price -> Float, - description -> Nullable, - } -} - -table! { - rating (id) { - id -> Integer, - comment_text -> Nullable, - comment_date -> Nullable, - product_id -> Nullable, - customer_id -> Nullable, - stars -> Nullable, - } -} - -table! { - transaction (id) { - id -> Integer, - payment_type -> Varchar, - amount -> Float, - customer_id -> Nullable, - } -} - -joinable!(cart_items -> customer (cart_id)); -joinable!(cart_items -> product (product_id)); -joinable!(rating -> customer (customer_id)); -joinable!(rating -> product (product_id)); -joinable!(transaction -> customer (customer_id)); - -allow_tables_to_appear_in_same_query!( - cart_items, - customer, - product, - rating, - transaction, -); diff --git a/tests/product/chair.json b/tests/product/chair.json deleted file mode 100644 index bb13c8b..0000000 --- a/tests/product/chair.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Urban Ladder Teak Chair", - "kind": "Chair", - "price": 3500, - "description": "Sleek, modern chair for offices and workplaces" -} diff --git a/tests/product/dumb_sofa.json b/tests/product/dumb_sofa.json deleted file mode 100644 index 2b09a58..0000000 --- a/tests/product/dumb_sofa.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Home Town Leather Sofa", - "price": 5400 -} diff --git a/tests/product/smart_sofa.json b/tests/product/smart_sofa.json deleted file mode 100644 index 5d7f7d4..0000000 --- a/tests/product/smart_sofa.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Home Town Leather Sofa", - "kind": "Sofa", - "description": "Comfortable, authentic leather, wooden frame sofa, for living rooms", - "price": 5400 -} diff --git a/tests/requests.txt b/tests/requests.txt deleted file mode 100644 index 7e2ca5c..0000000 --- a/tests/requests.txt +++ /dev/null @@ -1,21 +0,0 @@ -http POST :7878/user/login username=akshay password=password - -http POST :7878/user/login username=akshay password=nigga - -http POST :7878/user/change_password Cookie: old_password=nigga new_password=nigga - -http :7878/user/change_password username=akshay password=password - -http :7878/product/catalog - -http :7878/product/1 - -http POST :7878/cart/add Cookie: product_id:=1 - -http :7878/cart/items Cookie: - -http POST :7878/cart/remove Cookie: product_id:=1 - -http POST :7878/rating/add Cookie: product_id:=1 stars:=3 comment_text=Very good functional chair - -http :7878/product/reviews/1 diff --git a/tests/users/add_akshay.json b/tests/users/add_akshay.json deleted file mode 100644 index 1d6c405..0000000 --- a/tests/users/add_akshay.json +++ /dev/null @@ -1,8 +0,0 @@ - -{ - "username": "Akshay", - "password": "akshay", - "phone_number": "123454234", - "email_id": "aks@hay.com", - "address": "Rv College of Engineering, Mysuru Road, 560087, Near Metro station" -} diff --git a/tests/users/add_user.json b/tests/users/add_user.json deleted file mode 100644 index 1f481e9..0000000 --- a/tests/users/add_user.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "username": "Ramu Kaka", - "password": "ramu123", - "phone_number": "123454234", - "email_id": "ramu@kaka.com", - "address": "RA-602, Purva Riviera" -} -- cgit v1.2.3