mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
This commit is contained in:
10
rc_microtransactions/Cargo.toml
Normal file
10
rc_microtransactions/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "rc_microtransactions"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rocket.workspace = true
|
||||
libfj.workspace = true
|
||||
log.workspace = true
|
||||
env_logger.workspace = true
|
||||
12
rc_microtransactions/Rocket.toml
Normal file
12
rc_microtransactions/Rocket.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
## defaults for _all_ profiles
|
||||
[default]
|
||||
address = "127.0.0.1"
|
||||
port = 8011
|
||||
|
||||
## set only when compiled in debug mode, i.e, `cargo build`
|
||||
[debug]
|
||||
port = 8011
|
||||
|
||||
## set only when compiled in release mode, i.e, `cargo build --release`
|
||||
[release]
|
||||
address = "0.0.0.0"
|
||||
3
rc_microtransactions/build_arm64.sh
Executable file
3
rc_microtransactions/build_arm64.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
cargo build --release --target aarch64-unknown-linux-musl
|
||||
3
rc_microtransactions/run_debug.sh
Executable file
3
rc_microtransactions/run_debug.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
#cargo build
|
||||
RUST_LOG=debug cargo run
|
||||
14
rc_microtransactions/src/main.rs
Normal file
14
rc_microtransactions/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
mod robocraft;
|
||||
|
||||
#[rocket::get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
fn rocket() -> _ {
|
||||
env_logger::init();
|
||||
rocket::build().mount("/", rocket::routes![index])
|
||||
.attach(robocraft::stage())
|
||||
}
|
||||
|
||||
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod store;
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("JSON", |rocket| async {
|
||||
rocket.attach(store::stage())
|
||||
})
|
||||
}
|
||||
17
rc_microtransactions/src/robocraft/store.rs
Normal file
17
rc_microtransactions/src/robocraft/store.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use rocket::{post, routes, serde::json::{json, Value}};
|
||||
|
||||
#[post("/robopay/store")]
|
||||
pub fn robopay_store() -> Value {
|
||||
// TODO authentication (Authorization header is "Robocraft {JWT token from auth}")
|
||||
json!({
|
||||
"response": {
|
||||
"data": []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("Robocraft store info", |rocket| async {
|
||||
rocket.mount("/", routes![robopay_store])
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user