diff --git a/Cargo.lock b/Cargo.lock index cdc0704..a673f3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,18 +55,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anyhow" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "async-stream" version = "0.3.3" @@ -186,16 +174,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "1.4.0" @@ -268,15 +246,6 @@ dependencies = [ "inout", ] -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -330,17 +299,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -592,7 +550,7 @@ checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "windows-sys 0.45.0", ] @@ -661,12 +619,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.26" @@ -675,7 +627,6 @@ checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", - "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -698,34 +649,12 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" -[[package]] -name = "futures-executor" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - [[package]] name = "futures-io" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" -[[package]] -name = "futures-macro" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "futures-sink" version = "0.3.26" @@ -747,7 +676,6 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", @@ -836,7 +764,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ - "bytes 1.4.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -903,7 +831,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes 1.4.0", + "bytes", "fnv", "itoa", ] @@ -914,7 +842,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.4.0", + "bytes", "http", "pin-project-lite", ] @@ -943,7 +871,7 @@ version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ - "bytes 1.4.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -967,7 +895,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.4.0", + "bytes", "hyper", "native-tls", "tokio", @@ -1111,15 +1039,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.5" @@ -1157,19 +1076,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec", - "bitflags", - "cfg-if 1.0.0", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.139" @@ -1191,15 +1097,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.9" @@ -1243,12 +1140,6 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.5.0" @@ -1325,17 +1216,6 @@ dependencies = [ "slab", ] -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio 0.6.23", -] - [[package]] name = "miow" version = "0.2.2" @@ -1354,7 +1234,7 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" dependencies = [ - "bytes 1.4.0", + "bytes", "encoding_rs", "futures-util", "http", @@ -1397,17 +1277,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "nom" -version = "5.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" -dependencies = [ - "lexical-core", - "memchr", - "version_check", -] - [[package]] name = "normpath" version = "0.3.2" @@ -1537,40 +1406,14 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.6.3", - "rustc_version", -] - [[package]] name = "parking_lot" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.9", - "parking_lot_core 0.9.7", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "rustc_version", - "smallvec 0.6.14", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1581,8 +1424,8 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", - "smallvec 1.10.0", + "redox_syscall", + "smallvec", "windows-sys 0.45.0", ] @@ -1602,24 +1445,17 @@ dependencies = [ "chrono", "diesel", "diesel_migrations", - "futures 0.3.26", - "itertools", "log", - "once_cell", "prometheus", - "pulldown-cmark", "rand", "reqwest", "rocket", "rocket_dyn_templates", "rocket_sync_db_pools", - "rust-embed", "serde", "serde_json", "serde_with", - "time-parse", "tokio", - "tokio-signal", ] [[package]] @@ -1825,22 +1661,11 @@ dependencies = [ "lazy_static", "libc", "memchr", - "parking_lot 0.12.1", + "parking_lot", "procfs", "thiserror", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" -dependencies = [ - "bitflags", - "memchr", - "unicase", -] - [[package]] name = "quote" version = "1.0.23" @@ -1857,7 +1682,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" dependencies = [ "log", - "parking_lot 0.12.1", + "parking_lot", "scheduled-thread-pool", ] @@ -1891,12 +1716,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.16" @@ -1968,7 +1787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ "base64 0.21.0", - "bytes 1.4.0", + "bytes", "encoding_rs", "futures-core", "futures-util", @@ -2009,16 +1828,16 @@ dependencies = [ "atomic", "atty", "binascii", - "bytes 1.4.0", + "bytes", "either", "figment", - "futures 0.3.26", + "futures", "indexmap", "log", "memchr", "multer", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "rand", "ref-cast", @@ -2074,7 +1893,7 @@ checksum = "2ded65d127954de3c12471630bf4b81a2792f065984461e65b91d0fdaafc17a2" dependencies = [ "cookie", "either", - "futures 0.3.26", + "futures", "http", "hyper", "indexmap", @@ -2085,7 +1904,7 @@ dependencies = [ "pin-project-lite", "ref-cast", "serde", - "smallvec 1.10.0", + "smallvec", "stable-pattern", "state", "time 0.3.17", @@ -2117,49 +1936,6 @@ dependencies = [ "quote", ] -[[package]] -name = "rust-embed" -version = "6.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "283ffe2f866869428c92e0d61c2f35dfb4355293cdfdc48f49e895c15f1333d1" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "6.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ab23d42d71fb9be1b643fe6765d292c5e14d46912d13f3ae2815ca048ea04d" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "7.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1669d81dfabd1b5f8e2856b8bbe146c6192b0ba22162edc738ac0a5de18f054" -dependencies = [ - "sha2", - "walkdir", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.36.8" @@ -2210,7 +1986,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf" dependencies = [ - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -2254,21 +2030,6 @@ dependencies = [ "libc", ] -[[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.152" @@ -2393,15 +2154,6 @@ dependencies = [ "deunicode", ] -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.10.0" @@ -2442,12 +2194,6 @@ dependencies = [ "loom", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.10.0" @@ -2480,7 +2226,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] @@ -2583,16 +2329,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "time-parse" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1160cce3eff1e83f47add604ad3ad0b0609e2f76deb6143f699d40d55a2a83a" -dependencies = [ - "anyhow", - "nom", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -2615,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", - "bytes 1.4.0", + "bytes", "libc", "memchr", "mio 0.8.5", @@ -2627,27 +2363,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", -] - [[package]] name = "tokio-macros" version = "1.8.2" @@ -2669,42 +2384,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", - "lazy_static", - "log", - "mio 0.6.23", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-signal" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" -dependencies = [ - "futures 0.1.31", - "libc", - "mio 0.6.23", - "mio-uds", - "signal-hook-registry", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "winapi 0.3.9", -] - [[package]] name = "tokio-stream" version = "0.1.11" @@ -2716,23 +2395,13 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures 0.1.31", -] - [[package]] name = "tokio-util" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6a3b08b64e6dfad376fa2432c7b1f01522e37a623c3050bc95db2d3ff21583" dependencies = [ - "bytes 1.4.0", + "bytes", "futures-core", "futures-sink", "pin-project-lite", @@ -2810,7 +2479,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec 1.10.0", + "smallvec", "thread_local", "tracing", "tracing-core", @@ -2904,15 +2573,6 @@ dependencies = [ "unic-common", ] -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.10" diff --git a/Cargo.toml b/Cargo.toml index dd4d629..a90a4e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,14 +10,10 @@ build = "buildSrc/build.rs" chrono = "0.4.23" diesel = { version = "1.4.6", features = ["chrono"] } diesel_migrations = "1.4.0" -futures = "0.3.26" -itertools = "0.10.5" log = "0.4.14" -once_cell = "1.17.0" prometheus = { version = "0.13.3", features = [ "process", ], default-features = false } -pulldown-cmark = { version = "0.9.2", default-features = false } rand = "0.8.3" reqwest = { version = "0.11.14", features = ["json"] } rocket = { version = "=0.5.0-rc.2", features = ["json"] } @@ -25,13 +21,10 @@ rocket_dyn_templates = { version = "=0.1.0-rc.2", features = ["tera"] } rocket_sync_db_pools = { version = "=0.1.0-rc.2", features = [ "diesel_postgres_pool", ] } -rust-embed = "6.4.2" serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.93" serde_with = "2.2.0" -time-parse = "0.2.0" tokio = { version = "1.25.0", features = ["rt"] } -tokio-signal = "0.2.9" [build-dependencies] serde = { version = "1.0.152", features = ["derive"] } diff --git a/__tests__/setup.js b/__tests__/setup.js deleted file mode 100644 index b0f3b18..0000000 --- a/__tests__/setup.js +++ /dev/null @@ -1,20 +0,0 @@ -// pastebin.run -// Copyright (C) 2022 Konrad Borowski -// -// 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 . - -import matchers from "@testing-library/jest-dom/matchers"; -import { expect } from "vitest"; - -expect.extend(matchers); diff --git a/languages.json b/languages.json deleted file mode 100644 index a50211b..0000000 --- a/languages.json +++ /dev/null @@ -1,494 +0,0 @@ -[ - { - "identifier": "plaintext", - "name": "Plain text" - }, - { - "identifier": "c", - "name": "C", - "helloworld": "#include \n\nint main(void) {\n puts(\"Hello, world!\");\n return 0;\n}", - "implementations": [ - { - "label": "Clang", - "identifier": "clang", - "wrappers": [ - { - "identifier": "clang", - "label": "Run", - "code": "mv code code.c; clang %s code.c && ./a.out" - } - ] - }, - { - "label": "gcc", - "identifier": "gcc", - "wrappers": [ - { - "identifier": "gcc", - "label": "Run", - "code": "mv code code.c; gcc %s code.c && ./a.out" - } - ] - } - ] - }, - { - "identifier": "cpp", - "name": "C++", - "helloworld": "#include \n\nint main() {\n std::cout << \"Hello, world!\\n\";\n}", - "implementations": [ - { - "label": "Clang", - "identifier": "clang", - "wrappers": [ - { - "identifier": "clangcpp", - "label": "Run", - "code": "mv code code.cpp; clang++ %s code.cpp && ./a.out" - } - ] - }, - { - "label": "g++", - "identifier": "gcc", - "wrappers": [ - { - "identifier": "gpp", - "label": "Run", - "code": "mv code code.cpp; g++ %s code.cpp && ./a.out" - } - ] - } - ] - }, - { - "identifier": "csharp", - "name": "C#", - "helloworld": "using System;\n\nclass Program {\n static void Main(string[] args) {\n Console.WriteLine(\"Hello, world!\");\n }\n}", - "implementations": [ - { - "label": ".NET Core", - "identifier": "netcore", - "wrappers": [ - { - "identifier": "netcore", - "label": "Run", - "code": "echo 'Exenetcoreapp5.0' > project.csproj; mv code code.cs; dotnet run %s" - } - ] - } - ] - }, - { - "identifier": "go", - "name": "Go", - "helloworld": "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Hello, world!\")\n}", - "implementations": [ - { - "label": "gc", - "identifier": "gc", - "wrappers": [ - { - "identifier": "gc", - "label": "Run", - "code": "mv code code.go; go run code.go" - }, - { - "identifier": "goimports", - "label": "Format", - "code": "goimports -w code; cat code", - "is_formatter": true - } - ] - } - ] - }, - { - "identifier": "haskell", - "name": "Haskell", - "helloworld": "main = putStrLn \"Hello, world!\"", - "implementations": [ - { - "label": "GHC", - "identifier": "ghc", - "wrappers": [ - { - "identifier": "ghc", - "label": "Run", - "code": "mv code code.hs; ghc %s code.hs && ./code" - } - ] - } - ] - }, - { - "identifier": "html", - "name": "HTML", - "implementations": [ - { - "label": "Prettier", - "identifier": "prettier", - "wrappers": [ - { - "identifier": "html-prettier", - "label": "Format (prettier)", - "code": "mv code{,.html}; prettier code.html || cat code.html", - "is_formatter": true - } - ] - } - ] - }, - { - "identifier": "java", - "name": "Java", - "helloworld": "class HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }\n}", - "implementations": [ - { - "label": "OpenJDK 8", - "identifier": "openjdk8", - "wrappers": [ - { - "identifier": "openjdk8", - "label": "Run", - "code": "mv code code.java; $JAVA8/bin/javac %s code.java; $JAVA8/bin/java \"$(perl -e 'my @classes = grep { !/\\$/ } glob q[*.class]; if (@classes == 1) { my $class = $classes[0]; $class =~ s/\\.class\\z//; print $class } else { print q[Main] }')\"" - } - ] - }, - { - "label": "OpenJDK 11", - "identifier": "openjdk11", - "wrappers": [ - { - "identifier": "openjdk11", - "label": "Run", - "code": "mv code code.java; $JAVA11/bin/javac %s code.java; $JAVA11/bin/java \"$(perl -e 'my @classes = grep { !/\\$/ } glob q[*.class]; if (@classes == 1) { my $class = $classes[0]; $class =~ s/\\.class\\z//; print $class } else { print q[Main] }')\"" - } - ] - } - ] - }, - { - "identifier": "javascript", - "name": "JavaScript", - "helloworld": "console.log(\"Hello, world!\");", - "implementations": [ - { - "label": "Node.js", - "identifier": "nodejs", - "wrappers": [ - { - "identifier": "nodejs", - "label": "Run", - "code": "node %s code" - }, - { - "identifier": "nodejs-prettier", - "label": "Format (prettier)", - "code": "mv code{,.js}; prettier code.js || cat code.js", - "is_formatter": true - } - ] - } - ] - }, - { - "identifier": "jinja2", - "name": "Jinja2" - }, - { - "identifier": "jsx", - "name": "JSX", - "implementations": [ - { - "label": "Node.js", - "identifier": "nodejs", - "wrappers": [ - { - "identifier": "jsx-prettier", - "label": "Format (prettier)", - "code": "mv code{,.jsx}; prettier code.jsx || cat code.jsx", - "is_formatter": true - } - ] - } - ] - }, - { - "identifier": "markdown", - "name": "Markdown", - "implementations": [ - { - "label": "Prettier", - "identifier": "prettier", - "wrappers": [ - { - "identifier": "markdown-prettier", - "label": "Format (prettier)", - "code": "mv code{,.md}; prettier code.md || cat code.md", - "is_formatter": true - } - ] - } - ] - }, - { - "identifier": "nix", - "name": "Nix" - }, - { - "identifier": "perl", - "name": "Perl", - "helloworld": "use v5.12;\nuse warnings;\n\nsay \"Hello, world!\";", - "implementations": [ - { - "label": "Perl", - "identifier": "perl", - "wrappers": [ - { - "identifier": "perl", - "label": "Run", - "code": "perl %s code" - } - ] - } - ] - }, - { - "identifier": "php", - "name": "PHP", - "helloworld": " Result<(), rocket::Error> { } async fn shutdown_monitor(s: Sender) { + let mut sigint = signal(SignalKind::interrupt()).unwrap(); + let mut sigterm = signal(SignalKind::terminate()).unwrap(); + tokio::select! { - _ = signal::ctrl_c() => { + _ = sigint.recv() => { + s.send(0).unwrap(); + }, + _ = sigterm.recv() => { s.send(0).unwrap(); }, } @@ -211,7 +215,6 @@ fn rocket() -> Rocket { .mount( "/", routes![ - api_insert_paste, config, index, insert_paste, diff --git a/src/routes/api_insert_paste_route.rs b/src/routes/api_insert_paste_route.rs deleted file mode 100644 index db415e8..0000000 --- a/src/routes/api_insert_paste_route.rs +++ /dev/null @@ -1,58 +0,0 @@ -// pastebin.run -// Copyright (C) 2021 Konrad Borowski -// -// 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 crate::models::paste::{self, InsertionError}; -use crate::models::Cors; -use crate::Db; -use chrono::Duration; -use chrono::Utc; -use rocket::form::{self, Form, FromFormField, ValueField}; -use std::error::Error; - -#[derive(FromForm)] -pub struct PasteForm { - #[field(default = Expiration(None))] - expiration: Expiration, - code: String, -} - -struct Expiration(Option); - -impl<'r> FromFormField<'r> for Expiration { - fn from_value(field: ValueField<'r>) -> form::Result<'r, Self> { - let duration = time_parse::duration::parse_nom(field.value).map_err(Box::from)?; - let duration = - Duration::from_std(duration).map_err(|x| -> Box { Box::new(x) })?; - Ok(Self(Some(duration))) - } -} - -#[post("/api/v1/pastes", data = "
")] -pub async fn api_insert_paste( - db: Db, - form: Form, -) -> Result, InsertionError> { - let identifier = db - .run(move |conn| { - paste::insert( - conn, - form.expiration.0.map(|expiration| Utc::now() + expiration), - &form.code, - ) - }) - .await?; - Ok(Cors(identifier)) -} diff --git a/src/routes/mod.rs b/src/routes/mod.rs index fb4c81b..20ab2dc 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -mod api_insert_paste_route; mod config_route; mod display_paste_route; mod index_route; @@ -22,7 +21,6 @@ mod insert_paste_route; mod metrics_route; mod raw_paste_route; -pub use api_insert_paste_route::*; pub use config_route::*; pub use display_paste_route::*; pub use index_route::*; diff --git a/templates/base.html.tera b/templates/base.html.tera index 0f5d776..026c171 100644 --- a/templates/base.html.tera +++ b/templates/base.html.tera @@ -4,17 +4,15 @@ p.ishan.pw {{ css_stylesheet() | safe }} - +