Skip to content

Commit

Permalink
Merge pull request anspar#5 from Vahegian/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Vahegian authored May 14, 2022
2 parents b49489a + 7a17577 commit da7fa96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,19 +113,22 @@ async fn cache_dependencies(dep: &Vec<String>) -> Result<(), Box<dyn std::error:
}

#[get("/")]
pub async fn index(state: &State<AragState<'_>>) -> status::Custom<Html<String>> {
pub fn index(state: &State<AragState<'_>>) -> status::Custom<content::RawHtml<String>> {
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<AragState<'_>>) -> status::Custom<Json<String>> {
pub fn update(state: &State<AragState<'_>>) -> status::Custom<content::RawJson<String>> {
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]
Expand Down

0 comments on commit da7fa96

Please sign in to comment.