mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-10 04:22:13 +10:00
More refactoring and renaming camelCase struct definitions to snake_case
This commit is contained in:
@ -6,17 +6,15 @@ mod unpacker;
|
||||
|
||||
use auth::{auth_initiate, generate_authorization_header, recieve_handshake};
|
||||
use db::{fetch_base_url, DatabaseInterface, DATA_ROOT_DIR};
|
||||
use env_logger;
|
||||
use env_logger::Env;
|
||||
use http::{header::*, response::Builder as ResponseBuilder, status::StatusCode};
|
||||
use http::{header::*, response::Builder as ResponseBuilder};
|
||||
use library::{fetch_game, fetch_library, Game};
|
||||
use log::info;
|
||||
use remote::{gen_drop_url, use_remote};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
collections::HashMap, io, sync::{LazyLock, Mutex}, task, thread
|
||||
collections::HashMap, sync::{LazyLock, Mutex}
|
||||
};
|
||||
use structured_logger::{json::new_writer, Builder};
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
|
||||
#[derive(Clone, Copy, Serialize)]
|
||||
@ -63,14 +61,14 @@ fn setup<'a>() -> AppState {
|
||||
}
|
||||
|
||||
let auth_result = auth::setup().unwrap();
|
||||
return AppState {
|
||||
AppState {
|
||||
status: auth_result.0,
|
||||
user: auth_result.1,
|
||||
games: HashMap::new(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(|| db::setup());
|
||||
pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(db::setup);
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
@ -128,11 +126,8 @@ pub fn run() {
|
||||
app.deep_link().on_open_url(move |event| {
|
||||
info!("handling drop:// url");
|
||||
let binding = event.urls();
|
||||
let url = binding.get(0).unwrap();
|
||||
match url.host_str().unwrap() {
|
||||
"handshake" => recieve_handshake(handle.clone(), url.path().to_string()),
|
||||
_ => (),
|
||||
}
|
||||
let url = binding.first().unwrap();
|
||||
if url.host_str().unwrap() == "handshake" { recieve_handshake(handle.clone(), url.path().to_string()) }
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use std::{borrow::BorrowMut, sync::Mutex};
|
||||
use std::sync::Mutex;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
@ -7,18 +7,19 @@ use tauri::{AppHandle, Manager};
|
||||
use crate::{auth::generate_authorization_header, db::fetch_base_url, AppState};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all="camelCase")]
|
||||
pub struct Game {
|
||||
id: String,
|
||||
mName: String,
|
||||
mShortDescription: String,
|
||||
mDescription: String,
|
||||
m_name: String,
|
||||
m_short_description: String,
|
||||
m_description: String,
|
||||
// mDevelopers
|
||||
// mPublishers
|
||||
|
||||
mIconId: String,
|
||||
mBannerId: String,
|
||||
mCoverId: String,
|
||||
mImageLibrary: Vec<String>,
|
||||
m_icon_id: String,
|
||||
m_banner_id: String,
|
||||
m_cover_id: String,
|
||||
m_image_library: Vec<String>,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@ -54,7 +55,7 @@ pub fn fetch_library(app: AppHandle) -> Result<String, String> {
|
||||
|
||||
drop(handle);
|
||||
|
||||
return Ok(json!(games.clone()).to_string());
|
||||
Ok(json!(games.clone()).to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@ -66,5 +67,5 @@ pub fn fetch_game(id: String, app: tauri::AppHandle) -> Result<String, String> {
|
||||
return Ok(json!(game.unwrap()).to_string());
|
||||
}
|
||||
|
||||
return Ok("".to_string());
|
||||
Ok("".to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user