You've already forked AstralRinth
forked from didirus/AstralRinth
Taplo and typos in CI, TOML cleanup (#4510)
* Taplo and typos in CI * Clean up Cargo.toml files * Fix CI * Fix CI * Run typos in CI * Loosen typos a bit * Fix typos * Fix taplo * Switch to Tombi * Fix Tombi errors * Remove unused typos config * Tombi fmt * Remove extraneous cargo fmt * fix typos
This commit is contained in:
@@ -1,136 +1,129 @@
|
||||
[package]
|
||||
name = "theseus"
|
||||
version = "1.0.0-local" # The actual version is set by the theseus-build workflow on tagging
|
||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||
# The actual version is set by the theseus-build workflow on tagging
|
||||
version = "1.0.0-local"
|
||||
edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
ariadne = { workspace = true }
|
||||
async-compression = { workspace = true, features = ["gzip", "tokio"] }
|
||||
async-recursion = { workspace = true }
|
||||
async-tungstenite = { workspace = true, features = [
|
||||
"tokio-runtime",
|
||||
"tokio-rustls-webpki-roots",
|
||||
] }
|
||||
async-walkdir = { workspace = true }
|
||||
async_zip = { workspace = true, features = [
|
||||
"bzip2",
|
||||
"chrono",
|
||||
"deflate",
|
||||
"deflate64",
|
||||
"tokio-fs",
|
||||
"zstd",
|
||||
] }
|
||||
base64 = { workspace = true }
|
||||
bytemuck = { workspace = true, features = ["extern_crate_alloc"] }
|
||||
bytes = { workspace = true, features = ["serde"] }
|
||||
chardetng = { workspace = true }
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
daedalus = { workspace = true }
|
||||
dashmap = { workspace = true, features = ["serde"] }
|
||||
data-url = { workspace = true }
|
||||
derive_more = { workspace = true, features = ["display"] }
|
||||
dirs = { workspace = true }
|
||||
discord-rich-presence = { workspace = true }
|
||||
dunce = { workspace = true }
|
||||
either = { workspace = true }
|
||||
encoding_rs = { workspace = true }
|
||||
enumset = { workspace = true }
|
||||
flate2 = { workspace = true }
|
||||
fs4 = { workspace = true, features = ["tokio"] }
|
||||
futures = { workspace = true, features = ["alloc", "async-await"] }
|
||||
heck = { workspace = true }
|
||||
hickory-resolver = { workspace = true }
|
||||
indicatif = { workspace = true, optional = true }
|
||||
itertools = { workspace = true }
|
||||
notify = { workspace = true }
|
||||
notify-debouncer-mini = { workspace = true }
|
||||
p256 = { workspace = true, features = ["ecdsa"] }
|
||||
paste = { workspace = true }
|
||||
path-util = { workspace = true }
|
||||
phf = { workspace = true }
|
||||
png = { workspace = true }
|
||||
quartz_nbt = { workspace = true, features = ["serde"] }
|
||||
quick-xml = { workspace = true, features = ["async-tokio"] }
|
||||
rand = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
reqwest = { workspace = true, features = [
|
||||
"brotli",
|
||||
"charset",
|
||||
"deflate",
|
||||
"gzip",
|
||||
"http2",
|
||||
"json",
|
||||
"macos-system-configuration",
|
||||
"multipart",
|
||||
"rustls-tls-webpki-roots",
|
||||
"stream",
|
||||
] }
|
||||
rgb = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
serde_ini.workspace = true
|
||||
serde_with.workspace = true
|
||||
sha1_smol.workspace = true
|
||||
sha2.workspace = true
|
||||
serde_ini = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_with = { workspace = true }
|
||||
sha1_smol = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
sqlx = { workspace = true, features = [
|
||||
"json",
|
||||
"macros",
|
||||
"migrate",
|
||||
"runtime-tokio",
|
||||
"sqlite",
|
||||
"uuid",
|
||||
] }
|
||||
sysinfo = { workspace = true, features = ["disk", "system"] }
|
||||
tauri = { workspace = true, features = ["unstable"], optional = true }
|
||||
tempfile = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { workspace = true, features = [
|
||||
"fs",
|
||||
"io-util",
|
||||
"macros",
|
||||
"net",
|
||||
"process",
|
||||
"sync",
|
||||
"time",
|
||||
] }
|
||||
tokio-util = { workspace = true, features = [
|
||||
"compat",
|
||||
"io",
|
||||
"io-util",
|
||||
"time",
|
||||
] }
|
||||
tracing = { workspace = true }
|
||||
tracing-error = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, features = ["chrono", "env-filter"] }
|
||||
url = { workspace = true, features = ["serde"] }
|
||||
uuid = { workspace = true, features = ["serde", "v4"] }
|
||||
zip.workspace = true
|
||||
async_zip = { workspace = true, features = [
|
||||
"chrono",
|
||||
"tokio-fs",
|
||||
"deflate",
|
||||
"bzip2",
|
||||
"zstd",
|
||||
"deflate64",
|
||||
] }
|
||||
flate2.workspace = true
|
||||
tempfile.workspace = true
|
||||
dashmap = { workspace = true, features = ["serde"] }
|
||||
quick-xml = { workspace = true, features = ["async-tokio"] }
|
||||
enumset.workspace = true
|
||||
chardetng.workspace = true
|
||||
encoding_rs.workspace = true
|
||||
png.workspace = true
|
||||
bytemuck = { workspace = true, features = ["extern_crate_alloc"] }
|
||||
rgb.workspace = true
|
||||
phf.workspace = true
|
||||
itertools.workspace = true
|
||||
derive_more = { workspace = true, features = ["display"] }
|
||||
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
daedalus.workspace = true
|
||||
dirs.workspace = true
|
||||
|
||||
regex.workspace = true
|
||||
sysinfo = { workspace = true, features = ["system", "disk"] }
|
||||
thiserror.workspace = true
|
||||
either.workspace = true
|
||||
data-url.workspace = true
|
||||
|
||||
tracing.workspace = true
|
||||
tracing-subscriber = { workspace = true, features = ["chrono", "env-filter"] }
|
||||
tracing-error.workspace = true
|
||||
|
||||
paste.workspace = true
|
||||
heck.workspace = true
|
||||
|
||||
tauri = { workspace = true, optional = true, features = ["unstable"] }
|
||||
indicatif = { workspace = true, optional = true }
|
||||
|
||||
async-tungstenite = { workspace = true, features = ["tokio-runtime", "tokio-rustls-webpki-roots"] }
|
||||
futures = { workspace = true, features = ["async-await", "alloc"] }
|
||||
reqwest = { workspace = true, features = [
|
||||
"json",
|
||||
"stream",
|
||||
"deflate",
|
||||
"gzip",
|
||||
"brotli",
|
||||
"rustls-tls-webpki-roots",
|
||||
"charset",
|
||||
"http2",
|
||||
"macos-system-configuration",
|
||||
"multipart",
|
||||
] }
|
||||
tokio = { workspace = true, features = [
|
||||
"time",
|
||||
"io-util",
|
||||
"net",
|
||||
"sync",
|
||||
"fs",
|
||||
"macros",
|
||||
"process",
|
||||
] }
|
||||
tokio-util = { workspace = true, features = ["compat", "io", "io-util", "time"] }
|
||||
async-recursion.workspace = true
|
||||
fs4 = { workspace = true, features = ["tokio"] }
|
||||
async-walkdir.workspace = true
|
||||
async-compression = { workspace = true, features = ["tokio", "gzip"] }
|
||||
|
||||
notify.workspace = true
|
||||
notify-debouncer-mini.workspace = true
|
||||
|
||||
dunce.workspace = true
|
||||
|
||||
whoami.workspace = true
|
||||
|
||||
discord-rich-presence.workspace = true
|
||||
|
||||
p256 = { workspace = true, features = ["ecdsa"] }
|
||||
rand.workspace = true
|
||||
base64.workspace = true
|
||||
|
||||
sqlx = { workspace = true, features = [
|
||||
"runtime-tokio",
|
||||
"sqlite",
|
||||
"macros",
|
||||
"migrate",
|
||||
"json",
|
||||
"uuid",
|
||||
] }
|
||||
|
||||
quartz_nbt = { workspace = true, features = ["serde"] }
|
||||
|
||||
hickory-resolver.workspace = true
|
||||
zbus.workspace = true
|
||||
|
||||
ariadne.workspace = true
|
||||
path-util.workspace = true
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg.workspace = true
|
||||
windows = { workspace = true, features = ["Networking_Connectivity"] }
|
||||
windows-core.workspace = true
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
cidre = { workspace = true, features = ["nw", "blocks"] }
|
||||
whoami = { workspace = true }
|
||||
zbus = { workspace = true }
|
||||
zip = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
dotenvy.workspace = true
|
||||
dunce.workspace = true
|
||||
dotenvy = { workspace = true }
|
||||
dunce = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
cidre = { workspace = true, features = ["blocks", "nw"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { workspace = true, features = ["Networking_Connectivity"] }
|
||||
windows-core = { workspace = true }
|
||||
winreg = { workspace = true }
|
||||
|
||||
[features]
|
||||
tauri = ["dep:tauri"]
|
||||
cli = ["dep:indicatif"]
|
||||
tauri = ["dep:tauri"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -120,11 +120,11 @@ fn parse_server_address_inner(
|
||||
let mut port = None;
|
||||
if !port_str.is_empty() {
|
||||
if port_str.starts_with('+') {
|
||||
return Err(format!("Unparseable port number: {port_str}"));
|
||||
return Err(format!("Unparsable port number: {port_str}"));
|
||||
}
|
||||
port = port_str.parse::<u16>().ok();
|
||||
if port.is_none() {
|
||||
return Err(format!("Unparseable port number: {port_str}"));
|
||||
return Err(format!("Unparsable port number: {port_str}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ use uuid::Uuid;
|
||||
const CLI_PROGRESS_BAR_TOTAL: u64 = 1000;
|
||||
|
||||
/*
|
||||
Events are a way we can communciate with the Tauri frontend from the Rust backend.
|
||||
Events are a way we can communicate with the Tauri frontend from the Rust backend.
|
||||
We include a feature flag for Tauri, so that we can compile this code without Tauri.
|
||||
|
||||
To use events, we need to do the following:
|
||||
1) Make sure we are using the tauri feature flag
|
||||
2) Initialize the EventState with EventState::init() *before* initializing the theseus State
|
||||
3) Call emit_x functions to send events to the frontend
|
||||
For emit_loading() specifically, we need to inialize the loading bar with init_loading() first and pass the received loader in
|
||||
For emit_loading() specifically, we need to initialize the loading bar with init_loading() first and pass the received loader in
|
||||
|
||||
For example:
|
||||
pub async fn loading_function() -> crate::Result<()> {
|
||||
@@ -306,7 +306,7 @@ pub async fn emit_friend(payload: FriendPayload) -> crate::Result<()> {
|
||||
// loading_join! macro
|
||||
// loading_join!(key: Option<&LoadingBarId>, total: f64, message: Option<&str>; task1, task2, task3...)
|
||||
// This will submit a loading event with the given message for each task as they complete
|
||||
// task1, task2, task3 are async tasks that yuo want to to join on await on
|
||||
// task1, task2, task3 are async tasks that you want to to join on await on
|
||||
// Key is the key to use for which loading bar to submit these results to- a LoadingBarId. If None, it does nothing
|
||||
// Total is the total amount of progress that the loading bar should take up by all futures in this (will be split evenly amongst them).
|
||||
// If message is Some(t) you will overwrite this loading bar's message with a custom one
|
||||
|
||||
@@ -24,7 +24,7 @@ pub async fn init_watcher() -> crate::Result<FileWatcher> {
|
||||
|
||||
tokio::task::spawn(async move {
|
||||
let span = tracing::span!(tracing::Level::INFO, "init_watcher");
|
||||
tracing::info!(parent: &span, "Initting watcher");
|
||||
tracing::info!(parent: &span, "Initing watcher");
|
||||
while let Some(res) = rx.recv().await {
|
||||
let _span = span.enter();
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@ version = "0.1.0"
|
||||
edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
uuid = { workspace = true, features = ["v4", "fast-rng", "serde"] }
|
||||
serde_bytes.workspace = true
|
||||
rand.workspace = true
|
||||
either.workspace = true
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
serde_cbor.workspace = true
|
||||
either = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_bytes = { workspace = true }
|
||||
serde_cbor = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
uuid = { workspace = true, features = ["fast-rng", "serde", "v4"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
[package]
|
||||
name = "daedalus"
|
||||
version = "0.2.3"
|
||||
authors = ["Jai A <jai@modrinth.com>"]
|
||||
edition.workspace = true
|
||||
license = "MIT"
|
||||
description = "Utilities for querying and parsing Minecraft metadata"
|
||||
repository = "https://github.com/modrinth/daedalus/"
|
||||
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
|
||||
keywords = ["minecraft", "launcher"]
|
||||
categories = ["game-development", "api-bindings"]
|
||||
readme = "README.md"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
repository = "https://github.com/modrinth/daedalus/"
|
||||
license = "MIT"
|
||||
keywords = ["launcher", "minecraft"]
|
||||
categories = ["api-bindings", "game-development"]
|
||||
include = ["Cargo.toml", "LICENSE", "README.md", "src/**/*.rs"]
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
thiserror.workspace = true
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -50,17 +50,17 @@ const links: Stage = {
|
||||
],
|
||||
} as ButtonAction,
|
||||
{
|
||||
id: 'links_unaccessible',
|
||||
id: 'links_inaccessible',
|
||||
type: 'button',
|
||||
label: 'Links are inaccessible',
|
||||
weight: 510,
|
||||
suggestedStatus: 'flagged',
|
||||
// Theoretically a conditional could go here to prevent overlap of misuse and unaccessible messages repeating while still allowing for a multi-select in each.
|
||||
// Theoretically a conditional could go here to prevent overlap of misuse and inaccessible messages repeating while still allowing for a multi-select in each.
|
||||
// if links_misused was selected, send nothing.
|
||||
message: async () => (await import('../messages/links/not_accessible.md?raw')).default,
|
||||
enablesActions: [
|
||||
{
|
||||
id: 'links_unaccessible_options',
|
||||
id: 'links_inaccessible_options',
|
||||
type: 'multi-select-chips',
|
||||
label: 'Warn of inaccessible link?',
|
||||
shouldShow: (project) => Boolean(project.source_url || project.discord_url),
|
||||
|
||||
134
packages/muralpay/src/lib.rs
Normal file
134
packages/muralpay/src/lib.rs
Normal file
@@ -0,0 +1,134 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod account;
|
||||
mod error;
|
||||
mod organization;
|
||||
mod payout;
|
||||
mod util;
|
||||
|
||||
pub use {account::*, error::*, organization::*, payout::*};
|
||||
|
||||
use rust_decimal::Decimal;
|
||||
use secrecy::SecretString;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::Deref;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub const API_URL: &str = "https://api.muralpay.com";
|
||||
pub const SANDBOX_API_URL: &str = "https://api-staging.muralpay.com";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct MuralPay {
|
||||
pub http: reqwest::Client,
|
||||
pub api_url: String,
|
||||
pub api_key: SecretString,
|
||||
pub transfer_api_key: Option<SecretString>,
|
||||
}
|
||||
|
||||
impl MuralPay {
|
||||
pub fn new(
|
||||
api_url: impl Into<String>,
|
||||
api_key: impl Into<SecretString>,
|
||||
transfer_api_key: Option<impl Into<SecretString>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
http: reqwest::Client::new(),
|
||||
api_url: api_url.into(),
|
||||
api_key: api_key.into(),
|
||||
transfer_api_key: transfer_api_key.map(Into::into),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
pub enum Blockchain {
|
||||
Ethereum,
|
||||
Polygon,
|
||||
Base,
|
||||
Celo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "SCREAMING-KEBAB-CASE")]
|
||||
pub enum CurrencyCode {
|
||||
Usd,
|
||||
Cop,
|
||||
Ars,
|
||||
Eur,
|
||||
Mxn,
|
||||
Brl,
|
||||
Clp,
|
||||
Pen,
|
||||
Bob,
|
||||
Crc,
|
||||
Zar,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum FiatAndRailCode {
|
||||
Usd,
|
||||
Cop,
|
||||
Ars,
|
||||
Eur,
|
||||
Mxn,
|
||||
Brl,
|
||||
Clp,
|
||||
Pen,
|
||||
Bob,
|
||||
Crc,
|
||||
Zar,
|
||||
UsdPeru,
|
||||
UsdChina,
|
||||
UsdPanama,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WalletDetails {
|
||||
pub blockchain: Blockchain,
|
||||
pub wallet_address: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TokenAmount {
|
||||
pub token_amount: Decimal,
|
||||
pub token_symbol: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct FiatAmount {
|
||||
pub fiat_amount: Decimal,
|
||||
pub fiat_currency_code: CurrencyCode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct SearchParams<Id> {
|
||||
pub limit: Option<u64>,
|
||||
pub next_id: Option<Id>,
|
||||
}
|
||||
|
||||
impl<Id: Deref<Target = Uuid> + Clone> SearchParams<Id> {
|
||||
pub fn to_query(&self) -> Vec<(&'static str, String)> {
|
||||
[
|
||||
self.limit.map(|limit| ("limit", limit.to_string())),
|
||||
self.next_id
|
||||
.clone()
|
||||
.map(|id| ("nextId", id.hyphenated().to_string())),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SearchResponse<Id, T> {
|
||||
pub total: u64,
|
||||
pub next_id: Option<Id>,
|
||||
pub results: Vec<T>,
|
||||
}
|
||||
@@ -3,10 +3,10 @@ name = "path-util"
|
||||
edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
typed-path.workspace = true
|
||||
serde.workspace = true
|
||||
derive_more = { workspace = true, features = ["display", "deref"] }
|
||||
itertools.workspace = true
|
||||
derive_more = { workspace = true, features = ["deref", "display"] }
|
||||
itertools = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
typed-path = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
Reference in New Issue
Block a user