From 2b4dd6f137730abe48506affbe5c8f36a86772fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Wed, 28 Apr 2021 21:46:20 +0200 Subject: [PATCH 1/3] Fix branch name --- build.rs | 2 +- src/api/admin.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index bce425e8..39c16095 100644 --- a/build.rs +++ b/build.rs @@ -58,7 +58,7 @@ fn read_git_info() -> Result<(), std::io::Error> { // Combined version let version = if let Some(exact) = exact_tag { exact - } else if &branch != "master" { + } else if &branch != "main" && &branch != "master" { format!("{}-{} ({})", last_tag, rev_short, branch) } else { format!("{}-{}", last_tag, rev_short) diff --git a/src/api/admin.rs b/src/api/admin.rs index 407c96b2..6e168e7a 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -522,7 +522,7 @@ fn diagnostics(_token: AdminToken, ip_header: IpHeader, conn: DbConn) -> ApiResu Ok(r) => r.tag_name, _ => "-".to_string(), }, - match get_github_api::("https://api.github.com/repos/dani-garcia/vaultwarden/commits/master") { + match get_github_api::("https://api.github.com/repos/dani-garcia/vaultwarden/commits/main") { Ok(mut c) => { c.sha.truncate(8); c.sha From 1dc1d4df724a7159243f7558557ef2ba951dfbc5 Mon Sep 17 00:00:00 2001 From: Roger Kowalewski Date: Thu, 29 Apr 2021 10:04:08 +0200 Subject: [PATCH 2/3] update openssl crate to support LibreSSL 3.3.2 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index feab7340..2bcc26a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1514,9 +1514,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.33" +version = "0.10.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1543,9 +1543,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.61" +version = "0.9.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +checksum = "fa52160d45fa2e7608d504b7c3a3355afed615e6d8b627a74458634ba21b69bd" dependencies = [ "autocfg", "cc", diff --git a/Cargo.toml b/Cargo.toml index bb8ad8cb..078393aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ regex = { version = "1.4.5", features = ["std", "perf"], default-features = fals data-url = "0.1.0" # Used by U2F, JWT and Postgres -openssl = "0.10.33" +openssl = "0.10.34" # URL encoding library percent-encoding = "2.1.0" From 1e5306b8203a7ebe24047910e6c690c18c6d827a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Thu, 29 Apr 2021 15:58:29 +0200 Subject: [PATCH 3/3] Remove warning when compiling only with mysql and add compatibility mode with the old docker script names --- docker/start.sh | 10 ++++++++++ src/db/mod.rs | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docker/start.sh b/docker/start.sh index 993ddbd9..c3946c84 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -2,6 +2,9 @@ if [ -r /etc/vaultwarden.sh ]; then . /etc/vaultwarden.sh +elif [ -r /etc/bitwarden_rs.sh ]; then + echo "### You are using the old /etc/bitwarden_rs.sh script, please migrate to /etc/vaultwarden.sh ###" + . /etc/bitwarden_rs.sh fi if [ -d /etc/vaultwarden.d ]; then @@ -10,6 +13,13 @@ if [ -d /etc/vaultwarden.d ]; then . $f fi done +elif [ -d /etc/bitwarden_rs.d ]; then + echo "### You are using the old /etc/bitwarden_rs.d script directory, please migrate to /etc/vaultwarden.d ###" + for f in /etc/bitwarden_rs.d/*.sh; do + if [ -r $f ]; then + . $f + fi + done fi exec /vaultwarden "${@}" diff --git a/src/db/mod.rs b/src/db/mod.rs index 5ab4ba36..ba922427 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -1,4 +1,3 @@ -use chrono::prelude::*; use diesel::r2d2::{ConnectionManager, Pool, PooledConnection}; use rocket::{ http::Status, @@ -228,12 +227,11 @@ pub fn backup_database(conn: &DbConn) -> Result<(), Error> { use std::path::Path; let db_url = CONFIG.database_url(); let db_path = Path::new(&db_url).parent().unwrap().to_string_lossy(); - let file_date = Utc::now().format("%Y%m%d_%H%M%S").to_string(); + let file_date = chrono::Utc::now().format("%Y%m%d_%H%M%S").to_string(); diesel::sql_query(format!("VACUUM INTO '{}/db_{}.sqlite3'", db_path, file_date)).execute(conn)?; + Ok(()) } } - - Ok(()) } /// Get the SQL Server version