diff --git a/.gitignore b/.gitignore index c39800b..5e79d6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target - -dump.rdb \ No newline at end of file +package.json +package-lock.json +dump.rdb +.vscode diff --git a/.rusty-hook.toml b/.rusty-hook.toml new file mode 100644 index 0000000..105b318 --- /dev/null +++ b/.rusty-hook.toml @@ -0,0 +1,5 @@ +[hooks] +pre-commit = "cargo test && cargo fmt -- --check && cargo clippy && stylelint ./public/static/themes/*.css ./public/static/colorschemes/*.css ./public/static/*.js" + +[logging] +verbose = true diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..9019f4f --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,13 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "alpha-value-notation": "number", + "selector-class-pattern": null + }, +"overrides": [ + { + "files": ["*.js"], + "customSyntax": "postcss-lit" + } + ] +} diff --git a/Cargo.lock b/Cargo.lock index 503beea..c3b4f93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -438,6 +438,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "ci_info" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24f638c70e8c5753795cc9a8c07c44da91554a09e4cf11a7326e8161b0a3c45e" +dependencies = [ + "envmnt", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -693,6 +702,16 @@ dependencies = [ "termcolor", ] +[[package]] +name = "envmnt" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" +dependencies = [ + "fsio", + "indexmap", +] + [[package]] name = "errno" version = "0.3.1" @@ -796,6 +815,12 @@ dependencies = [ "percent-encoding 2.2.0", ] +[[package]] +name = "fsio" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3" + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1567,6 +1592,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nias" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0" + [[package]] name = "nodrop" version = "0.1.14" @@ -2358,6 +2389,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rusty-hook" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96cee9be61be7e1cbadd851e58ed7449c29c620f00b23df937cb9cbc04ac21a3" +dependencies = [ + "ci_info", + "getopts", + "nias", + "toml", +] + [[package]] name = "ryu" version = "1.0.13" @@ -3038,6 +3081,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -3330,6 +3382,7 @@ dependencies = [ "redis", "reqwest 0.11.18", "rlua", + "rusty-hook", "scraper", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 0cb7c55..b8f2755 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,6 @@ redis = {version="*"} md5 = {version="*"} rand={version="*"} once_cell = {version="*"} + +[dev-dependencies] +rusty-hook = "^0.11.2" diff --git a/public/static/index.js b/public/static/index.js index 1261e15..ad52ab9 100644 --- a/public/static/index.js +++ b/public/static/index.js @@ -4,7 +4,7 @@ function search_web() { } search_box.addEventListener('keyup', (e) => { - if (e.keyCode === 13) { + if (e.key === 'Enter') { search_web() } })