Fixed scrollbar color

This commit is contained in:
Gregory Schier
2023-02-16 10:25:52 -08:00
parent c70ecdc330
commit 507aee40f7
25 changed files with 302 additions and 41 deletions

View File

@@ -3,6 +3,9 @@
windows_subsystem = "windows"
)]
use deno_core::JsRuntime;
use deno_core::RuntimeOptions;
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
@@ -15,22 +18,36 @@ struct CustomResponse {
body: String,
elapsed: u128,
elapsed2: u128,
url: String,
}
fn run_plugin() {
// Initialize a runtime instance
let mut runtime = JsRuntime::new(RuntimeOptions {
..Default::default()
});
runtime
.execute_script("deno", "Deno.core.print('Hello from Deno!\\n')")
.unwrap();
}
#[tauri::command]
async fn send_request(url: &str) -> Result<CustomResponse, String> {
run_plugin();
let start = std::time::Instant::now();
let mut url = url.to_string();
if !url.starts_with("http://") && !url.starts_with("https://") {
url = format!("http://{}", url);
let mut abs_url = url.to_string();
if !abs_url.starts_with("http://") && !abs_url.starts_with("https://") {
abs_url = format!("http://{}", url);
}
let resp = reqwest::get(url).await;
let resp = reqwest::get(abs_url.to_string()).await;
let elapsed = start.elapsed().as_millis();
match resp {
Ok(v) => {
let url2 = v.url().to_string();
let status = v.status().to_string();
let body = v.text().await.unwrap();
let elapsed2 = start.elapsed().as_millis();
@@ -39,6 +56,7 @@ async fn send_request(url: &str) -> Result<CustomResponse, String> {
body,
elapsed,
elapsed2,
url: url2,
})
}
Err(e) => Err(e.to_string()),