2023-03-31 11:00:43 -07:00
|
|
|
use serde::ser::SerializeStruct;
|
|
|
|
|
use serde::{Serialize, Serializer};
|
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
2023-03-31 18:44:26 -07:00
|
|
|
pub mod auth;
|
2023-07-22 12:37:19 -07:00
|
|
|
pub mod import;
|
2023-04-07 13:31:06 -07:00
|
|
|
pub mod jre;
|
2023-05-03 09:02:34 -07:00
|
|
|
pub mod logs;
|
2023-04-17 14:05:27 -07:00
|
|
|
pub mod metadata;
|
2025-07-02 21:32:15 +01:00
|
|
|
pub mod minecraft_skins;
|
2023-08-04 23:38:34 -07:00
|
|
|
pub mod mr_auth;
|
2023-04-05 19:04:09 -07:00
|
|
|
pub mod pack;
|
2023-04-05 10:07:59 -07:00
|
|
|
pub mod process;
|
2023-03-31 11:00:43 -07:00
|
|
|
pub mod profile;
|
|
|
|
|
pub mod profile_create;
|
2023-04-03 13:46:04 -07:00
|
|
|
pub mod settings;
|
2023-04-05 10:07:59 -07:00
|
|
|
pub mod tags;
|
2023-06-02 07:09:46 -07:00
|
|
|
pub mod utils;
|
2023-03-31 11:00:43 -07:00
|
|
|
|
2024-08-28 21:44:08 -07:00
|
|
|
pub mod ads;
|
2024-07-24 11:03:19 -07:00
|
|
|
pub mod cache;
|
App redesign (#2946)
* Start of app redesign
* format
* continue progress
* Content page nearly done
* Fix recursion issues with content page
* Fix update all alignment
* Discover page progress
* Settings progress
* Removed unlocked-size hack that breaks web
* Revamp project page, refactor web project page to share code with app, fixed loading bar, misc UI/UX enhancements, update ko-fi logo, update arrow icons, fix web issues caused by floating-vue migration, fix tooltip issues, update web tooltips, clean up web hydration issues
* Ads + run prettier
* Begin auth refactor, move common messages to ui lib, add i18n extraction to all apps, begin Library refactor
* fix ads not hiding when plus log in
* rev lockfile changes/conflicts
* Fix sign in page
* Add generated
* (mostly) Data driven search
* Fix search mobile issue
* profile fixes
* Project versions page, fix typescript on UI lib and misc fixes
* Remove unused gallery component
* Fix linkfunction err
* Search filter controls at top, localization for locked filters
* Fix provided filter names
* Fix navigating from instance browse to main browse
* Friends frontend (#2995)
* Friends system frontend
* (almost) finish frontend
* finish friends, fix lint
* Fix lint
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
* Refresh macOS app icon
* Update web search UI more
* Fix link opens
* Fix frontend build
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-12-11 19:54:18 -08:00
|
|
|
pub mod friends;
|
2025-04-26 18:09:58 -07:00
|
|
|
pub mod worlds;
|
2024-07-24 11:03:19 -07:00
|
|
|
|
2025-07-23 00:55:18 +02:00
|
|
|
mod oauth_utils;
|
|
|
|
|
|
2023-05-22 18:11:31 -07:00
|
|
|
pub type Result<T> = std::result::Result<T, TheseusSerializableError>;
|
2023-03-31 11:00:43 -07:00
|
|
|
|
2023-05-22 18:11:31 -07:00
|
|
|
// // Main returnable Theseus GUI error
|
|
|
|
|
// // Needs to be Serializable to be returned to the JavaScript side
|
|
|
|
|
// #[derive(Error, Debug, Serialize)]
|
|
|
|
|
// pub enum TheseusGuiError {
|
|
|
|
|
// #[error(transparent)]
|
|
|
|
|
// Serializable(),
|
|
|
|
|
// }
|
2023-03-31 11:00:43 -07:00
|
|
|
|
|
|
|
|
// Serializable error intermediary, so TheseusGuiError can be Serializable (eg: so that we can return theseus::Errors in Tauri directly)
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
|
pub enum TheseusSerializableError {
|
2023-04-21 17:45:50 -04:00
|
|
|
#[error("{0}")]
|
2023-03-31 11:00:43 -07:00
|
|
|
Theseus(#[from] theseus::Error),
|
|
|
|
|
|
|
|
|
|
#[error("IO error: {0}")]
|
|
|
|
|
IO(#[from] std::io::Error),
|
2023-06-30 08:11:32 -07:00
|
|
|
|
2024-04-15 13:58:20 -07:00
|
|
|
#[error("Tauri error: {0}")]
|
|
|
|
|
Tauri(#[from] tauri::Error),
|
2024-08-30 10:42:58 -07:00
|
|
|
|
|
|
|
|
#[cfg(feature = "updater")]
|
2025-09-29 09:28:31 -06:00
|
|
|
#[error("Updater error: {0}")]
|
|
|
|
|
Updater(#[from] tauri_plugin_updater::Error),
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "updater")]
|
|
|
|
|
#[error("HTTP error: {0}")]
|
|
|
|
|
Http(#[from] tauri_plugin_http::reqwest::Error),
|
2023-03-31 11:00:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Generic implementation of From<T> for ErrorTypeA
|
2023-05-22 18:11:31 -07:00
|
|
|
// impl<T> From<T> for TheseusGuiError
|
|
|
|
|
// where
|
|
|
|
|
// TheseusSerializableError: From<T>,
|
|
|
|
|
// {
|
|
|
|
|
// fn from(error: T) -> Self {
|
|
|
|
|
// TheseusGuiError::Serializable(TheseusSerializableError::from(error))
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2023-03-31 11:00:43 -07:00
|
|
|
|
|
|
|
|
// This is a very simple macro that implements a very basic Serializable for each variant of TheseusSerializableError,
|
|
|
|
|
// where the field is the string. (This allows easy extension to errors without many match arms)
|
|
|
|
|
macro_rules! impl_serialize {
|
|
|
|
|
($($variant:ident),* $(,)?) => {
|
|
|
|
|
impl Serialize for TheseusSerializableError {
|
|
|
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
|
|
|
where
|
|
|
|
|
S: Serializer,
|
|
|
|
|
{
|
|
|
|
|
match self {
|
2023-05-08 12:14:08 -07:00
|
|
|
// For the Theseus variant, we add a special display for the error,
|
|
|
|
|
// to view the spans if subscribed to them (which is information that is lost when serializing)
|
|
|
|
|
TheseusSerializableError::Theseus(theseus_error) => {
|
|
|
|
|
$crate::error::display_tracing_error(theseus_error);
|
|
|
|
|
|
|
|
|
|
let mut state = serializer.serialize_struct("Theseus", 2)?;
|
|
|
|
|
state.serialize_field("field_name", "Theseus")?;
|
|
|
|
|
state.serialize_field("message", &theseus_error.to_string())?;
|
|
|
|
|
state.end()
|
|
|
|
|
}
|
2023-03-31 11:00:43 -07:00
|
|
|
$(
|
|
|
|
|
TheseusSerializableError::$variant(message) => {
|
|
|
|
|
let mut state = serializer.serialize_struct(stringify!($variant), 2)?;
|
|
|
|
|
state.serialize_field("field_name", stringify!($variant))?;
|
|
|
|
|
state.serialize_field("message", &message.to_string())?;
|
|
|
|
|
state.end()
|
|
|
|
|
},
|
|
|
|
|
)*
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use the macro to implement Serialize for TheseusSerializableError
|
2024-08-30 10:42:58 -07:00
|
|
|
#[cfg(not(feature = "updater"))]
|
|
|
|
|
impl_serialize! {
|
|
|
|
|
IO,
|
|
|
|
|
Tauri,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "updater")]
|
2023-03-31 11:00:43 -07:00
|
|
|
impl_serialize! {
|
2023-06-30 08:11:32 -07:00
|
|
|
IO,
|
2024-04-15 13:58:20 -07:00
|
|
|
Tauri,
|
2025-09-29 09:28:31 -06:00
|
|
|
Updater,
|
|
|
|
|
Http,
|
2023-03-31 11:00:43 -07:00
|
|
|
}
|