start implementing sentry propperly
All checks were successful
Build and Test / fast-racing-neo (push) Successful in 16m31s
Build and Test / splatoon (push) Successful in 17m7s
Build and Test / puyopuyo (push) Successful in 17m7s
Build and Test / mario-tennis (push) Successful in 17m17s
Build and Test / minecraft-wiiu (push) Successful in 17m20s
Build and Test / wii-u-chat (push) Successful in 17m20s
Build and Test / splatoon-testfire (push) Successful in 17m23s
Build and Test / wii-sports-club (push) Successful in 17m25s
Build and Test / super-mario-maker (push) Successful in 21m26s
Build and Test / sonic-transformed (push) Successful in 28m35s
Build and Test / friends (push) Successful in 29m31s
All checks were successful
Build and Test / fast-racing-neo (push) Successful in 16m31s
Build and Test / splatoon (push) Successful in 17m7s
Build and Test / puyopuyo (push) Successful in 17m7s
Build and Test / mario-tennis (push) Successful in 17m17s
Build and Test / minecraft-wiiu (push) Successful in 17m20s
Build and Test / wii-u-chat (push) Successful in 17m20s
Build and Test / splatoon-testfire (push) Successful in 17m23s
Build and Test / wii-sports-club (push) Successful in 17m25s
Build and Test / super-mario-maker (push) Successful in 21m26s
Build and Test / sonic-transformed (push) Successful in 28m35s
Build and Test / friends (push) Successful in 29m31s
This commit is contained in:
parent
84509aec2e
commit
7dd502aa7a
21 changed files with 1182 additions and 237 deletions
969
Cargo.lock
generated
969
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -13,4 +13,4 @@ echo CHECKING $EDITION
|
|||
echo FEATURES:
|
||||
echo $EDITION_FEATURES
|
||||
|
||||
cargo check --features "$EDITION_FEATURES"
|
||||
RUSTFLAGS="--deny warnings" cargo check --features "$EDITION_FEATURES"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use proc_macro::TokenStream;
|
|||
use proc_macro2::Ident;
|
||||
use quote::quote;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{parse_macro_input, Data, DeriveInput, Lit, LitStr};
|
||||
use syn::{parse_macro_input, Data, DeriveInput};
|
||||
|
||||
#[proc_macro_derive(RmcSerialize, attributes(extends, rmc_struct))]
|
||||
pub fn rmc_serialize(input: TokenStream) -> TokenStream {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use proc_macro2::{Literal, Span, TokenStream};
|
||||
use quote::{quote, ToTokens};
|
||||
use syn::{
|
||||
bracketed, ext, parse::Parse, punctuated::Punctuated, token::Bracket, DataEnum, DataStruct,
|
||||
bracketed, parse::Parse, punctuated::Punctuated, token::Bracket, DataEnum, DataStruct,
|
||||
DeriveInput, Field, Fields, Ident, LitStr, Meta, Token, Variant,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
use proxy::edge_node_dc_callback;
|
||||
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::common::with_setup;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup();
|
||||
with_setup(async || {
|
||||
let param = ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
|
||||
.expect("unable to get startup parameters");
|
||||
|
||||
let param = ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
|
||||
.expect("unable to get startup parameters");
|
||||
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||
|
||||
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||
|
||||
proxy::start_insecure(param).await;
|
||||
proxy::start_insecure(param).await;
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
use proxy::edge_node_dc_callback;
|
||||
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::common::with_setup;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup();
|
||||
with_setup(async || {
|
||||
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
||||
.expect("unable to get startup parameters");
|
||||
|
||||
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
||||
.expect("unable to get startup parameters");
|
||||
|
||||
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||
proxy::start_secure(param).await;
|
||||
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||
proxy::start_secure(param).await;
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ async-trait = "0.1.89"
|
|||
ctor = "1.0.7"
|
||||
nex-account = { version = "0.2.1", registry = "spbr" }
|
||||
tonic = "0.14.6"
|
||||
tracing = { version = "0.1.44", features = ["log"] }
|
||||
tracing-subscriber = "0.3.23"
|
||||
sentry-tracing = "0.48.4"
|
||||
sentry = { version = "0.48.4", features = ["tracing"] }
|
||||
|
||||
[dev-dependencies]
|
||||
# criterion = "0.7.0"
|
||||
|
|
|
|||
|
|
@ -1,38 +1,48 @@
|
|||
use chrono::{Local, SecondsFormat};
|
||||
use log::LevelFilter;
|
||||
use simplelog::{ColorChoice, CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger};
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::borrow::Cow;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
pub fn setup() {
|
||||
pub fn rnex_release() -> String {
|
||||
let edition_piece = if let Some(e) = option_env!("EDITION") {
|
||||
format!("{}", e)
|
||||
} else {
|
||||
env!("FEATURESET").into()
|
||||
};
|
||||
|
||||
format!(
|
||||
"rnex {} v{}({})",
|
||||
edition_piece,
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
env!("GIT_HASH")
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn with_setup(f: impl AsyncFnOnce()) {
|
||||
println!("setting up logger and dotenv");
|
||||
CombinedLogger::init(vec![
|
||||
TermLogger::new(
|
||||
LevelFilter::Info,
|
||||
Config::default(),
|
||||
TerminalMode::Mixed,
|
||||
ColorChoice::Auto,
|
||||
),
|
||||
WriteLogger::new(LevelFilter::max(), Config::default(), {
|
||||
fs::create_dir_all("log").unwrap();
|
||||
let date = Local::now().to_rfc3339_opts(SecondsFormat::Secs, false);
|
||||
// this fixes windows being windows
|
||||
let date = date.replace(":", "-");
|
||||
let filename = format!("{}.log", date);
|
||||
if cfg!(windows) {
|
||||
File::create(format!("log\\{}", filename)).unwrap()
|
||||
} else {
|
||||
File::create(format!("log/{}", filename)).unwrap()
|
||||
}
|
||||
}),
|
||||
])
|
||||
.unwrap();
|
||||
dotenv::dotenv().ok();
|
||||
let _maybe_sentry = if let Ok(sentry_url) = std::env::var("SENTRY_URL") {
|
||||
Some(sentry::init((
|
||||
sentry_url,
|
||||
sentry::ClientOptions {
|
||||
release: Some(Cow::Owned(rnex_release())),
|
||||
send_default_pii: true,
|
||||
..Default::default()
|
||||
},
|
||||
)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.with(sentry::integrations::tracing::layer())
|
||||
.try_init()
|
||||
.expect("failed to init tracing subscriber");
|
||||
|
||||
f().await;
|
||||
|
||||
/*ctrlc::set_handler(||{
|
||||
FORCE_EXIT.call_once_force(|_|{
|
||||
println!("attempting exit");
|
||||
});
|
||||
}).unwrap();*/
|
||||
|
||||
dotenv::dotenv().ok();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::common::with_setup;
|
||||
use rnex_core::executables::common::{SECURE_SERVER_ACCOUNT, new_simple_backend};
|
||||
use rnex_core::nex::auth_handler::AuthHandler;
|
||||
use rnex_core::reggie::EdgeNodeHolderConnectOption::DontRegister;
|
||||
|
|
@ -21,27 +21,28 @@ pub static FORWARD_EDGE_NODE_HOLDER: Lazy<SocketAddrV4> = Lazy::new(|| {
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup();
|
||||
with_setup(async || {
|
||||
let conn = TcpStream::connect(&*FORWARD_EDGE_NODE_HOLDER)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let conn = TcpStream::connect(&*FORWARD_EDGE_NODE_HOLDER)
|
||||
.await
|
||||
.unwrap();
|
||||
let conn: SplittableBufferConnection = conn.into();
|
||||
|
||||
let conn: SplittableBufferConnection = conn.into();
|
||||
conn.send(DontRegister.to_data().unwrap()).await;
|
||||
|
||||
conn.send(DontRegister.to_data().unwrap()).await;
|
||||
let conn = new_rmc_gateway_connection(conn, |r| {
|
||||
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
||||
});
|
||||
|
||||
let conn = new_rmc_gateway_connection(conn, |r| {
|
||||
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
||||
});
|
||||
|
||||
new_simple_backend(move |_, _| {
|
||||
let controller = conn.clone();
|
||||
Arc::new(AuthHandler {
|
||||
destination_server_acct: &SECURE_SERVER_ACCOUNT,
|
||||
build_name: env!("AUTH_REPORT_VERSION"),
|
||||
control_server: controller,
|
||||
new_simple_backend(move |_, _| {
|
||||
let controller = conn.clone();
|
||||
Arc::new(AuthHandler {
|
||||
destination_server_acct: &SECURE_SERVER_ACCOUNT,
|
||||
build_name: env!("AUTH_REPORT_VERSION"),
|
||||
control_server: controller,
|
||||
})
|
||||
})
|
||||
.await;
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,32 @@
|
|||
use cfg_if::cfg_if;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::common::with_setup;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup();
|
||||
with_setup(async || {
|
||||
#[cfg(feature = "database-support")]
|
||||
{
|
||||
use rnex_core::executables::common::DB_POOL;
|
||||
use sqlx::PgPool;
|
||||
let database_url = std::env::var("RNEX_DATASTORE_DATABASE_URL")
|
||||
.expect("RNEX_DATASTORE_DATABASE_URL must be set");
|
||||
|
||||
#[cfg(feature = "database-support")]
|
||||
{
|
||||
use rnex_core::executables::common::DB_POOL;
|
||||
use sqlx::PgPool;
|
||||
let database_url = std::env::var("RNEX_DATASTORE_DATABASE_URL")
|
||||
.expect("RNEX_DATASTORE_DATABASE_URL must be set");
|
||||
let pool = PgPool::connect(&database_url)
|
||||
.await
|
||||
.expect("Failed to create pool");
|
||||
|
||||
let pool = PgPool::connect(&database_url)
|
||||
.await
|
||||
.expect("Failed to create pool");
|
||||
|
||||
DB_POOL.set(pool).expect("failed to set global DB_POOL");
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "friends")]{
|
||||
use rnex_core::executables::friends_backend::start_friends_backend;
|
||||
start_friends_backend().await;
|
||||
} else {
|
||||
use rnex_core::executables::regular_backend;
|
||||
regular_backend::start_regular_backend().await
|
||||
DB_POOL.set(pool).expect("failed to set global DB_POOL");
|
||||
}
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "friends")]{
|
||||
use rnex_core::executables::friends_backend::start_friends_backend;
|
||||
start_friends_backend().await;
|
||||
} else {
|
||||
use rnex_core::executables::regular_backend;
|
||||
regular_backend::start_regular_backend().await
|
||||
}
|
||||
}
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,9 +162,8 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
use crate::executables::common::{IP_REQ_SERVICE_URLS, try_get_ip};
|
||||
use crate::executables::common::try_get_ip;
|
||||
|
||||
#[test]
|
||||
fn get_ip() {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
use std::io::Cursor;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::{Arc, Weak};
|
||||
use macros::rmc_struct;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::sync::RwLock;
|
||||
use rnex_core::common::setup;
|
||||
use rnex_core::common::with_setup;
|
||||
use rnex_core::executables::common::{OWN_IP_PRIVATE, SERVER_PORT};
|
||||
use rnex_core::reggie::{EdgeNodeHolderConnectOption, EdgeNodeManagement, LocalEdgeNodeHolder};
|
||||
use rnex_core::rmc::protocols::new_rmc_gateway_connection;
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
use rnex_core::util::SplittableBufferConnection;
|
||||
use std::io::Cursor;
|
||||
use std::net::SocketAddrV4;
|
||||
use std::sync::{Arc, Weak};
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[rmc_struct(EdgeNodeHolder)]
|
||||
struct EdgeNode{
|
||||
struct EdgeNode {
|
||||
data_holder: Arc<DataHolder>,
|
||||
address: SocketAddrV4
|
||||
address: SocketAddrV4,
|
||||
}
|
||||
|
||||
impl EdgeNodeManagement for EdgeNode{
|
||||
impl EdgeNodeManagement for EdgeNode {
|
||||
async fn get_url(&self, seed: u64) -> Result<SocketAddrV4, ErrorCode> {
|
||||
self.data_holder.get_url(seed).await
|
||||
}
|
||||
|
|
@ -26,18 +26,18 @@ impl EdgeNodeManagement for EdgeNode{
|
|||
|
||||
#[rmc_struct(EdgeNodeHolder)]
|
||||
#[derive(Default)]
|
||||
struct DataHolder{
|
||||
edge_nodes: RwLock<Vec<Weak<EdgeNode>>>
|
||||
struct DataHolder {
|
||||
edge_nodes: RwLock<Vec<Weak<EdgeNode>>>,
|
||||
}
|
||||
|
||||
impl EdgeNodeManagement for DataHolder{
|
||||
impl EdgeNodeManagement for DataHolder {
|
||||
async fn get_url(&self, seed: u64) -> Result<SocketAddrV4, ErrorCode> {
|
||||
let nodes = self.edge_nodes.read().await;
|
||||
|
||||
let nodes: Vec<_> = nodes.iter().filter_map(|n| n.upgrade()).collect();
|
||||
|
||||
// avoid a devide by zero
|
||||
if nodes.len() == 0{
|
||||
if nodes.len() == 0 {
|
||||
return Err(ErrorCode::Core_InvalidIndex);
|
||||
};
|
||||
|
||||
|
|
@ -49,43 +49,44 @@ impl EdgeNodeManagement for DataHolder{
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup();
|
||||
with_setup(async || {
|
||||
log::error!("test");
|
||||
let listen = TcpListener::bind(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let listen = TcpListener::bind(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT)).await.unwrap();
|
||||
let holder: Arc<DataHolder> = Default::default();
|
||||
|
||||
let holder: Arc<DataHolder> = Default::default();
|
||||
while let Ok((stream, _addr)) = listen.accept().await {
|
||||
let mut conn: SplittableBufferConnection = stream.into();
|
||||
|
||||
while let Ok((stream, _addr)) = listen.accept().await {
|
||||
let mut conn: SplittableBufferConnection = stream.into();
|
||||
let Some(data) = conn.recv().await else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Some(data) = conn.recv().await else {
|
||||
continue;
|
||||
};
|
||||
let Ok(data) = EdgeNodeHolderConnectOption::deserialize(&mut Cursor::new(data)) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Ok(data) = EdgeNodeHolderConnectOption::deserialize(&mut Cursor::new(data)) else {
|
||||
continue;
|
||||
};
|
||||
let holder = holder.clone();
|
||||
|
||||
let holder = holder.clone();
|
||||
match data {
|
||||
EdgeNodeHolderConnectOption::DontRegister => {
|
||||
new_rmc_gateway_connection(conn, |_| holder);
|
||||
}
|
||||
EdgeNodeHolderConnectOption::Register(address) => {
|
||||
let edge_node = EdgeNode {
|
||||
address,
|
||||
data_holder: holder.clone(),
|
||||
};
|
||||
|
||||
match data{
|
||||
EdgeNodeHolderConnectOption::DontRegister => {
|
||||
let node = new_rmc_gateway_connection(conn, move |_| Arc::new(edge_node));
|
||||
|
||||
new_rmc_gateway_connection(conn, |_| holder);
|
||||
},
|
||||
EdgeNodeHolderConnectOption::Register(address) => {
|
||||
let edge_node = EdgeNode{
|
||||
address,
|
||||
data_holder: holder.clone()
|
||||
};
|
||||
|
||||
let node = new_rmc_gateway_connection(conn, move |_| Arc::new(edge_node));
|
||||
|
||||
let mut nodes = holder.edge_nodes.write().await;
|
||||
nodes.push(Arc::downgrade(&node));
|
||||
let mut nodes = holder.edge_nodes.write().await;
|
||||
nodes.push(Arc::downgrade(&node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
use crate::grpc::account::Error::SomethingHappened;
|
||||
use json::{JsonValue, object};
|
||||
use nex_account::grpc::Pid;
|
||||
use nex_account::grpc::nex_account_service_client::NexAccountServiceClient;
|
||||
use once_cell::sync::Lazy;
|
||||
use rnex_core::PID;
|
||||
use std::array::TryFromSliceError;
|
||||
use std::ops::Deref;
|
||||
use std::sync::LazyLock;
|
||||
use std::{env, result};
|
||||
use thiserror::Error;
|
||||
use tokio::task::{JoinError, spawn_blocking};
|
||||
use tokio::task::JoinError;
|
||||
use tonic::transport::Channel;
|
||||
|
||||
static API_KEY: Lazy<String> = Lazy::new(|| {
|
||||
|
|
@ -69,7 +66,7 @@ impl Client {
|
|||
Ok(nexkey)
|
||||
}
|
||||
|
||||
pub async fn get_user_level(&mut self, pid: PID) -> Result<i32> {
|
||||
pub async fn get_user_level(&mut self, _pid: PID) -> Result<i32> {
|
||||
// let req = self
|
||||
// .do_request(object! {
|
||||
// "query": r"query($pid: Int!){
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ use cfg_if::cfg_if;
|
|||
use chrono::{Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc};
|
||||
use hmac::Hmac;
|
||||
use hmac::Mac;
|
||||
use md5::digest::generic_array::GenericArray;
|
||||
use md5::{Digest, Md5};
|
||||
use rc4::KeyInit;
|
||||
use rc4::cipher::StreamCipherCoreWrapper;
|
||||
use rc4::{Rc4, Rc4Core, StreamCipher};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
use std::collections::{HashMap, HashSet};
|
||||
use std::io::{Cursor, Write};
|
||||
use std::ops::Deref;
|
||||
use std::process::id;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, atomic::AtomicU32};
|
||||
use std::sync::{LazyLock, Weak};
|
||||
use std::time::Duration;
|
||||
use std::{env, mem};
|
||||
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
use bytemuck::{Pod, Zeroable, bytes_of};
|
||||
use chrono::{NaiveDateTime, TimeZone, Utc};
|
||||
use futures::StreamExt;
|
||||
use hex::decode;
|
||||
use hmac::Mac;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use chrono::{TimeZone, Utc};
|
||||
use log::info;
|
||||
use macros::rmc_struct;
|
||||
use rnex_core::rmc::protocols::account_management::{
|
||||
|
|
@ -56,13 +49,11 @@ use rnex_core::PID;
|
|||
|
||||
use rnex_core::rmc::protocols::account_management::NintendoCreateAccountData;
|
||||
use rnex_core::rmc::protocols::nintendo_notification::NintendoNotificationEvent;
|
||||
use rnex_core::rmc::structures::RmcSerialize;
|
||||
|
||||
use rnex_core::rmc::structures::data::Data;
|
||||
|
||||
use crate::executables::common::get_db;
|
||||
|
||||
use crate::kerberos;
|
||||
use crate::rmc::protocols::friends_3ds::{
|
||||
FriendComment, FriendMii, FriendMiiList, FriendPersistentInfo, FriendPicture, FriendPresence,
|
||||
FriendRelationship, Mii, MiiList, MyProfile, NintendoPresence, PlayedGame,
|
||||
|
|
@ -71,7 +62,6 @@ use crate::rmc::protocols::friends_wiiu::FriendRequestMessage;
|
|||
use crate::rmc::protocols::nintendo_notification::NintendoNotificationEventGeneral;
|
||||
use crate::rmc::response::ErrorCode::FPD_InvalidArgument;
|
||||
use nex_account::grpc::ActCreateInfo;
|
||||
use nex_account::grpc::nex_account_service_client::NexAccountServiceClient;
|
||||
use nex_account::{derive_pid_hmac, grpc_client};
|
||||
use rnex_core::rmc::structures::qbuffer::QBuffer;
|
||||
|
||||
|
|
@ -146,27 +136,27 @@ impl FriendsManager {
|
|||
|
||||
// ALL of this is stubbed
|
||||
impl Friends3DS for FriendsUser {
|
||||
async fn update_profile(&self, profile: MyProfile) -> Result<(), ErrorCode> {
|
||||
async fn update_profile(&self, _profile: MyProfile) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_mii(&self, profile: Mii) -> Result<(), ErrorCode> {
|
||||
async fn update_mii(&self, _profile: Mii) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_mii_list(&self, profile: MiiList) -> Result<(), ErrorCode> {
|
||||
async fn update_mii_list(&self, _profile: MiiList) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_played_games(&self, profile: Vec<PlayedGame>) -> Result<(), ErrorCode> {
|
||||
async fn update_played_games(&self, _profile: Vec<PlayedGame>) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_preference(
|
||||
&self,
|
||||
show_online_status: bool,
|
||||
show_current_title: bool,
|
||||
block_friend_requests: bool,
|
||||
_show_online_status: bool,
|
||||
_show_current_title: bool,
|
||||
_block_friend_requests: bool,
|
||||
) -> Result<(), ErrorCode> {
|
||||
// stubbed
|
||||
Ok(())
|
||||
|
|
@ -174,7 +164,7 @@ impl Friends3DS for FriendsUser {
|
|||
|
||||
async fn get_friend_mii(
|
||||
&self,
|
||||
friends: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
_friends: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
) -> Result<Vec<FriendMii>, ErrorCode> {
|
||||
// sorry for the copying pretendo but i don't have a mii on hand rn
|
||||
let data: Vec<u8> = vec![
|
||||
|
|
@ -205,30 +195,30 @@ impl Friends3DS for FriendsUser {
|
|||
|
||||
async fn get_friend_mii_list(
|
||||
&self,
|
||||
friends: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
_friends: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
) -> Result<Vec<FriendMiiList>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn is_active_game(
|
||||
&self,
|
||||
unk: Vec<u32>,
|
||||
game_key: crate::rmc::protocols::friends_3ds::GameKey,
|
||||
_unk: Vec<u32>,
|
||||
_game_key: crate::rmc::protocols::friends_3ds::GameKey,
|
||||
) -> Result<Vec<u32>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn get_principal_id_by_local_friend_code(
|
||||
&self,
|
||||
unk1: u64,
|
||||
unk2: Vec<u64>,
|
||||
_unk1: u64,
|
||||
_unk2: Vec<u64>,
|
||||
) -> Result<Vec<FriendRelationship>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn get_friend_relationships(
|
||||
&self,
|
||||
unk2: Vec<u32>,
|
||||
_unk2: Vec<u32>,
|
||||
) -> Result<Vec<FriendRelationship>, ErrorCode> {
|
||||
let dummy = FriendRelationship {
|
||||
data: Data {},
|
||||
|
|
@ -240,23 +230,27 @@ impl Friends3DS for FriendsUser {
|
|||
Ok(vec![dummy])
|
||||
}
|
||||
|
||||
async fn add_friend_by_pid(&self, unk: u64, pid: PID) -> Result<FriendRelationship, ErrorCode> {
|
||||
async fn add_friend_by_pid(
|
||||
&self,
|
||||
_unk: u64,
|
||||
_pid: PID,
|
||||
) -> Result<FriendRelationship, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn add_friend_by_lst_pid(
|
||||
&self,
|
||||
unk: u64,
|
||||
pid: Vec<PID>,
|
||||
_unk: u64,
|
||||
_pid: Vec<PID>,
|
||||
) -> Result<Vec<FriendRelationship>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn remove_friend_by_local_code(&self, local_code: u64) -> Result<(), ErrorCode> {
|
||||
async fn remove_friend_by_local_code(&self, _local_code: u64) -> Result<(), ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn remove_friend_by_pid(&self, pid: PID) -> Result<(), ErrorCode> {
|
||||
async fn remove_friend_by_pid(&self, _pid: PID) -> Result<(), ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
|
|
@ -295,8 +289,8 @@ impl Friends3DS for FriendsUser {
|
|||
|
||||
async fn update_presence(
|
||||
&self,
|
||||
nintendo_presence: NintendoPresence,
|
||||
unk: bool,
|
||||
_nintendo_presence: NintendoPresence,
|
||||
_unk: bool,
|
||||
) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -310,11 +304,11 @@ impl Friends3DS for FriendsUser {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_comment(&self, comment: String) -> Result<(), ErrorCode> {
|
||||
async fn update_comment(&self, _comment: String) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_picture(&self, unk: u32, picture: Vec<u8>) -> Result<(), ErrorCode> {
|
||||
async fn update_picture(&self, _unk: u32, _picture: Vec<u8>) -> Result<(), ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
|
|
@ -348,18 +342,18 @@ impl Friends3DS for FriendsUser {
|
|||
|
||||
async fn get_friend_comment(
|
||||
&self,
|
||||
unk: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
_unk: Vec<crate::rmc::protocols::friends_3ds::FriendInfo>,
|
||||
) -> Result<Vec<FriendComment>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn get_friend_picture(&self, unk: Vec<u32>) -> Result<Vec<FriendPicture>, ErrorCode> {
|
||||
async fn get_friend_picture(&self, _unk: Vec<u32>) -> Result<Vec<FriendPicture>, ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
|
||||
async fn get_friend_persistent_info(
|
||||
&self,
|
||||
unk: Vec<u32>,
|
||||
_unk: Vec<u32>,
|
||||
) -> Result<Vec<FriendPersistentInfo>, ErrorCode> {
|
||||
let dummypersistentinfo = FriendPersistentInfo {
|
||||
data: Data {},
|
||||
|
|
@ -383,7 +377,7 @@ impl Friends3DS for FriendsUser {
|
|||
Ok(vec![dummypersistentinfo])
|
||||
}
|
||||
|
||||
async fn send_invitation(&self, unk: Vec<u32>) -> Result<(), ErrorCode> {
|
||||
async fn send_invitation(&self, _unk: Vec<u32>) -> Result<(), ErrorCode> {
|
||||
Err(ErrorCode::Core_NotImplemented)
|
||||
}
|
||||
}
|
||||
|
|
@ -594,7 +588,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
|
||||
let mut friends = Vec::with_capacity(friends_raw.len());
|
||||
|
||||
for mut friend in friends_raw {
|
||||
for friend in friends_raw {
|
||||
let Some(friend_since) = friend.since else {
|
||||
println!("this should absolutely never happen(psql messed up somehow)");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
|
|
@ -737,7 +731,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
}
|
||||
|
||||
async fn remove_friend(&self, friend: PID) -> Result<(), ErrorCode> {
|
||||
let Ok(query) = query!(
|
||||
let Ok(_) = query!(
|
||||
"delete from friendships where (pid_a = $1 AND pid_b = $2) OR (pid_a = $2 AND pid_b = $1)",
|
||||
self.pid,
|
||||
friend
|
||||
|
|
@ -791,15 +785,15 @@ impl FriendsWiiU for FriendsUser {
|
|||
async fn add_friend_request(
|
||||
&self,
|
||||
friend: PID,
|
||||
mut unk1: u8,
|
||||
_unk1: u8,
|
||||
message: String,
|
||||
mut unk2: u8,
|
||||
_unk2: u8,
|
||||
unk3: String,
|
||||
game_key: GameKey,
|
||||
unk4: KerberosDateTime,
|
||||
) -> Result<(FriendRequest, FriendInfo), ErrorCode> {
|
||||
unk1 = 0;
|
||||
unk2 = 1;
|
||||
let unk1 = 0;
|
||||
let unk2 = 1;
|
||||
|
||||
if self.fm.denies_friend_requests(friend).await? {
|
||||
return Err(ErrorCode::FPD_FriendRequestNotAllowed);
|
||||
|
|
@ -1087,7 +1081,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.await
|
||||
{
|
||||
Ok(_) => {}
|
||||
Err(e) => return Err(ErrorCode::FPD_FriendAlreadyAdded),
|
||||
Err(_) => return Err(ErrorCode::FPD_FriendAlreadyAdded),
|
||||
};
|
||||
|
||||
let Ok(query) = query!(
|
||||
|
|
@ -1571,7 +1565,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
|
||||
async fn delete_persistent_notification(
|
||||
&self,
|
||||
notifs: Vec<PersistentNotification>,
|
||||
_notifs: Vec<PersistentNotification>,
|
||||
) -> Result<(), ErrorCode> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -1750,7 +1744,7 @@ impl AccountManagement for FriendsGuest {
|
|||
let nexkey = client
|
||||
.create_new_sequential_or_update_and_get_account(new_account)
|
||||
.await
|
||||
.map_err(|e| ErrorCode::Core_Unknown)?
|
||||
.map_err(|_| ErrorCode::Core_Unknown)?
|
||||
.into_inner();
|
||||
|
||||
if nexkey.key.len() != 16 {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
use futures::future::join_all;
|
||||
use log::warn;
|
||||
use rnex_core::PID;
|
||||
use rnex_core::define_rmc_proto;
|
||||
use rnex_core::kerberos::KerberosDateTime;
|
||||
|
|
@ -791,7 +789,7 @@ impl NatTraversal for User {
|
|||
.await
|
||||
.ok();
|
||||
}
|
||||
if let Some(user) = self.self_join_ticket_requesters.lock().await.take(&cid) {
|
||||
if let Some(_user) = self.self_join_ticket_requesters.lock().await.take(&cid) {
|
||||
self.join_tickets_stage2_sender
|
||||
.send(ConnectionTicket { cid, result })
|
||||
.await
|
||||
|
|
@ -891,7 +889,7 @@ impl Utility for User {
|
|||
return Ok(rand::random());
|
||||
}
|
||||
|
||||
async fn get_integer_settings(&self, index: u32) -> Result<Vec<(u16, i32)>, ErrorCode> {
|
||||
async fn get_integer_settings(&self, _index: u32) -> Result<Vec<(u16, i32)>, ErrorCode> {
|
||||
Ok(vec![(0, 1), (1, 2), (2, 0), (3, 4)])
|
||||
}
|
||||
}
|
||||
|
|
@ -1017,7 +1015,7 @@ impl MessageDelivery for User {
|
|||
async fn deliver_message(&self, mut message: Any<UserMessage>) -> Result<(), ErrorCode> {
|
||||
let mut msg = message.get()?;
|
||||
|
||||
let users = match msg.recipient_type {
|
||||
let _users = match msg.recipient_type {
|
||||
1 => {
|
||||
let Some(user) = self
|
||||
.matchmake_manager
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use macros::{RmcSerialize, method_id, rmc_proto, rmc_struct};
|
||||
use macros::{RmcSerialize, method_id, rmc_proto};
|
||||
use rnex_core::PID;
|
||||
use rnex_core::kerberos::KerberosDateTime;
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
|
|
@ -273,7 +273,7 @@ pub struct DataStoreChangeMetaParam {
|
|||
pub struct DataStoreUploadCourseRecordParam {
|
||||
pub dataid: i64,
|
||||
pub slot: u8,
|
||||
pub score: i32
|
||||
pub score: i32,
|
||||
}
|
||||
|
||||
#[derive(RmcSerialize, Clone, Default, Debug)]
|
||||
|
|
@ -338,15 +338,9 @@ pub struct DataStoreGetCustomRankingParam {
|
|||
#[rmc_proto(115)]
|
||||
pub trait DataStore {
|
||||
#[method_id(4)]
|
||||
async fn delete_object(
|
||||
&self,
|
||||
param: DataStoreDeleteParam,
|
||||
) -> Result<(), ErrorCode>;
|
||||
async fn delete_object(&self, param: DataStoreDeleteParam) -> Result<(), ErrorCode>;
|
||||
#[method_id(8)]
|
||||
async fn get_meta(
|
||||
&self,
|
||||
metaparam: GetMetaParam,
|
||||
) -> Result<GetMetaInfo, ErrorCode>;
|
||||
async fn get_meta(&self, metaparam: GetMetaParam) -> Result<GetMetaInfo, ErrorCode>;
|
||||
#[method_id(24)]
|
||||
async fn prepare_post_object(
|
||||
&self,
|
||||
|
|
@ -358,8 +352,8 @@ pub trait DataStore {
|
|||
prepare_get_param: DataStorePrepareGetParam,
|
||||
) -> Result<DataStoreReqGetInfo, ErrorCode>;
|
||||
#[method_id(26)]
|
||||
async fn complete_post_object(&self, completeparam: CompletePostParam
|
||||
) -> Result<(), ErrorCode>;
|
||||
async fn complete_post_object(&self, completeparam: CompletePostParam)
|
||||
-> Result<(), ErrorCode>;
|
||||
#[method_id(36)]
|
||||
async fn get_metas_multiple_param(
|
||||
&self,
|
||||
|
|
@ -411,10 +405,7 @@ pub trait DataStore {
|
|||
application_id: u32,
|
||||
) -> Result<Vec<String>, ErrorCode>;
|
||||
#[method_id(38)]
|
||||
async fn change_meta(
|
||||
&self,
|
||||
param: DataStoreChangeMetaParam
|
||||
) -> Result<(), ErrorCode>;
|
||||
async fn change_meta(&self, param: DataStoreChangeMetaParam) -> Result<(), ErrorCode>;
|
||||
#[method_id(40)]
|
||||
async fn rate_objects(
|
||||
&self,
|
||||
|
|
@ -431,7 +422,7 @@ pub trait DataStore {
|
|||
#[method_id(57)]
|
||||
async fn complete_attach_file(
|
||||
&self,
|
||||
complete_attach_param: CompletePostParam
|
||||
complete_attach_param: CompletePostParam,
|
||||
) -> Result<String, ErrorCode>;
|
||||
#[method_id(59)]
|
||||
async fn prepare_attach_file(
|
||||
|
|
@ -441,7 +432,7 @@ pub trait DataStore {
|
|||
#[method_id(71)]
|
||||
async fn upload_course_record(
|
||||
&self,
|
||||
upload_course_record_param: DataStoreUploadCourseRecordParam
|
||||
upload_course_record_param: DataStoreUploadCourseRecordParam,
|
||||
) -> Result<(), ErrorCode>;
|
||||
#[method_id(72)]
|
||||
async fn get_course_record(
|
||||
|
|
@ -462,6 +453,6 @@ pub trait DataStore {
|
|||
#[method_id(87)]
|
||||
async fn report_course(
|
||||
&self,
|
||||
report_course_param: DataStoreReportCourseParam
|
||||
report_course_param: DataStoreReportCourseParam,
|
||||
) -> Result<(), ErrorCode>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
use macros::{method_id, rmc_proto};
|
||||
|
||||
use crate::rmc::{
|
||||
protocols::messaging::UserMessage,
|
||||
response::ErrorCode,
|
||||
structures::{Error, any::Any},
|
||||
};
|
||||
use crate::rmc::{protocols::messaging::UserMessage, response::ErrorCode, structures::any::Any};
|
||||
|
||||
#[rmc_proto(27)]
|
||||
pub trait MessageDelivery {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ impl<T: RmcStruct> Any<T> {
|
|||
mod test {
|
||||
use std::io::Cursor;
|
||||
|
||||
use macros::{RmcSerialize, rmc_struct};
|
||||
use macros::RmcSerialize;
|
||||
|
||||
use crate::rmc::structures::RmcSerialize;
|
||||
use crate::rmc::structures::any::Any;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
use crate::rmc::structures::helpers::DummyWriter;
|
||||
use async_trait::async_trait;
|
||||
use ctor::ctor;
|
||||
use std::io::{Read, Write};
|
||||
use std::string::FromUtf8Error;
|
||||
use std::sync::RwLock;
|
||||
|
|
|
|||
Loading…
Reference in a new issue