Compare commits

..

No commits in common. "c9f04ef957ee498f71ddafb99fab14266a110e16" and "6da77823100a815a35dfb00446d198f64896820c" have entirely different histories.

6 changed files with 189 additions and 110 deletions

View File

@ -12,6 +12,8 @@ test:
script: script:
- mkdir dist - mkdir dist
- touch dist/index.html - touch dist/index.html
- apt-get update
- apt-get -y install pkg-config
- cargo test - cargo test
build-ui: build-ui:
@ -38,6 +40,8 @@ build-x64-bin:
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script: script:
- apt-get update
- apt-get -y install libssl-dev pkg-config
- cargo build --release - cargo build --release
- cd target/release - cd target/release
- tar -czf ../../vade-linux-x64.tar.gz vade - tar -czf ../../vade-linux-x64.tar.gz vade

278
Cargo.lock generated
View File

@ -154,7 +154,6 @@ dependencies = [
"actix-codec 0.4.2", "actix-codec 0.4.2",
"actix-rt 2.6.0", "actix-rt 2.6.0",
"actix-service 2.0.2", "actix-service 2.0.2",
"actix-tls 3.0.2",
"actix-utils 3.0.0", "actix-utils 3.0.0",
"ahash", "ahash",
"base64", "base64",
@ -356,24 +355,6 @@ dependencies = [
"futures-util", "futures-util",
] ]
[[package]]
name = "actix-tls"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31ab31563b611fa822480b4255e8750cf0af9ce1b8b7bde298afe8447ef9333"
dependencies = [
"actix-codec 0.4.2",
"actix-rt 2.6.0",
"actix-service 2.0.2",
"actix-utils 3.0.0",
"futures-core",
"log",
"pin-project-lite 0.2.8",
"tokio-rustls 0.23.2",
"tokio-util 0.6.9",
"webpki-roots 0.22.2",
]
[[package]] [[package]]
name = "actix-utils" name = "actix-utils"
version = "2.0.0" version = "2.0.0"
@ -419,7 +400,7 @@ dependencies = [
"actix-service 1.0.6", "actix-service 1.0.6",
"actix-testing", "actix-testing",
"actix-threadpool", "actix-threadpool",
"actix-tls 2.0.0", "actix-tls",
"actix-utils 2.0.0", "actix-utils 2.0.0",
"actix-web-codegen 0.4.0", "actix-web-codegen 0.4.0",
"awc", "awc",
@ -456,7 +437,6 @@ dependencies = [
"actix-rt 2.6.0", "actix-rt 2.6.0",
"actix-server 2.0.0", "actix-server 2.0.0",
"actix-service 2.0.2", "actix-service 2.0.2",
"actix-tls 3.0.2",
"actix-utils 3.0.0", "actix-utils 3.0.0",
"actix-web-codegen 0.5.0-rc.2", "actix-web-codegen 0.5.0-rc.2",
"ahash", "ahash",
@ -891,6 +871,22 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536"
[[package]]
name = "core-foundation"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.2.1" version = "0.2.1"
@ -1035,6 +1031,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "fastrand"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
dependencies = [
"instant",
]
[[package]] [[package]]
name = "firestorm" name = "firestorm"
version = "0.5.0" version = "0.5.0"
@ -1071,6 +1076,21 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
"foreign-types-shared",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.0.1" version = "1.0.1"
@ -1395,16 +1415,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "hyper-rustls" name = "hyper-tls"
version = "0.23.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [ dependencies = [
"http", "bytes 1.1.0",
"hyper", "hyper",
"rustls 0.20.2", "native-tls",
"tokio 1.16.1", "tokio 1.16.1",
"tokio-rustls 0.23.2", "tokio-native-tls",
] ]
[[package]] [[package]]
@ -1770,6 +1790,24 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "native-tls"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]] [[package]]
name = "net2" name = "net2"
version = "0.2.37" version = "0.2.37"
@ -1873,6 +1911,39 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openssl"
version = "0.10.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"foreign-types",
"libc",
"once_cell",
"openssl-sys",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
dependencies = [
"autocfg",
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]] [[package]]
name = "ouroboros" name = "ouroboros"
version = "0.14.0" version = "0.14.0"
@ -2192,6 +2263,15 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.9" version = "0.11.9"
@ -2207,26 +2287,24 @@ dependencies = [
"http", "http",
"http-body", "http-body",
"hyper", "hyper",
"hyper-rustls", "hyper-tls",
"ipnet", "ipnet",
"js-sys", "js-sys",
"lazy_static", "lazy_static",
"log", "log",
"mime", "mime",
"native-tls",
"percent-encoding", "percent-encoding",
"pin-project-lite 0.2.8", "pin-project-lite 0.2.8",
"rustls 0.20.2",
"rustls-pemfile",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio 1.16.1", "tokio 1.16.1",
"tokio-rustls 0.23.2", "tokio-native-tls",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
"webpki-roots 0.22.2",
"winreg 0.7.0", "winreg 0.7.0",
] ]
@ -2328,29 +2406,8 @@ dependencies = [
"base64", "base64",
"log", "log",
"ring", "ring",
"sct 0.6.1", "sct",
"webpki 0.21.4", "webpki",
]
[[package]]
name = "rustls"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84"
dependencies = [
"log",
"ring",
"sct 0.7.0",
"webpki 0.22.0",
]
[[package]]
name = "rustls-pemfile"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9"
dependencies = [
"base64",
] ]
[[package]] [[package]]
@ -2374,6 +2431,16 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "schannel"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
dependencies = [
"lazy_static",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -2390,16 +2457,6 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "sct"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
dependencies = [
"ring",
"untrusted",
]
[[package]] [[package]]
name = "sea-orm" name = "sea-orm"
version = "0.5.0" version = "0.5.0"
@ -2486,6 +2543,29 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "security-framework"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]] [[package]]
name = "semver" name = "semver"
version = "0.9.0" version = "0.9.0"
@ -2738,7 +2818,7 @@ dependencies = [
"parking_lot", "parking_lot",
"percent-encoding", "percent-encoding",
"rust_decimal", "rust_decimal",
"rustls 0.19.1", "rustls",
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
@ -2750,8 +2830,8 @@ dependencies = [
"tokio-stream", "tokio-stream",
"url", "url",
"uuid", "uuid",
"webpki 0.21.4", "webpki",
"webpki-roots 0.21.1", "webpki-roots",
] ]
[[package]] [[package]]
@ -2783,7 +2863,7 @@ dependencies = [
"actix-rt 2.6.0", "actix-rt 2.6.0",
"once_cell", "once_cell",
"tokio 1.16.1", "tokio 1.16.1",
"tokio-rustls 0.22.0", "tokio-rustls",
] ]
[[package]] [[package]]
@ -2871,6 +2951,20 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "tempfile"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
"cfg-if 1.0.0",
"fastrand",
"libc",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.30" version = "1.0.30"
@ -3041,26 +3135,25 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "tokio-native-tls"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
dependencies = [
"native-tls",
"tokio 1.16.1",
]
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.22.0" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
dependencies = [ dependencies = [
"rustls 0.19.1", "rustls",
"tokio 1.16.1", "tokio 1.16.1",
"webpki 0.21.4", "webpki",
]
[[package]]
name = "tokio-rustls"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b"
dependencies = [
"rustls 0.20.2",
"tokio 1.16.1",
"webpki 0.22.0",
] ]
[[package]] [[package]]
@ -3515,32 +3608,13 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "webpki"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
dependencies = [
"ring",
"untrusted",
]
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.21.1" version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
dependencies = [ dependencies = [
"webpki 0.21.4", "webpki",
]
[[package]]
name = "webpki-roots"
version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449"
dependencies = [
"webpki 0.22.0",
] ]
[[package]] [[package]]

View File

@ -16,7 +16,7 @@ actix-web-actors = "4.0.0-beta.6"
chrono = { version = "0.4.19", features = ["serde"] } chrono = { version = "0.4.19", features = ["serde"] }
serde = { version = "1.0.136", features= [ "derive" ] } serde = { version = "1.0.136", features= [ "derive" ] }
serde_json = "1.0.78" serde_json = "1.0.78"
actix-web = { version = "4.0.0-rc.2", features = ["rustls"] } actix-web = "4.0.0-rc.2"
actix-rt = "2.6.0" actix-rt = "2.6.0"
tracing-test = "0.2.1" tracing-test = "0.2.1"
tracing-actix-web = "0.5.0-rc.1" tracing-actix-web = "0.5.0-rc.1"
@ -29,7 +29,7 @@ rand = "0.8.4"
tokio = { verison = "1", features=["full"] } tokio = { verison = "1", features=["full"] }
base64 = "0.13.0" base64 = "0.13.0"
sqlx = { version = "^0.5", features=["sqlite", "migrate"] } sqlx = { version = "^0.5", features=["sqlite", "migrate"] }
reqwest = { version = "0.11.9", features = ["rustls-tls"], default-features=false } reqwest = { version = "0.11.9", features = ["native-tls"] }
[target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.jemallocator] [target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.jemallocator]

View File

@ -97,8 +97,9 @@ pub mod test_prelude {
/// Sets up a testing state with an in-memory database and creates the scheme. /// Sets up a testing state with an in-memory database and creates the scheme.
pub async fn setup_state() -> Result<actix_web::web::Data<AppState>> { pub async fn setup_state() -> Result<actix_web::web::Data<AppState>> {
let pool = sqlx::SqlitePool::connect("sqlite::memory:").await?; let pool = sqlx::SqlitePool::connect(":memory:").await?;
sqlx::migrate!("./migrations").run(&pool).await?; sqlx::migrate!("./migrations").run(&pool).await?;
tracing::info!("Database migrated");
let db = sea_orm::SqlxSqliteConnector::from_sqlx_sqlite_pool(pool); let db = sea_orm::SqlxSqliteConnector::from_sqlx_sqlite_pool(pool);

View File

@ -62,7 +62,7 @@ impl actix_web::error::ResponseError for Error {
fn status_code(&self) -> actix_web::http::StatusCode { fn status_code(&self) -> actix_web::http::StatusCode {
match self.code { match self.code {
ErrorCode::UnAuthorized => StatusCode::UNAUTHORIZED, ErrorCode::UnAuthorized => StatusCode::UNAUTHORIZED,
ErrorCode::NoSetup => StatusCode::UPGRADE_REQUIRED, ErrorCode::NoSetup => StatusCode::OK,
_ => StatusCode::INTERNAL_SERVER_ERROR, _ => StatusCode::INTERNAL_SERVER_ERROR,
} }
} }

View File

@ -191,14 +191,14 @@ export default {
} }
}, },
async reload() { async reload() {
this.applications = (await axios.get("/api/applications")).data.items || []; this.applications = (await axios.get("/api/applications")).data.items;
this.applicationCategories = ( this.applicationCategories = (
await axios.get("/api/application_categories") await axios.get("/api/application_categories")
).data.items || []; ).data.items;
this.bookmarks = (await axios.get("/api/bookmarks")).data.items || []; this.bookmarks = (await axios.get("/api/bookmarks")).data.items;
this.bookmarkCategories = ( this.bookmarkCategories = (
await axios.get("/api/bookmark_categories") await axios.get("/api/bookmark_categories")
).data.items || []; ).data.items;
this.editApp = {}; this.editApp = {};
this.editAppCat = {}; this.editAppCat = {};