mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Remove mentions of Cardlife (moved to different repo)
This commit is contained in:
202
Cargo.lock
generated
202
Cargo.lock
generated
@@ -8,7 +8,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -29,7 +29,7 @@ dependencies = [
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"derive_more 0.99.20",
|
||||
"futures-core",
|
||||
@@ -53,7 +53,7 @@ dependencies = [
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"base64 0.22.1",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"brotli",
|
||||
"bytes",
|
||||
"bytestring",
|
||||
@@ -125,7 +125,7 @@ dependencies = [
|
||||
"actix-utils",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"mio 1.0.3",
|
||||
"mio",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -517,12 +517,6 @@ version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.1"
|
||||
@@ -892,15 +886,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.12"
|
||||
@@ -1064,7 +1049,7 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b035a542cf7abf01f2e3c4d5a7acbaebfefe120ae4efc7bde3df98186e4b8af7"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"proc-macro2",
|
||||
"proc-macro2-diagnostics",
|
||||
"quote",
|
||||
@@ -1199,18 +1184,6 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"libredox",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.1"
|
||||
@@ -1254,15 +1227,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
@@ -1952,26 +1916,6 @@ version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify-sys"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.1.4"
|
||||
@@ -2053,26 +1997,6 @@ dependencies = [
|
||||
"simple_asn1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a"
|
||||
dependencies = [
|
||||
"kqueue-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue-sys"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "language-tags"
|
||||
version = "0.3.2"
|
||||
@@ -2153,17 +2077,6 @@ version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9627da5196e5d8ed0b0495e61e518847578da83483c37288316d9b2e03a7f72"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.30.1"
|
||||
@@ -2320,18 +2233,6 @@ version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.3"
|
||||
@@ -2363,34 +2264,6 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "normpath"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "6.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"crossbeam-channel",
|
||||
"filetime",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"kqueue",
|
||||
"libc",
|
||||
"log",
|
||||
"mio 0.8.11",
|
||||
"walkdir",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
@@ -2585,24 +2458,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oj_auth"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"env_logger",
|
||||
"git-version",
|
||||
"hex",
|
||||
"jsonwebtoken",
|
||||
"libfj",
|
||||
"log",
|
||||
"rocket",
|
||||
"rocket_dyn_templates",
|
||||
"serde",
|
||||
"steamworks",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oj_cdn"
|
||||
version = "0.4.0"
|
||||
@@ -3401,7 +3256,7 @@ version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3575,7 +3430,7 @@ dependencies = [
|
||||
name = "rlnl"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"byteserde",
|
||||
"byteserde_derive",
|
||||
"sealed",
|
||||
@@ -3637,19 +3492,6 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_dyn_templates"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bbab919c9e67df3f7ac6624a32ef897df4cd61c0969f4d66f3ced0534660d7a"
|
||||
dependencies = [
|
||||
"handlebars",
|
||||
"normpath",
|
||||
"notify",
|
||||
"rocket",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_http"
|
||||
version = "0.5.1"
|
||||
@@ -3740,7 +3582,7 @@ version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
@@ -4298,7 +4140,7 @@ dependencies = [
|
||||
"atoi",
|
||||
"base64 0.22.1",
|
||||
"bigdecimal",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"chrono",
|
||||
@@ -4345,7 +4187,7 @@ dependencies = [
|
||||
"atoi",
|
||||
"base64 0.22.1",
|
||||
"bigdecimal",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"chrono",
|
||||
"crc",
|
||||
@@ -4436,24 +4278,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "steamworks"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a79d6f059322f73a4586cc2d0ca595ce1583104b2b1574ae1bb87f2c05bf4c67"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"lazy_static",
|
||||
"steamworks-sys",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "steamworks-sys"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ef6b00f8fe8eaaaff22cb9b70822a48c1a5d772bc682c202a57c0b438175845"
|
||||
|
||||
[[package]]
|
||||
name = "stringprep"
|
||||
version = "0.1.5"
|
||||
@@ -4682,7 +4506,7 @@ dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio 1.0.3",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
@@ -5005,8 +4829,6 @@ version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3758f5e68192bb96cc8f9b7e2c2cfdabb435499a28499a42f8f984092adad4b"
|
||||
dependencies = [
|
||||
"getrandom 0.2.15",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -5435,7 +5257,7 @@ version = "0.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -13,7 +13,7 @@ readme = "README.md"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"auth", "cdn",
|
||||
"cdn",
|
||||
"rc_auth",
|
||||
"polariton_auth",
|
||||
"rc_services", "rc_services_room",
|
||||
|
||||
16
README.md
16
README.md
@@ -1,20 +1,14 @@
|
||||
# OpenJam Servers
|
||||
|
||||
[](https://rvlt.gg/jtVE0pD5)
|
||||
[](https://git.ngram.ca/OpenJam/servers/releases)
|
||||
[](#)
|
||||
[](https://git.ngram.ca/OpenJam/rc-servers/releases)
|
||||
[](#)
|
||||
|
||||
|
||||
A collection of open source servers for FreeJam games
|
||||
|
||||
## Usage
|
||||
|
||||
### CardLife
|
||||
|
||||
To get CardLife to use these servers, replace the `ServerConfig.json` file in the game files with [this ServerConfig.json](assets/cardlife/ServerConfig.json).
|
||||
|
||||
### Robocraft
|
||||
|
||||
NOTE: Please refer to the latest [release](./releases) for more detailed instructions for accessing the public OpenJam servers.
|
||||
|
||||
To get Robocraft to use these servers, place [this servenvmulti.config](assets/robocraft/servenvmulti.config) file in the game files.
|
||||
@@ -25,9 +19,9 @@ Before you can login the first time, you will need to create an account through
|
||||
## Privacy
|
||||
|
||||
The minimum amount of data is (and should be) collected to provide the expected functionality.
|
||||
In most cases, this means no data is collected or logged except some debug log messages in development versions.
|
||||
This means no data is collected or logged except some debug log messages in development versions.
|
||||
Some personal identifiers, such as IP addresses and session tokens, are sent but only exist ephemerally.
|
||||
The exception is Robocraft servers, which store the minimum account info possible.
|
||||
The Robocraft servers store the minimum account info possible.
|
||||
This includes username, vehicle data, user configuration data, and other non-identifying gameplay data.
|
||||
If email and/or Steam account identifier are provided during registration, those are also stored.
|
||||
This information is all associated with a unique user identifier.
|
||||
@@ -35,7 +29,7 @@ The current PC's MAC address is also sent to the server (this is a Robocraft cli
|
||||
|
||||
## Development
|
||||
|
||||
Please refer to the [wiki](/OpenJam/servers/wiki/Dev).
|
||||
Please refer to the [wiki](/OpenJam/rc-servers/wiki/Dev).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"AuthUrl": "https://live-auth.cl.ngram.ca/api/",
|
||||
"LobbyUrl": "https://live-lobby.cl.ngram.ca/api/",
|
||||
"InventoryUrl": "https://live-save.cl.ngram.ca/api/",
|
||||
"FallbackAuthUrl": "https://proxy.cl.ngram.ca:8010/api/",
|
||||
"FallbackLobbyUrl": "https://proxy.cl.ngram.ca:8030/api/",
|
||||
"FallbackInventoryUrl": "https://proxy.cl.ngram.ca:8020/api/",
|
||||
"GameServerPath": "/",
|
||||
"GameServerExe": "/CardlifeGameServer.exe",
|
||||
"PhotonUrl": "http://photon.cardlifegame.com"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"AuthUrl": "http://127.0.0.1:8001/api/",
|
||||
"LobbyUrl": "http://127.0.0.1:8002/api/",
|
||||
"InventoryUrl": "http://127.0.0.1:8003/api/",
|
||||
"FallbackAuthUrl": "https://proxy.cl.ngni.us:8010/api/",
|
||||
"FallbackLobbyUrl": "https://proxy.cl.ngni.us:8030/api/",
|
||||
"FallbackInventoryUrl": "https://proxy.cl.ngni.us:8020/api/",
|
||||
"GameServerPath": "/",
|
||||
"GameServerExe": "/CardlifeGameServer.exe",
|
||||
"PhotonUrl": "http://photon.cardlifegame.com"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
[package]
|
||||
name = "oj_auth"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
readme.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[features]
|
||||
steam = ["steamworks"]
|
||||
cardlife = []
|
||||
default = ["cardlife"]
|
||||
|
||||
[dependencies]
|
||||
rocket.workspace = true
|
||||
rocket_dyn_templates = { version = "0.2", features = [ "handlebars" ] }
|
||||
libfj.workspace = true
|
||||
log.workspace = true
|
||||
env_logger.workspace = true
|
||||
uuid = { version = "1.12", features = [ "v4", "fast-rng" ] }
|
||||
steamworks = { version = "0.11", optional = true }
|
||||
hex = "0.4"
|
||||
jsonwebtoken = "9"
|
||||
clap.workspace = true
|
||||
serde.workspace = true
|
||||
git-version.workspace = true
|
||||
@@ -1,13 +0,0 @@
|
||||
## defaults for _all_ profiles
|
||||
[default]
|
||||
address = "127.0.0.1"
|
||||
port = 8001
|
||||
template_dir = "../assets/templates/"
|
||||
|
||||
## set only when compiled in debug mode, i.e, `cargo build`
|
||||
[debug]
|
||||
port = 8001
|
||||
|
||||
## set only when compiled in release mode, i.e, `cargo build --release`
|
||||
[release]
|
||||
address = "0.0.0.0"
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
RUST_LOG=debug cargo run
|
||||
@@ -1,12 +0,0 @@
|
||||
use rocket::{post, routes, serde::json::Json};
|
||||
|
||||
#[post("/api/auth/authenticate", data = "<body>")]
|
||||
pub fn email_password_auth(body: Json<libfj::cardlife::AuthenticationPayload>) -> Json<libfj::cardlife::AuthenticationInfo> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("CardLife Email/Password", |rocket| async {
|
||||
rocket.mount("/", routes![email_password_auth])
|
||||
})
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#[allow(unused_variables)]
|
||||
mod email;
|
||||
mod steam;
|
||||
mod temporary_get_user_id;
|
||||
#[allow(unused_variables)]
|
||||
mod token;
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("cardlife", |rocket| async {
|
||||
rocket.attach(email::stage())
|
||||
.attach(steam::stage())
|
||||
.attach(temporary_get_user_id::stage())
|
||||
.attach(token::stage())
|
||||
})
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
use rocket::{post, routes, serde::json::Json, http::Status};
|
||||
|
||||
#[post("/api/auth/steamauthenticate", data = "<body>")]
|
||||
pub fn steam_auth(body: Json<libfj::cardlife::SteamAuthenticationPayload>) -> Result<Json<libfj::cardlife::AuthenticationInfo>, Status> {
|
||||
log::debug!("steam ticket: {}", body.steam_ticket);
|
||||
let steam_id = crate::common::steam_utils::authenticate_steam_ticket(&body.steam_ticket)
|
||||
.map_err(|_| Status { code: 400 })?;
|
||||
log::debug!("Found steamId {}", steam_id);
|
||||
Ok(Json(libfj::cardlife::AuthenticationInfo {
|
||||
public_id: uuid::Uuid::from_u64_pair(steam_id, steam_id).to_string(),
|
||||
email_address: "nobody@openjamgames.com".to_string(),
|
||||
display_name: steam_id.to_string(),
|
||||
purchases: vec![1, 2, 3],
|
||||
flags: vec![],
|
||||
/*flags: //vec![
|
||||
"Dev".to_string(),
|
||||
"GiveInv".to_string(),
|
||||
"NoDrop".to_string(),
|
||||
"DelStruct".to_string(),
|
||||
"BucketA".to_string(),
|
||||
"BucketB".to_string(),
|
||||
"userlogged".to_string(),
|
||||
],*/
|
||||
confirmed: true,
|
||||
token: uuid::Uuid::from_u64_pair(steam_id, steam_id).to_string(),
|
||||
steam_id: Some(steam_id.to_string()),
|
||||
id: (steam_id & (i32::MAX as u64)) as i32,
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("CardLife Steam", |rocket| async {
|
||||
rocket.mount("/", routes![steam_auth])
|
||||
})
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
//! Not a temporary file, this is the name of the endpoint
|
||||
use rocket::{post, routes, serde::json::Json};
|
||||
|
||||
#[post("/api/auth/temporarygetuserid", data = "<body>")]
|
||||
pub fn temp_migration(body: Json<libfj::cardlife::TempGetUserIdPayload>) -> Json<libfj::cardlife::TempGetUserIdResponse> {
|
||||
let steam_id = uuid::Uuid::parse_str(&body.public_id).map(|guid| guid.as_u64_pair().0).unwrap_or(123456);
|
||||
Json(libfj::cardlife::TempGetUserIdResponse {
|
||||
public_id: body.public_id.to_owned(),
|
||||
token: body.token.to_owned(),
|
||||
user_id: (steam_id & (i32::MAX as u64)) as i32,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("CardLife Temp UserId", |rocket| async {
|
||||
rocket.mount("/", routes![temp_migration])
|
||||
})
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
use rocket::{post, routes, serde::json::Json};
|
||||
|
||||
#[post("/api/auth/token", data = "<body>")]
|
||||
pub fn token_auth(body: Json<libfj::cardlife::TokenPayload>) -> Json<libfj::cardlife::AuthenticationInfo> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("CardLife Token", |rocket| async {
|
||||
rocket.mount("/", routes![token_auth])
|
||||
})
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct CliArgs {
|
||||
/// Robocraft asset data root
|
||||
#[arg(long, default_value_t = {"../assets/robocraft".to_string()})]
|
||||
pub assets_robocraft: String,
|
||||
}
|
||||
|
||||
impl CliArgs {
|
||||
pub fn get() -> Self {
|
||||
Self::parse()
|
||||
}
|
||||
|
||||
pub async fn preloaded(self) -> Config {
|
||||
Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Config {
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub(crate) mod steam_utils;
|
||||
pub(crate) mod cli;
|
||||
@@ -1,87 +0,0 @@
|
||||
fn get_u64_with_offset(arr: &[u8], start: usize) -> u64 {
|
||||
let arr_actual: [u8; 8] = [
|
||||
arr[start],
|
||||
arr[start+1],
|
||||
arr[start+2],
|
||||
arr[start+3],
|
||||
arr[start+4],
|
||||
arr[start+5],
|
||||
arr[start+6],
|
||||
arr[start+7],
|
||||
];
|
||||
u64::from_le_bytes(arr_actual)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn get_steam_id_from_ticket_hex(hex_ticket: &str) -> Result<u64, hex::FromHexError> {
|
||||
let decoded_ticket = hex::decode(hex_ticket)?;
|
||||
if decoded_ticket.len() < 72 {
|
||||
Err(hex::FromHexError::InvalidStringLength)
|
||||
} else {
|
||||
Ok(get_steam_id_from_ticket(&decoded_ticket))
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn get_steam_id_from_ticket(ticket: &[u8]) -> u64 {
|
||||
get_u64_with_offset(ticket, 12 /* also at 64 ??? */) // should be 76600000000000000 > number > 76500000000000000
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "steam", feature = "cardlife"))]
|
||||
const STEAM_ID: &str = "920690"; // Cardlife steam app id
|
||||
|
||||
#[cfg(feature = "steam")]
|
||||
static STEAM_SERVER: std::sync::OnceLock<steamworks::Server> = std::sync::OnceLock::new();
|
||||
|
||||
#[cfg(feature = "steam")]
|
||||
fn init_steam() -> steamworks::Server {
|
||||
if let Err(e) = std::fs::write::<&str, &[u8]>("./steam_appid.txt", STEAM_ID.as_ref()) {
|
||||
log::error!("Failed to write appId to steam_appid.txt: {}", e);
|
||||
}
|
||||
let (server, single_client) = steamworks::Server::init(core::net::Ipv4Addr::new(127, 0, 0, 1), 9000, 9001, steamworks::ServerMode::NoAuthentication, "")
|
||||
.expect("Steam is unavailable");
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
single_client.run_callbacks();
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
});
|
||||
server.set_product(STEAM_ID);
|
||||
server.log_on_anonymous();
|
||||
server
|
||||
}
|
||||
|
||||
#[cfg(feature = "steam")]
|
||||
fn get_steam() -> &'static steamworks::Server {
|
||||
STEAM_SERVER.get_or_init(init_steam)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "steam"))]
|
||||
pub fn authenticate_steam_ticket(hex_ticket: &str) -> Result<u64, ()> {
|
||||
get_steam_id_from_ticket_hex(hex_ticket)
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to parse steamId: {}", e);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "steam")]
|
||||
pub fn authenticate_steam_ticket(hex_ticket: &str) -> Result<u64, ()> {
|
||||
let decoded_ticket = hex::decode(hex_ticket)
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to decode hexadecimal steam ticket: {}", e);
|
||||
()
|
||||
})?;
|
||||
if decoded_ticket.len() < 72 {
|
||||
log::error!("Failed to parse steamId: ticket too short");
|
||||
return Err(())
|
||||
}
|
||||
let steam_id = get_steam_id_from_ticket(&decoded_ticket);
|
||||
let steam = get_steam();
|
||||
steam.begin_authentication_session(steamworks::SteamId::from_raw(steam_id), &decoded_ticket)
|
||||
.map_err(|e| {
|
||||
log::error!("steam server auth session error: {}", e);
|
||||
()
|
||||
})?;
|
||||
Ok(steam_id)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#![forbid(unsafe_code)]
|
||||
mod common;
|
||||
|
||||
#[cfg(feature = "cardlife")]
|
||||
mod cardlife;
|
||||
|
||||
#[rocket::get("/")]
|
||||
fn index() -> String {
|
||||
let name = env!("CARGO_PKG_NAME");
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let git_version = git_version::git_version!(args = ["--always", "--dirty=+"]);
|
||||
let authors = env!("CARGO_PKG_AUTHORS");
|
||||
let license = env!("CARGO_PKG_LICENSE");
|
||||
let repo = env!("CARGO_PKG_REPOSITORY");
|
||||
format!("{} {}:{} by [{}]\n{}\n{}", name, version, git_version, authors, license, repo)
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
async fn rocket() -> _ {
|
||||
env_logger::init();
|
||||
let args = common::cli::CliArgs::get();
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = rocket::build().mount("/", rocket::routes![index])
|
||||
.manage(args.preloaded().await);
|
||||
|
||||
#[cfg(feature = "cardlife")]
|
||||
{builder = builder.attach(cardlife::stage());}
|
||||
|
||||
builder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user