From ad0d222c9655dcc32671b9b285309af16623c5b2 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Sun, 30 Nov 2025 17:26:26 -0600 Subject: [PATCH] Add the (currently android) easter mode --- Cargo.lock | 121 ++++++++++++++++++------------------------- Cargo.toml | 3 +- src/android.rs | 6 +-- src/ios.rs | 2 +- src/lib.rs | 7 ++- src/router/global.rs | 60 +++++++++++++-------- src/router/start.rs | 2 +- src/runtime.rs | 11 ++++ 8 files changed, 110 insertions(+), 102 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4d6ca9..dda865d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.12.0" +version = "4.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2233f53f6cb18ae038ce1f0713ca0c72ca0c4b71fe9aaeb59924ce2c89c6dd85" +checksum = "1654a77ba142e37f049637a3e5685f864514af11fcbc51cb51eb6596afe5b8d6" dependencies = [ "actix-codec", "actix-http", @@ -182,7 +182,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.46" +version = "1.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" +checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" dependencies = [ "find-msvc-tools", "jobserver", @@ -455,7 +455,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -577,7 +577,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", "unicode-xid", ] @@ -611,7 +611,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -642,7 +642,6 @@ dependencies = [ "hex", "hmac", "include-flate-codegen", - "include_dir", "jni", "json", "lazy_static", @@ -869,12 +868,11 @@ dependencies = [ [[package]] name = "http" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -1009,7 +1007,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", "zstd", ] @@ -1023,25 +1021,6 @@ dependencies = [ "zstd", ] -[[package]] -name = "include_dir" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" -dependencies = [ - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "indexmap" version = "2.12.1" @@ -1119,9 +1098,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -1719,9 +1698,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" +checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" dependencies = [ "zeroize", ] @@ -1791,7 +1770,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -1849,9 +1828,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.6" +version = "1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" dependencies = [ "libc", ] @@ -1959,9 +1938,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.110" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -1976,7 +1955,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -1996,7 +1975,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -2071,9 +2050,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" dependencies = [ "log", "pin-project-lite", @@ -2083,20 +2062,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", ] @@ -2144,12 +2123,12 @@ dependencies = [ [[package]] name = "ureq-proto" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b4531c118335662134346048ddb0e54cc86bd7e81866757873055f0e38f5d2" +checksum = "d81f9efa9df032be5934a46a068815a10a042b494b6a58cb0a1a97bb5467ed6f" dependencies = [ "base64", - "http 1.3.1", + "http 1.4.0", "httparse", "log", ] @@ -2240,9 +2219,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", @@ -2253,9 +2232,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2263,22 +2242,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] @@ -2582,28 +2561,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.28" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.28" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] @@ -2623,7 +2602,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", "synstructure", ] @@ -2663,7 +2642,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.111", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 37908ce..5e3daed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ cbc = { version = "0.1.2", features = ["alloc"] } aes = "0.8.4" pem = "3.0.6" ureq = "3.1.4" -include_dir = { version = "0.7.4", optional = true } [target.aarch64-linux-android.dependencies] jni = { version = "0.21.1", features = ["invocation", "default"] } @@ -41,7 +40,7 @@ cc = "1.0" # To enable this library you MUST comment out lib block below and add --features library [features] -library = ["dep:include_dir"] +library = [] #[lib] #crate-type = ["cdylib"] diff --git a/src/android.rs b/src/android.rs index 4941742..927ff3e 100644 --- a/src/android.rs +++ b/src/android.rs @@ -33,10 +33,10 @@ extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_startServer<'l data_path: JString<'local>, easter: jboolean ) -> jstring { - //crate::runtime::set_easter_mode(easter != 0); + crate::runtime::set_easter_mode(easter != 0); let data_path: String = env.get_string(&data_path).unwrap().into(); - crate::runtime::update_data_path(data_path); + crate::runtime::update_data_path(&data_path); let output = env.new_string(String::from("Azunyannnn~")).unwrap(); thread::spawn(|| { @@ -56,5 +56,5 @@ extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_stopServer<'lo #[unsafe(no_mangle)] extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_setEasterMode<'local>(_env: JNIEnv<'local>, _class: JClass<'local>, easter: jboolean) { - //crate::runtime::set_easter_mode(easter != 0); + crate::runtime::set_easter_mode(easter != 0); } diff --git a/src/ios.rs b/src/ios.rs index 876bdb7..9380539 100644 --- a/src/ios.rs +++ b/src/ios.rs @@ -7,7 +7,7 @@ pub static INITIALIZER: extern "C" fn() = main; #[unsafe(no_mangle)] pub extern "C" fn main() { let data_path = get_bundle_path().into_os_string().into_string().unwrap(); - crate::runtime::update_data_path(data_path); + crate::runtime::update_data_path(&data_path); std::thread::spawn(|| { crate::run_server(true).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 5a279ca..8963ff2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,12 @@ pub async fn run_server(in_thread: bool) -> std::io::Result<()> { let rv = HttpServer::new(|| App::new() .wrap_fn(|req, srv| { - println!("Request: {}", req.path()); + println!("Request: {} {}", req.method(), req.path()); + + #[cfg(feature = "library")] + #[cfg(target_os = "android")] + log_to_logcat!("ew", "Request: {} {}", req.method(), req.path()); + srv.call(req) }) .app_data(web::PayloadConfig::default().limit(1024 * 1024 * 25)) diff --git a/src/router/global.rs b/src/router/global.rs index ecf8360..be8d947 100644 --- a/src/router/global.rs +++ b/src/router/global.rs @@ -9,40 +9,54 @@ use uuid::Uuid; use crate::encryption; use crate::router::{userdata, gree, items}; +use crate::runtime::get_easter_mode; -pub const ASSET_VERSION: &str = "5260ff15dff8ba0c00ad91400f515f55"; -pub const ASSET_HASH_ANDROID: &str = "d210b28037885f3ef56b8f8aa45ac95b"; -pub const ASSET_HASH_IOS: &str = "dd7175e4bcdab476f38c33c7f34b5e4d"; +pub const ASSET_VERSION_GL: &str = "5260ff15dff8ba0c00ad91400f515f55"; +pub const ASSET_HASH_ANDROID_GL: &str = "d210b28037885f3ef56b8f8aa45ac95b"; +pub const ASSET_HASH_IOS_GL: &str = "dd7175e4bcdab476f38c33c7f34b5e4d"; -pub const ASSET_VERSION_JP: &str = "4c921d2443335e574a82e04ec9ea243c"; -pub const ASSET_HASH_ANDROID_JP: &str = "67f8f261c16b3cca63e520a25aad6c1c"; -pub const ASSET_HASH_IOS_JP: &str = "b8975be8300013a168d061d3fdcd4a16"; +pub const ASSET_VERSION_JP: &str = "4c921d2443335e574a82e04ec9ea243c"; +pub const ASSET_HASH_ANDROID_JP: &str = "67f8f261c16b3cca63e520a25aad6c1c"; +pub const ASSET_HASH_IOS_JP: &str = "b8975be8300013a168d061d3fdcd4a16"; + +pub const ASSET_HASH_ANDROID_EASTER_GL: &str = "da7ae831381c3f29337caa9891db7e6a"; +pub const ASSET_HASH_ANDROID_EASTER_JP: &str = "eac0cad61c82bf2e31fc596555747d11"; pub fn get_asset_hash(asset_version: String, android: bool) -> String { let args = crate::get_args(); - if asset_version == ASSET_VERSION_JP { - if android { + if android { + if asset_version == ASSET_VERSION_JP { if args.jp_android_asset_hash != String::new() { - args.jp_android_asset_hash + &args.jp_android_asset_hash + } else if get_easter_mode() { + ASSET_HASH_ANDROID_EASTER_JP } else { - ASSET_HASH_ANDROID_JP.to_string() + ASSET_HASH_ANDROID_JP } - } else if args.jp_ios_asset_hash != String::new() { - args.jp_ios_asset_hash } else { - ASSET_HASH_IOS_JP.to_string() + if args.en_android_asset_hash != String::new() { + &args.en_android_asset_hash + } else if get_easter_mode() { + ASSET_HASH_ANDROID_EASTER_GL + } else { + ASSET_HASH_ANDROID_GL + } } - } else if android { - if args.en_android_asset_hash != String::new() { - args.en_android_asset_hash - } else { - ASSET_HASH_ANDROID.to_string() - } - } else if args.en_ios_asset_hash != String::new() { - args.en_ios_asset_hash } else { - ASSET_HASH_IOS.to_string() - } + if asset_version == ASSET_VERSION_JP { + if args.jp_ios_asset_hash != String::new() { + &args.jp_ios_asset_hash + } else { + ASSET_HASH_IOS_JP + } + } else { + if args.en_ios_asset_hash != String::new() { + &args.en_ios_asset_hash + } else { + ASSET_HASH_IOS_GL + } + } + }.to_string() } pub fn create_token() -> String { diff --git a/src/router/start.rs b/src/router/start.rs index 9d55ba7..b6ebbb1 100644 --- a/src/router/start.rs +++ b/src/router/start.rs @@ -5,7 +5,7 @@ use crate::encryption; use crate::router::{userdata, global}; fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String { - if body["asset_version"] != global::ASSET_VERSION && body["asset_version"] != global::ASSET_VERSION_JP { + if body["asset_version"] != global::ASSET_VERSION_GL && body["asset_version"] != global::ASSET_VERSION_JP { println!("Warning! Asset version is not what was expected. (Did the app update?)"); } diff --git a/src/runtime.rs b/src/runtime.rs index 7a9e4ee..636cd48 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -5,6 +5,7 @@ use std::fs; lazy_static! { static ref RUNNING: RwLock = RwLock::new(false); static ref DATAPATH: RwLock = RwLock::new(String::new()); + static ref EASTER: RwLock = RwLock::new(false); } pub fn set_running(running: bool) { @@ -31,3 +32,13 @@ pub fn update_data_path(path: &str) { let mut w = DATAPATH.write().unwrap(); *w = path.to_string(); } + +// Only currently editable by the android so +pub fn set_easter_mode(enabled: bool) { + let mut w = EASTER.write().unwrap(); + *w = enabled; +} + +pub fn get_easter_mode() -> bool { + *EASTER.read().unwrap() +}