From 149bdd95970474007bec3d78f052ba276edbb715 Mon Sep 17 00:00:00 2001 From: Vahe Date: Sat, 14 May 2022 18:20:21 +0200 Subject: [PATCH 1/2] fix rocket type error --- .github/workflows/release.yml | 12 ++++++++---- Cargo.toml | 2 +- rust-toolchain | 1 + src/main.rs | 14 ++++++++------ 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 rust-toolchain diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39c768c..d62b6d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,9 +50,15 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v1 - - name: Build bin + + - name: Build Linux + if: matrix.config.os != 'windows-2022' run: VERSION=0.2.${{ github.run_number }} cargo build --release + - name: Build Win + if: matrix.config.os == 'windows-2022' + run: SET VERSION=0.2.${{ github.run_number }} & cargo build --release + - name: Upload release if: matrix.config.os != 'windows-2022' uses: actions/upload-release-asset@v1 @@ -73,6 +79,4 @@ jobs: upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./target/release/arag.exe asset_name: arag.exe - asset_content_type: application/octet-stream - - + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 1242ee9..c4180ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ console = "0.15.0" # MIT serde_yaml = "0.8" notify = "4.0.17" # CCO or Artistic License 2.0 minifier = "0.0.42" # MIT -rocket = { version = "0.5.0-rc.1", features = ["json"] } +rocket = { version = "0.5.0-rc.2", features = ["json"] } sha2 = "0.10.2" # MIT diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..f337c7f --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +stable-2022-01-20 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ca8b3fa..5e48c0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,7 @@ use opener; use rocket::fairing::AdHoc; use rocket::figment::Figment; use rocket::http::Status; -use rocket::response::content::{Html, Json}; -use rocket::response::status; +use rocket::response::{content, status}; use rocket::{tokio, State}; use std::env; use std::error::Error; @@ -114,19 +113,22 @@ async fn cache_dependencies(dep: &Vec) -> Result<(), Box>) -> status::Custom> { +pub fn index(state: &State>) -> status::Custom> { let state = &**state; let build = pkg(state.clone(), false); let mut su = state.files_updated.lock().unwrap(); *su = false; - status::Custom(Status::Ok, Html(build)) + status::Custom(Status::Ok, content::RawHtml(build)) } #[get("/update")] -pub async fn update(state: &State>) -> status::Custom> { +pub fn update(state: &State>) -> status::Custom> { let state = &**state; let fu = state.files_updated.lock().unwrap(); - status::Custom(Status::Ok, Json(format!("{{\"update\": {fu}}}"))) + status::Custom( + Status::Ok, + content::RawJson(format!("{{\"update\": {fu}}}")), + ) } #[rocket::main] From 7a17577e56503ba161e1ea1a888078913dfcd4ad Mon Sep 17 00:00:00 2001 From: Vahe Date: Sat, 14 May 2022 18:22:39 +0200 Subject: [PATCH 2/2] rm toolchain --- rust-toolchain | 1 - 1 file changed, 1 deletion(-) delete mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index f337c7f..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -stable-2022-01-20 \ No newline at end of file