diff --git a/Cargo.lock b/Cargo.lock index fef0b6ae..5b9384c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -661,6 +661,21 @@ dependencies = [ "bytes 1.0.1", ] +[[package]] +name = "cache-buster" +version = "0.1.0" +source = "git+https://github.com/realaravinth/cache-buster#b7336fc0b15aa98368dfb9a313ea01bef1711859" +dependencies = [ + "data-encoding", + "derive_builder 0.10.0", + "mime", + "mime_guess", + "serde 1.0.125", + "serde_json", + "sha2", + "walkdir", +] + [[package]] name = "cargo-platform" version = "0.1.1" @@ -880,12 +895,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc" +checksum = "e9d6ddad5866bb2170686ed03f6839d31a76e5407d80b1c334a2c24618543ffa" dependencies = [ - "darling_core 0.12.2", - "darling_macro 0.12.2", + "darling_core 0.12.3", + "darling_macro 0.12.3", ] [[package]] @@ -904,9 +919,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684" +checksum = "a9ced1fd13dc386d5a8315899de465708cf34ee2a6d9394654515214e67bb846" dependencies = [ "fnv", "ident_case", @@ -929,15 +944,21 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81" +checksum = "0a7a1445d54b2f9792e3b31a3e715feabbace393f38dc4ffd49d94ee9bc487d5" dependencies = [ - "darling_core 0.12.2", + "darling_core 0.12.3", "quote", "syn", ] +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + [[package]] name = "derive_builder" version = "0.9.0" @@ -979,7 +1000,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3150f1e84602847b99d3eeb702487fc364f7d6c94f634e944a68fdbaea09e457" dependencies = [ - "darling 0.12.2", + "darling 0.12.3", "proc-macro2", "quote", "syn", @@ -1118,10 +1139,13 @@ dependencies = [ name = "frontend" version = "0.1.0" dependencies = [ + "cache-buster", "lazy_static", "log", + "mime", "pretty_env_logger", "sailfish", + "sha2", "tokio 1.4.0", ] @@ -1450,9 +1474,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ "bytes 1.0.1", "fnv", @@ -1461,9 +1485,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "bc35c995b9d93ec174cf9a27d425c7892722101e14993cd227fdb51d70cf9589" [[package]] name = "humantime" @@ -1595,9 +1619,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" +checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" [[package]] name = "linked-hash-map" @@ -1607,9 +1631,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" dependencies = [ "scopeguard", ] @@ -2099,9 +2123,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] @@ -2350,9 +2374,9 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "sailfish" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ef143e1c551a0eee1d1c4a1faf45558749750826db1eab212babbe08e4a7b8" +checksum = "816920a08514d9741242b3efe70c16c350ed548bc4a5ba03426e56faf9d45f77" dependencies = [ "itoap", "ryu", @@ -2362,9 +2386,9 @@ dependencies = [ [[package]] name = "sailfish-compiler" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823601d78663c108d4425fea46ee63e1622144eadbcf0eeb9c279c1be681cd9" +checksum = "4276e7b848bde8e7813d534f014bc35ce5acd2b9e2b6b075727113fcf478ba63" dependencies = [ "filetime", "home", @@ -2377,9 +2401,9 @@ dependencies = [ [[package]] name = "sailfish-macros" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90b31a6c9be3d1bd5fa41a6d5c274ba3c7d1ebb1d0e0b6381e60cc70725e9e10" +checksum = "6bba2458ef07ae12c9aed2edb866c3db2f9c21cf19a2c3f2613b2982bc1a4a46" dependencies = [ "proc-macro2", "sailfish-compiler", @@ -2815,9 +2839,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" dependencies = [ "proc-macro2", "quote", @@ -2929,9 +2953,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" dependencies = [ "tinyvec_macros", ] @@ -3128,9 +3152,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" dependencies = [ "matches", ] @@ -3387,9 +3411,9 @@ dependencies = [ [[package]] name = "whoami" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e296f550993cba2c5c3eba5da0fb335562b2fa3d97b7a8ac9dc91f40a3abc70" +checksum = "4abacf325c958dfeaf1046931d37f2a901b6dfe0968ee965a29e94c6766b2af6" dependencies = [ "wasm-bindgen", "web-sys", diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index 59d37d7c..e85e3ba2 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -3,14 +3,22 @@ name = "frontend" version = "0.1.0" authors = ["realaravinth "] edition = "2018" +build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] sailfish = { version = "0.3.2", features = ["derive"]} tokio = { version = "1.4.0", features = [ "rt-multi-thread", "macros", "fs", "test-util" ]} +cache-buster = { version = "0.1", git = "https://github.com/realaravinth/cache-buster" } pretty_env_logger = "0.4" log = "0.4" lazy_static = "1.4" + +sha2 = "0.9.3" + +[build-dependencies] +cache-buster = { version = "0.1", git = "https://github.com/realaravinth/cache-buster" } +mime = "0.3.16" diff --git a/frontend/build.rs b/frontend/build.rs new file mode 100644 index 00000000..c81c0a8b --- /dev/null +++ b/frontend/build.rs @@ -0,0 +1,39 @@ +/* +* Copyright (C) 2021 Aravinth Manivannan +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +*/ + +use cache_buster::BusterBuilder; + +fn main() { + let types = vec![ + mime::IMAGE_PNG, + mime::IMAGE_SVG, + mime::IMAGE_JPEG, + mime::IMAGE_GIF, + ]; + + let config = BusterBuilder::default() + .source("./static") + .result("./prod") + .mime_types(types) + .copy(true) + .follow_links(true) + .build() + .unwrap(); + + config.init().unwrap(); + config.hash().unwrap().to_env(); +} diff --git a/frontend/main b/frontend/main new file mode 100755 index 00000000..67f157ea Binary files /dev/null and b/frontend/main differ diff --git a/frontend/main.rs b/frontend/main.rs new file mode 100644 index 00000000..e837203e --- /dev/null +++ b/frontend/main.rs @@ -0,0 +1,33 @@ +/* +* Copyright (C) 2021 Aravinth Manivannan +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +*/ + +fn main() { + // note: add error checking yourself. + // println!("cargo:rustc-env=GIT_HASH={}", git_hash); + read_files("./dist"); +} + +fn read_files(path: &str) { + use std::fs; + + for entry in fs::read_dir(path).unwrap() { + let entry = entry.unwrap(); + if entry.path().is_file() { + println!("{:?}", entry.file_type()); + } + } +} diff --git a/frontend/package.json b/frontend/package.json index cb26b1a1..4709393e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,7 +8,7 @@ "license": "AGPLv3 or above", "scripts": { "start": "find . | entr yarn build-dev", - "build-dev": "cargo run && webpack --config webpack.dev.js", + "build-dev": "webpack --config webpack.dev.js", "build-fast-dev": "cargo run && webpack-dev-server --config webpack.dev.js", "build-check": "webpack-dev-server --config webpack.dev.js", "build": "cargo run && webpack --config webpack.prod.js" diff --git a/frontend/prod/index.html b/frontend/prod/index.html new file mode 100644 index 00000000..b241aae2 --- /dev/null +++ b/frontend/prod/index.html @@ -0,0 +1,53 @@ + + + + + Login|mCaptcha + + +
+ +

Sign in to mCaptcha

+ +
+ + + + +
+
+

+ New to mCaptcha? + Create account +

+
+
+ + \ No newline at end of file diff --git a/frontend/prod/panel/index.html b/frontend/prod/panel/index.html new file mode 100644 index 00000000..eacb5a09 --- /dev/null +++ b/frontend/prod/panel/index.html @@ -0,0 +1,522 @@ + + + + + + Dashboard + + + +
+ + +
+ +
+ +
    + +
  • +
  • + +
  • +
  • + Profile +
  • + +
  • + Notifications +
  • + +
  • + Profile +
  • +
+ +
    +
  • + 1 + Add sitekey +
  • +
  • + 2 + Add client-side code snippets in places that you want to protext +
  • +
  • + 3 + Add servers-side verification logic +
  • +
+ +
+ + +
+
+ Add Site Key +
+
+ +
+ + +
+ + +
+ + + +
+ +
+ +
+ + + + +
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/frontend/prod/register/index.html b/frontend/prod/register/index.html new file mode 100644 index 00000000..90512973 --- /dev/null +++ b/frontend/prod/register/index.html @@ -0,0 +1,72 @@ + + + + + Join|mCaptcha + + +
+ +

Join mCaptcha

+ +
+ + + + + + + + +
+
+

+ New to mCaptcha? + Create account +

+
+
+ + \ No newline at end of file diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 85080aec..c0b265d4 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -1,3 +1,5 @@ +use cache_buster::Files; +use lazy_static::lazy_static; use log::{debug, info}; use sailfish::TemplateOnce; use tokio::fs; @@ -32,7 +34,11 @@ impl IndexPage { } } -const BASE_DIR: &str = "./output"; +const BASE_DIR: &str = "./prod"; + +lazy_static! { + pub static ref FILES: Files = Files::load(); +} #[tokio::main] async fn main() { diff --git a/frontend/static-bk/img/icon-trans.png b/frontend/static-bk/img/icon-trans.png new file mode 100644 index 00000000..db8da876 Binary files /dev/null and b/frontend/static-bk/img/icon-trans.png differ diff --git a/frontend/static-bk/img/icon.png b/frontend/static-bk/img/icon.png new file mode 100644 index 00000000..75bf7879 Binary files /dev/null and b/frontend/static-bk/img/icon.png differ diff --git a/frontend/static-bk/img/svg/bell.svg b/frontend/static-bk/img/svg/bell.svg new file mode 100644 index 00000000..c0ed0e1e --- /dev/null +++ b/frontend/static-bk/img/svg/bell.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/credit-card.svg b/frontend/static-bk/img/svg/credit-card.svg new file mode 100644 index 00000000..9429a635 --- /dev/null +++ b/frontend/static-bk/img/svg/credit-card.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/eye-off.svg b/frontend/static-bk/img/svg/eye-off.svg new file mode 100644 index 00000000..9d28c182 --- /dev/null +++ b/frontend/static-bk/img/svg/eye-off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/eye.svg b/frontend/static-bk/img/svg/eye.svg new file mode 100644 index 00000000..44f107af --- /dev/null +++ b/frontend/static-bk/img/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/file-text.svg b/frontend/static-bk/img/svg/file-text.svg new file mode 100644 index 00000000..85186e3b --- /dev/null +++ b/frontend/static-bk/img/svg/file-text.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/file.svg b/frontend/static-bk/img/svg/file.svg new file mode 100644 index 00000000..fa1ecc84 --- /dev/null +++ b/frontend/static-bk/img/svg/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/filter.svg b/frontend/static-bk/img/svg/filter.svg new file mode 100644 index 00000000..3ae2cfc7 --- /dev/null +++ b/frontend/static-bk/img/svg/filter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/github.svg b/frontend/static-bk/img/svg/github.svg new file mode 100644 index 00000000..8a1c9c0a --- /dev/null +++ b/frontend/static-bk/img/svg/github.svg @@ -0,0 +1 @@ + diff --git a/frontend/static-bk/img/svg/globe.svg b/frontend/static-bk/img/svg/globe.svg new file mode 100644 index 00000000..4306cdcb --- /dev/null +++ b/frontend/static-bk/img/svg/globe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/help-circle.svg b/frontend/static-bk/img/svg/help-circle.svg new file mode 100644 index 00000000..1bbf3978 --- /dev/null +++ b/frontend/static-bk/img/svg/help-circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/home.svg b/frontend/static-bk/img/svg/home.svg new file mode 100644 index 00000000..867f0799 --- /dev/null +++ b/frontend/static-bk/img/svg/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/key.svg b/frontend/static-bk/img/svg/key.svg new file mode 100644 index 00000000..e778e74e --- /dev/null +++ b/frontend/static-bk/img/svg/key.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/log-out.svg b/frontend/static-bk/img/svg/log-out.svg new file mode 100644 index 00000000..625d2724 --- /dev/null +++ b/frontend/static-bk/img/svg/log-out.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/menu.svg b/frontend/static-bk/img/svg/menu.svg new file mode 100644 index 00000000..0ea1741e --- /dev/null +++ b/frontend/static-bk/img/svg/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/message-square.svg b/frontend/static-bk/img/svg/message-square.svg new file mode 100644 index 00000000..6a2e4e59 --- /dev/null +++ b/frontend/static-bk/img/svg/message-square.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/moon.svg b/frontend/static-bk/img/svg/moon.svg new file mode 100644 index 00000000..3d94f162 --- /dev/null +++ b/frontend/static-bk/img/svg/moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/settings.svg b/frontend/static-bk/img/svg/settings.svg new file mode 100644 index 00000000..0318f2ce --- /dev/null +++ b/frontend/static-bk/img/svg/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/shield-off.svg b/frontend/static-bk/img/svg/shield-off.svg new file mode 100644 index 00000000..47805eed --- /dev/null +++ b/frontend/static-bk/img/svg/shield-off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/shield.svg b/frontend/static-bk/img/svg/shield.svg new file mode 100644 index 00000000..18c6ed24 --- /dev/null +++ b/frontend/static-bk/img/svg/shield.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/tag.svg b/frontend/static-bk/img/svg/tag.svg new file mode 100644 index 00000000..0c7a7704 --- /dev/null +++ b/frontend/static-bk/img/svg/tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/toggle-left.svg b/frontend/static-bk/img/svg/toggle-left.svg new file mode 100644 index 00000000..cd4b4e62 --- /dev/null +++ b/frontend/static-bk/img/svg/toggle-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/toggle-right.svg b/frontend/static-bk/img/svg/toggle-right.svg new file mode 100644 index 00000000..01392ab6 --- /dev/null +++ b/frontend/static-bk/img/svg/toggle-right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static-bk/img/svg/user.svg b/frontend/static-bk/img/svg/user.svg new file mode 100644 index 00000000..7b5bc4a7 --- /dev/null +++ b/frontend/static-bk/img/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/js/api/v1/routes.js b/frontend/static/js/api/v1/routes.js deleted file mode 100644 index d6bc8355..00000000 --- a/frontend/static/js/api/v1/routes.js +++ /dev/null @@ -1,47 +0,0 @@ -const ROUTES = { - registerUser: '/api/v1/signup', - - loginUser: '/api/v1/signin', - - signoutUser: '/api/v1/signout', - - deleteAccount: '/api/v1/account/delete', - - usernameExists: '/api/v1/account/username/exists', - - emailExists: '/api/v1/account/email/exists', - - healthCheck: '/api/v1/meta/health', - - buildDetails: '/api/v1/meta/build', - - addDomain: '/api/v1/mcaptcha/domain/add', - - challengeDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/get', - - proveDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/prove', - - deleteDomain: '/api/v1/mcaptcha/domain/delete', - - addToken: '/api/v1/mcaptcha/domain/token/add', - - updateTokenKey: '/api/v1/mcaptcha/domain/token/update', - - getTokenKey: '/api/v1/mcaptcha/domain/token/get', - - deleteToken: '/api/v1/mcaptcha/domain/token/delete', - - addTokenLevels: '/api/v1/mcaptcha/domain/token/levels/add', - - updateTokenLevels: '/api/v1/mcaptcha/domain/token/levels/update', - - deleteTokenLevels: '/api/v1/mcaptcha/domain/token/levels/delete', - - getTokenLevels: '/api/v1/mcaptcha/domain/token/levels/get', - - getTokenDuration: '/api/v1/mcaptcha/domain/token/token/get', - - updateTokenDuration: '/api/v1/mcaptcha/domain/token/token/update', -}; - -export default ROUTES; diff --git a/frontend/static/js/auth/emailExists.js b/frontend/static/js/auth/emailExists.js deleted file mode 100644 index b9453719..00000000 --- a/frontend/static/js/auth/emailExists.js +++ /dev/null @@ -1,43 +0,0 @@ -import ROUTES from '../api/v1/routes'; - -import genJsonPayload from '../utils/genJsonPayload'; - -const checkEmailExists = async () => { - let email = document.getElementById('email'); - let val = email.value; - let payload = { - val, - }; - - // return fetch(ROUTES.emailExists, genJsonPayload(payload)).then(res => { - // if (res.ok) { - // res.json().then(data => { - // if (data.exists) { - // console.log(email.className); - // email.className += ' form__in-field--warn'; - // alert('Email taken'); - // } - // - // return data.exists; - // }); - // } else { - // res.json().then(err => alert(`error: ${err.error}`)); - // } - // }); - // - - let res = await fetch(ROUTES.emailExists, genJsonPayload(payload)); - if (res.ok) { - let data = await res.json(); - if (data.exists) { - email.className += ' form__in-field--warn'; - alert('Email taken'); - } - return data.exists; - } else { - let err = await res.json(); - alert(`error: ${err.error}`); - } -}; - -export {checkEmailExists}; diff --git a/frontend/static/js/auth/register.js b/frontend/static/js/auth/register.js deleted file mode 100644 index 7944e229..00000000 --- a/frontend/static/js/auth/register.js +++ /dev/null @@ -1,49 +0,0 @@ -import ROUTES from '../api/v1/routes'; - -import isBlankString from '../utils/isBlankString'; -import genJsonPayload from '../utils/genJsonPayload'; - -import {checkUsernameExists} from './userExists'; -import {checkEmailExists} from './emailExists'; - -const registerUser = async e => { - e.preventDefault(); - - let username = document.getElementById('username').value; - isBlankString(e, username, 'username'); - - let password = document.getElementById('password').value; - let passwordCheck = document.getElementById('password-check').value; - if (password != passwordCheck) { - return alert("passwords don't match, check again!"); - } - - let email = document.getElementById('email').value; - isBlankString(e, email, 'email'); - - let exists = await checkUsernameExists(); - if (exists) { - return; - } - - exists = await checkEmailExists(); - if (exists) { - return; - } - - let payload = { - username, - password, - email, - }; - - let res = await fetch(ROUTES.registerUser, genJsonPayload(payload)); - if (res.ok) { - alert('success'); - } else { - let err = await res.json(); - alert(`error: ${err.error}`); - } -}; - -export default registerUser; diff --git a/frontend/static/js/auth/signin.js b/frontend/static/js/auth/signin.js deleted file mode 100644 index db5ffc56..00000000 --- a/frontend/static/js/auth/signin.js +++ /dev/null @@ -1,26 +0,0 @@ -import isBlankString from '../utils/isBlankString'; -import genJsonPayload from '../utils/genJsonPayload'; - -import ROUTES from '../api/v1/routes'; - -const signin = e => { - e.preventDefault(); - let username = document.getElementById('username').value; - isBlankString(e, username, 'username'); - - let password = document.getElementById('password').value; - let payload = { - username, - password, - }; - - fetch(ROUTES.loginUser, genJsonPayload(payload)).then(res => { - if (res.ok) { - alert('success'); - } else { - res.json().then(err => alert(`error: ${err.error}`)); - } - }); -}; - -export default signin; diff --git a/frontend/static/js/auth/userExists.js b/frontend/static/js/auth/userExists.js deleted file mode 100644 index 4dccba59..00000000 --- a/frontend/static/js/auth/userExists.js +++ /dev/null @@ -1,47 +0,0 @@ -import ROUTES from '../api/v1/routes'; - -import genJsonPayload from '../utils/genJsonPayload'; - -const checkUsernameEventHandler = _e => { - checkUsernameExists(); -}; - -//export const checkUsernameExists = async () => { -async function checkUsernameExists() { - let username = document.getElementById('username'); - let val = username.value; - let payload = { - val, - }; - - // return fetch(ROUTES.usernameExists, genJsonPayload(payload)).then(res => { - // if (res.ok) { - // res.json().then(data => { - // if (data.exists) { - // username.className += ' form__in-field--warn'; - // alert('Username taken'); - // } - // return data.exists; - // }); - // } else { - // res.json().then(err => alert(`error: ${err.error}`)); - // } - // }); - // - - let res = await fetch(ROUTES.usernameExists, genJsonPayload(payload)); - if (res.ok) { - let data = await res.json(); - if (data.exists) { - username.className += ' form__in-field--warn'; - alert('Username taken'); - } - return data.exists; - } else { - let err = await res.json(); - alert(`error: ${err.error}`); - } - return false; -}; - -export {checkUsernameExists, checkUsernameEventHandler}; diff --git a/frontend/static/js/css/_reset.scss b/frontend/static/js/css/_reset.scss deleted file mode 100644 index e209c163..00000000 --- a/frontend/static/js/css/_reset.scss +++ /dev/null @@ -1,4 +0,0 @@ -* { - padding: 0; - margin: 0; -} diff --git a/frontend/static/js/css/forms.scss b/frontend/static/js/css/forms.scss deleted file mode 100644 index 5dfcada7..00000000 --- a/frontend/static/js/css/forms.scss +++ /dev/null @@ -1,101 +0,0 @@ -@import 'reset'; - -.form__logo { - width: 110px; - padding-top: 50px; - display: block; - margin: auto; - position: relative; - top: 20%; - transform: translate(0%, -40.9%); -} - -.form__brand { - padding: 10px 0; - text-align: center; - position: relative; - top: 20%; - transform: translate(0%, -90.9%); -} - -.form-container { - max-width: 40%; - min-width: 20%; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -49.9%); - box-sizing: border-box; - margin: auto; - padding: 20px 0; -} - -.form__box { - border: 1px solid #eaecef; - background-color: #f6f8fa; - border-radius: 5px; - padding: 20px 0; -} - -.form__in-group { - display: block; - position: relative; - margin: auto; - max-width: 80%; - padding: 10px 0px; - - box-sizing: content-box; - - align-items: center; - align-content: center; -} - -.form__in-field { - display: block; - box-sizing: border-box; - margin: 10px 0; - padding: 10px 0; - width: 100%; -} - -.form__in-field--warn { - border: solid 1px red; -} - -.form__in-field--success { - border: solid 1px #2ea44f; -} - -.form__pw-recovery { - text-decoration: none; - color: rgb(3, 102, 214); - font-size: 0.8rem; -} - -.form__submit-button { - display: block; - border: 1px solid skyblue; - background: #2ea44f; - color: white; - height: 40px; - border-radius: 5px; - width: 80%; - margin: auto; -} - -.form__secondary-action { - display: block; - margin-top: 10px; -} - -.form__secondary-action__banner { - display: block; - margin: auto; - max-width: 80%; - text-align: center; -} - -.form__secondary-action__link { - text-decoration: none; - color: rgb(3, 102, 214); -} diff --git a/frontend/static/js/css/main.scss b/frontend/static/js/css/main.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/frontend/static/js/css/panel/main.scss b/frontend/static/js/css/panel/main.scss deleted file mode 100644 index e67163e5..00000000 --- a/frontend/static/js/css/panel/main.scss +++ /dev/null @@ -1,147 +0,0 @@ -/* -