90 files changed, 128 insertions(+), 658 deletions(-)
M Cargo.lock
M ansible/deploy-beta.yaml
M ansible/deploy-bleeding.yaml
M ansible/deploy-stable.yaml
M api.Dockerfile
M api/Cargo.toml
M api/config.toml
M api/src/config.rs
M api/src/main.rs
M api/src/routes/mod.rs
A api/src/routes/server_list.rs
D assets/dist/spritesheet-125
D assets/dist/spritesheet-125.json
D assets/dist/spritesheet-125.png
D assets/dist/spritesheet-375
D assets/dist/spritesheet-375.json
D assets/dist/spritesheet-375.png
D assets/dist/spritesheet-full
D assets/dist/spritesheet-full.json
D assets/dist/spritesheet-full.png
D assets/final/125/autoplr_cfg.png
D assets/final/125/autoplr_error.png
D assets/final/125/autoplr_on.png
D assets/final/125/cargo_off.png
D assets/final/125/cargo_on.png
D assets/final/125/earth.png
D assets/final/125/ecothruster_on.png
D assets/final/125/hearty.png
D assets/final/125/hub_off.png
D assets/final/125/hub_on.png
D assets/final/125/landingleg.png
D assets/final/125/landingthruster_off.png
D assets/final/125/landingthruster_on.png
D assets/final/125/moon.png
D assets/final/125/powerhub_off.png
D assets/final/125/powerhub_on.png
D assets/final/125/starfield.png
D assets/final/125/superthruster_off.png
D assets/final/125/superthruster_on.png
D assets/final/125/thruster_off.png
D assets/final/125/thruster_on.png
D assets/final/375/autoplr_cfg.png
D assets/final/375/autoplr_error.png
D assets/final/375/autoplr_on.png
D assets/final/375/cargo_off.png
D assets/final/375/cargo_on.png
D assets/final/375/earth.png
D assets/final/375/ecothruster_on.png
D assets/final/375/hearty.png
D assets/final/375/hub_off.png
D assets/final/375/hub_on.png
D assets/final/375/landingleg.png
D assets/final/375/landingthruster_off.png
D assets/final/375/landingthruster_on.png
D assets/final/375/moon.png
D assets/final/375/powerhub_off.png
D assets/final/375/powerhub_on.png
D assets/final/375/starfield.png
D assets/final/375/superthruster_off.png
D assets/final/375/superthruster_on.png
D assets/final/375/thruster_off.png
D assets/final/375/thruster_on.png
D assets/final/full/autoplr_cfg.png
D assets/final/full/autoplr_error.png
D assets/final/full/autoplr_on.png
D assets/final/full/cargo_off.png
D assets/final/full/cargo_on.png
D assets/final/full/earth.png
D assets/final/full/ecothruster_on.png
D assets/final/full/hearty.png
D assets/final/full/hub_off.png
D assets/final/full/hub_on.png
D assets/final/full/landingleg.png
D assets/final/full/landingthruster_off.png
D assets/final/full/landingthruster_on.png
D assets/final/full/moon.png
D assets/final/full/powerhub_off.png
D assets/final/full/powerhub_on.png
D assets/final/full/starfield.png
D assets/final/full/superthruster_off.png
D assets/final/full/superthruster_on.png
D assets/final/full/thruster_off.png
D assets/final/full/thruster_on.png
M client/index.html
M client/src/index.ts
M client/vite.config.ts
M docker/config.jinja.toml
M spacetime_rs/src/commands/api.rs
M spacetime_rs/src/commands/docker.rs
M web/index.html
M Cargo.lock => Cargo.lock +16 -0
@@ 26,6 26,21 @@ dependencies = [
]
[[package]]
+name = "actix-cors"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e"
+dependencies = [
+ "actix-utils",
+ "actix-web",
+ "derive_more",
+ "futures-util",
+ "log",
+ "once_cell",
+ "smallvec",
+]
+
+[[package]]
name = "actix-files"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ 3312,6 3327,7 @@ dependencies = [
name = "starkingdoms-api"
version = "0.1.0"
dependencies = [
+ "actix-cors",
"actix-files",
"actix-request-identifier",
"actix-web",
M ansible/deploy-beta.yaml => ansible/deploy-beta.yaml +2 -2
@@ 19,8 19,8 @@
db_data_dir: /home/stk-deploy/data
compose_dir: /home/stk-deploy
- api_url: https://api.beta.starkingdoms.tk
- game_url: https://beta.starkingdoms.tk
+ api_url: https://api.beta.starkingdoms.io
+ game_url: https://beta.starkingdoms.io
tasks:
- name: Ensure host connectivity
ansible.builtin.ping:
M ansible/deploy-bleeding.yaml => ansible/deploy-bleeding.yaml +2 -2
@@ 19,8 19,8 @@
db_data_dir: /home/stk-deploy/data
compose_dir: /home/stk-deploy
- api_url: https://api.bleeding.starkingdoms.tk
- game_url: https://bleeding.starkingdoms.tk
+ api_url: https://api.bleeding.starkingdoms.io
+ game_url: https://bleeding.starkingdoms.io
tasks:
- name: Ensure host connectivity
ansible.builtin.ping:
M ansible/deploy-stable.yaml => ansible/deploy-stable.yaml +2 -2
@@ 20,8 20,8 @@
db_data_dir: /home/stk-deploy/data
compose_dir: /home/stk-deploy
- api_url: https://api.starkingdoms.tk
- game_url: https://starkingdoms.tk
+ api_url: https://api.starkingdoms.io
+ game_url: https://starkingdoms.io
tasks:
- name: Ensure host connectivity
ansible.builtin.ping:
M api.Dockerfile => api.Dockerfile +5 -0
@@ 2,6 2,11 @@ FROM ghcr.io/void-linux/void-linux:latest-full-x86_64
RUN xbps-install -S && xbps-install -f base-files && xbps-install -Syyu gcc
+RUN mkdir /var/www
+
COPY target/release/starkingdoms-api /bin/starkingdoms-api
+COPY api/static/ /var/www/static
+COPY api/templates /var/www/templates
+WORKDIR "/var/www"
CMD ["/bin/starkingdoms-api"]=
\ No newline at end of file
M api/Cargo.toml => api/Cargo.toml +1 -0
@@ 9,6 9,7 @@ edition = "2021"
actix-web = "4" # Web framework
actix-request-identifier = "4" # Web framework
actix-files = "0.6" # Web framework
+actix-cors = "0.6.4" # Web framework
serde = { version = "1", features = ["derive"] } # Serialization and deserialization
M api/config.toml => api/config.toml +1 -0
@@ 2,6 2,7 @@ game = "localhost:5173"
internal_tokens = ["01GY803PVK7YJKXZYWFTK6DS1Y-01GY8040ZQY9SG29DXY4HZ4EPD"]
jwt_signing_secret = "544adbc8144d375d581a1622a4f0cbcf92f006a156ef8b9d4afac6410f51f73c"
base = "localhost:8080"
+servers = ["http://localhost:3000"]
[server]
listen = "0.0.0.0:8080"
M api/src/config.rs => api/src/config.rs +1 -0
@@ 32,6 32,7 @@ pub struct StarkingdomsApiConfig {
pub base: String,
pub game: String,
pub realms: HashMap<String, StarkingdomsApiConfigRealm>,
+ pub servers: Vec<String>
}
#[derive(Serialize, Deserialize, Debug)]
M api/src/main.rs => api/src/main.rs +3 -0
@@ 9,6 9,7 @@ use sea_orm::{ConnectOptions, Database, DatabaseConnection};
use starkingdoms_api_migration::{Migrator, MigratorTrait};
use std::error::Error;
use std::time::Duration;
+use actix_cors::Cors;
use tera::Tera;
pub mod config;
@@ 51,6 52,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
HttpServer::new(move || {
App::new()
+ .wrap(Cors::permissive())
.app_data(data.clone())
.app_data(JsonConfig::default().error_handler(|err, _req| {
let api_error: APIError = (&err).into();
@@ 69,6 71,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.service(routes::callback::callback)
.service(routes::beamin::beam_in)
.service(routes::beamout::beam_out)
+ .service(routes::server_list::server_list)
.service(actix_files::Files::new("/static", "static"))
})
.bind(CONFIG.server.bind)?
M api/src/routes/mod.rs => api/src/routes/mod.rs +1 -0
@@ 2,3 2,4 @@ pub mod beamin;
pub mod beamout;
pub mod callback;
pub mod select_realm;
+pub mod server_list;<
\ No newline at end of file
A api/src/routes/server_list.rs => api/src/routes/server_list.rs +16 -0
@@ 0,0 1,16 @@
+use actix_web::{get};
+use actix_web::web::Json;
+use serde::Serialize;
+use crate::config::CONFIG;
+
+#[derive(Serialize)]
+pub struct ServerListResponse {
+ pub servers: Vec<String>
+}
+
+#[get("server-list")]
+pub async fn server_list() -> Json<ServerListResponse> {
+ Json(ServerListResponse {
+ servers: CONFIG.servers.clone(),
+ })
+}<
\ No newline at end of file
D assets/dist/spritesheet-125 => assets/dist/spritesheet-125 +0 -0
D assets/dist/spritesheet-125.json => assets/dist/spritesheet-125.json +0 -201
@@ 1,201 0,0 @@
-{
- "frames": {
- "starfield.png": {
- "frame": { "x": 0, "y": 0, "w": 256, "h": 256 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 256, "h": 256 },
- "sourceSize": { "w": 256, "h": 256 },
- "pivot": { "x": 128, "y": 128 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 256, "h": 256 }
- },
- "moon.png": {
- "frame": { "x": 0, "y": 256, "w": 256, "h": 256 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 256, "h": 256 },
- "sourceSize": { "w": 256, "h": 256 },
- "pivot": { "x": 128, "y": 128 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 256, "h": 256 }
- },
- "earth.png": {
- "frame": { "x": 0, "y": 512, "w": 256, "h": 256 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 256, "h": 256 },
- "sourceSize": { "w": 256, "h": 256 },
- "pivot": { "x": 128, "y": 128 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 256, "h": 256 }
- },
- "autoplr_error.png": {
- "frame": { "x": 0, "y": 768, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "autoplr_cfg.png": {
- "frame": { "x": 0, "y": 832, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "hearty.png": {
- "frame": { "x": 0, "y": 896, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "superthruster_on.png": {
- "frame": { "x": 0, "y": 960, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "ecothruster_on.png": {
- "frame": { "x": 0, "y": 1024, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "landingthruster_on.png": {
- "frame": { "x": 0, "y": 1088, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "thruster_on.png": {
- "frame": { "x": 0, "y": 1152, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "landingleg.png": {
- "frame": { "x": 0, "y": 1216, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "autoplr_on.png": {
- "frame": { "x": 0, "y": 1280, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "hub_on.png": {
- "frame": { "x": 0, "y": 1344, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "powerhub_on.png": {
- "frame": { "x": 0, "y": 1408, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "superthruster_off.png": {
- "frame": { "x": 0, "y": 1472, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "landingthruster_off.png": {
- "frame": { "x": 0, "y": 1536, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "thruster_off.png": {
- "frame": { "x": 0, "y": 1600, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "cargo_on.png": {
- "frame": { "x": 0, "y": 1664, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "cargo_off.png": {
- "frame": { "x": 0, "y": 1728, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "powerhub_off.png": {
- "frame": { "x": 0, "y": 1792, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- },
- "hub_off.png": {
- "frame": { "x": 0, "y": 1856, "w": 64, "h": 64 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 64 },
- "sourceSize": { "w": 64, "h": 64 },
- "pivot": { "x": 32, "y": 32 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 64, "h": 64 }
- }
- },
- "meta": {
- "app": "atlasify https://github.com/soimy/atlasify#readme",
- "version": "0.4.1",
- "image": "spritesheet-125.png",
- "format": "RGBA8888",
- "size": { "w": 8096, "h": 8096 },
- "scale": 1
- }
-}>
\ No newline at end of file
D assets/dist/spritesheet-125.png => assets/dist/spritesheet-125.png +0 -0
D assets/dist/spritesheet-375 => assets/dist/spritesheet-375 +0 -0
D assets/dist/spritesheet-375.json => assets/dist/spritesheet-375.json +0 -201
@@ 1,201 0,0 @@
-{
- "frames": {
- "starfield.png": {
- "frame": { "x": 0, "y": 0, "w": 768, "h": 768 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 768, "h": 768 },
- "sourceSize": { "w": 768, "h": 768 },
- "pivot": { "x": 384, "y": 384 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 768, "h": 768 }
- },
- "moon.png": {
- "frame": { "x": 0, "y": 768, "w": 768, "h": 768 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 768, "h": 768 },
- "sourceSize": { "w": 768, "h": 768 },
- "pivot": { "x": 384, "y": 384 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 768, "h": 768 }
- },
- "earth.png": {
- "frame": { "x": 0, "y": 1536, "w": 768, "h": 768 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 768, "h": 768 },
- "sourceSize": { "w": 768, "h": 768 },
- "pivot": { "x": 384, "y": 384 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 768, "h": 768 }
- },
- "autoplr_error.png": {
- "frame": { "x": 0, "y": 2304, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "autoplr_cfg.png": {
- "frame": { "x": 0, "y": 2496, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "hearty.png": {
- "frame": { "x": 0, "y": 2688, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "superthruster_on.png": {
- "frame": { "x": 0, "y": 2880, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "ecothruster_on.png": {
- "frame": { "x": 0, "y": 3072, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "landingthruster_on.png": {
- "frame": { "x": 0, "y": 3264, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "thruster_on.png": {
- "frame": { "x": 0, "y": 3456, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "landingleg.png": {
- "frame": { "x": 0, "y": 3648, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "autoplr_on.png": {
- "frame": { "x": 0, "y": 3840, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "hub_on.png": {
- "frame": { "x": 0, "y": 4032, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "powerhub_on.png": {
- "frame": { "x": 0, "y": 4224, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "landingthruster_off.png": {
- "frame": { "x": 0, "y": 4416, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "superthruster_off.png": {
- "frame": { "x": 0, "y": 4608, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "thruster_off.png": {
- "frame": { "x": 0, "y": 4800, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "cargo_on.png": {
- "frame": { "x": 0, "y": 4992, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "cargo_off.png": {
- "frame": { "x": 0, "y": 5184, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "powerhub_off.png": {
- "frame": { "x": 0, "y": 5376, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- },
- "hub_off.png": {
- "frame": { "x": 0, "y": 5568, "w": 192, "h": 192 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 192, "h": 192 },
- "sourceSize": { "w": 192, "h": 192 },
- "pivot": { "x": 96, "y": 96 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 192, "h": 192 }
- }
- },
- "meta": {
- "app": "atlasify https://github.com/soimy/atlasify#readme",
- "version": "0.4.1",
- "image": "spritesheet-375.png",
- "format": "RGBA8888",
- "size": { "w": 8096, "h": 8096 },
- "scale": 1
- }
-}>
\ No newline at end of file
D assets/dist/spritesheet-375.png => assets/dist/spritesheet-375.png +0 -0
D assets/dist/spritesheet-full => assets/dist/spritesheet-full +0 -0
D assets/dist/spritesheet-full.json => assets/dist/spritesheet-full.json +0 -201
@@ 1,201 0,0 @@
-{
- "frames": {
- "starfield.png": {
- "frame": { "x": 0, "y": 0, "w": 2048, "h": 2048 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 2048, "h": 2048 },
- "sourceSize": { "w": 2048, "h": 2048 },
- "pivot": { "x": 1024, "y": 1024 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 2048, "h": 2048 }
- },
- "moon.png": {
- "frame": { "x": 0, "y": 2048, "w": 2048, "h": 2048 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 2048, "h": 2048 },
- "sourceSize": { "w": 2048, "h": 2048 },
- "pivot": { "x": 1024, "y": 1024 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 2048, "h": 2048 }
- },
- "earth.png": {
- "frame": { "x": 0, "y": 4096, "w": 2048, "h": 2048 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 2048, "h": 2048 },
- "sourceSize": { "w": 2048, "h": 2048 },
- "pivot": { "x": 1024, "y": 1024 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 2048, "h": 2048 }
- },
- "autoplr_error.png": {
- "frame": { "x": 0, "y": 6144, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "autoplr_cfg.png": {
- "frame": { "x": 0, "y": 6656, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "hearty.png": {
- "frame": { "x": 0, "y": 7168, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "superthruster_on.png": {
- "frame": { "x": 512, "y": 6144, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "ecothruster_on.png": {
- "frame": { "x": 512, "y": 6656, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "landingthruster_on.png": {
- "frame": { "x": 512, "y": 7168, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "thruster_on.png": {
- "frame": { "x": 1024, "y": 6144, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "landingleg.png": {
- "frame": { "x": 1024, "y": 6656, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "autoplr_on.png": {
- "frame": { "x": 1024, "y": 7168, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "hub_on.png": {
- "frame": { "x": 1536, "y": 6144, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "powerhub_on.png": {
- "frame": { "x": 1536, "y": 6656, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "superthruster_off.png": {
- "frame": { "x": 1536, "y": 7168, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "landingthruster_off.png": {
- "frame": { "x": 2048, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "thruster_off.png": {
- "frame": { "x": 2560, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "cargo_on.png": {
- "frame": { "x": 3072, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "cargo_off.png": {
- "frame": { "x": 3584, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "powerhub_off.png": {
- "frame": { "x": 4096, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- },
- "hub_off.png": {
- "frame": { "x": 4608, "y": 0, "w": 512, "h": 512 },
- "rotated": false,
- "trimmed": false,
- "spriteSourceSize": { "x": 0, "y": 0, "w": 512, "h": 512 },
- "sourceSize": { "w": 512, "h": 512 },
- "pivot": { "x": 256, "y": 256 },
- "9slicedFrame": { "x": 0, "y": 0, "w": 512, "h": 512 }
- }
- },
- "meta": {
- "app": "atlasify https://github.com/soimy/atlasify#readme",
- "version": "0.4.1",
- "image": "spritesheet-full.png",
- "format": "RGBA8888",
- "size": { "w": 8096, "h": 8096 },
- "scale": 1
- }
-}>
\ No newline at end of file
D assets/dist/spritesheet-full.png => assets/dist/spritesheet-full.png +0 -0
D assets/final/125/autoplr_cfg.png => assets/final/125/autoplr_cfg.png +0 -0
D assets/final/125/autoplr_error.png => assets/final/125/autoplr_error.png +0 -0
D assets/final/125/autoplr_on.png => assets/final/125/autoplr_on.png +0 -0
D assets/final/125/cargo_off.png => assets/final/125/cargo_off.png +0 -0
D assets/final/125/cargo_on.png => assets/final/125/cargo_on.png +0 -0
D assets/final/125/earth.png => assets/final/125/earth.png +0 -0
D assets/final/125/ecothruster_on.png => assets/final/125/ecothruster_on.png +0 -0
D assets/final/125/hearty.png => assets/final/125/hearty.png +0 -0
D assets/final/125/hub_off.png => assets/final/125/hub_off.png +0 -0
D assets/final/125/hub_on.png => assets/final/125/hub_on.png +0 -0
D assets/final/125/landingleg.png => assets/final/125/landingleg.png +0 -0
D assets/final/125/landingthruster_off.png => assets/final/125/landingthruster_off.png +0 -0
D assets/final/125/landingthruster_on.png => assets/final/125/landingthruster_on.png +0 -0
D assets/final/125/moon.png => assets/final/125/moon.png +0 -0
D assets/final/125/powerhub_off.png => assets/final/125/powerhub_off.png +0 -0
D assets/final/125/powerhub_on.png => assets/final/125/powerhub_on.png +0 -0
D assets/final/125/starfield.png => assets/final/125/starfield.png +0 -0
D assets/final/125/superthruster_off.png => assets/final/125/superthruster_off.png +0 -0
D assets/final/125/superthruster_on.png => assets/final/125/superthruster_on.png +0 -0
D assets/final/125/thruster_off.png => assets/final/125/thruster_off.png +0 -0
D assets/final/125/thruster_on.png => assets/final/125/thruster_on.png +0 -0
D assets/final/375/autoplr_cfg.png => assets/final/375/autoplr_cfg.png +0 -0
D assets/final/375/autoplr_error.png => assets/final/375/autoplr_error.png +0 -0
D assets/final/375/autoplr_on.png => assets/final/375/autoplr_on.png +0 -0
D assets/final/375/cargo_off.png => assets/final/375/cargo_off.png +0 -0
D assets/final/375/cargo_on.png => assets/final/375/cargo_on.png +0 -0
D assets/final/375/earth.png => assets/final/375/earth.png +0 -0
D assets/final/375/ecothruster_on.png => assets/final/375/ecothruster_on.png +0 -0
D assets/final/375/hearty.png => assets/final/375/hearty.png +0 -0
D assets/final/375/hub_off.png => assets/final/375/hub_off.png +0 -0
D assets/final/375/hub_on.png => assets/final/375/hub_on.png +0 -0
D assets/final/375/landingleg.png => assets/final/375/landingleg.png +0 -0
D assets/final/375/landingthruster_off.png => assets/final/375/landingthruster_off.png +0 -0
D assets/final/375/landingthruster_on.png => assets/final/375/landingthruster_on.png +0 -0
D assets/final/375/moon.png => assets/final/375/moon.png +0 -0
D assets/final/375/powerhub_off.png => assets/final/375/powerhub_off.png +0 -0
D assets/final/375/powerhub_on.png => assets/final/375/powerhub_on.png +0 -0
D assets/final/375/starfield.png => assets/final/375/starfield.png +0 -0
D assets/final/375/superthruster_off.png => assets/final/375/superthruster_off.png +0 -0
D assets/final/375/superthruster_on.png => assets/final/375/superthruster_on.png +0 -0
D assets/final/375/thruster_off.png => assets/final/375/thruster_off.png +0 -0
D assets/final/375/thruster_on.png => assets/final/375/thruster_on.png +0 -0
D assets/final/full/autoplr_cfg.png => assets/final/full/autoplr_cfg.png +0 -0
D assets/final/full/autoplr_error.png => assets/final/full/autoplr_error.png +0 -0
D assets/final/full/autoplr_on.png => assets/final/full/autoplr_on.png +0 -0
D assets/final/full/cargo_off.png => assets/final/full/cargo_off.png +0 -0
D assets/final/full/cargo_on.png => assets/final/full/cargo_on.png +0 -0
D assets/final/full/earth.png => assets/final/full/earth.png +0 -0
D assets/final/full/ecothruster_on.png => assets/final/full/ecothruster_on.png +0 -0
D assets/final/full/hearty.png => assets/final/full/hearty.png +0 -0
D assets/final/full/hub_off.png => assets/final/full/hub_off.png +0 -0
D assets/final/full/hub_on.png => assets/final/full/hub_on.png +0 -0
D assets/final/full/landingleg.png => assets/final/full/landingleg.png +0 -0
D assets/final/full/landingthruster_off.png => assets/final/full/landingthruster_off.png +0 -0
D assets/final/full/landingthruster_on.png => assets/final/full/landingthruster_on.png +0 -0
D assets/final/full/moon.png => assets/final/full/moon.png +0 -0
D assets/final/full/powerhub_off.png => assets/final/full/powerhub_off.png +0 -0
D assets/final/full/powerhub_on.png => assets/final/full/powerhub_on.png +0 -0
D assets/final/full/starfield.png => assets/final/full/starfield.png +0 -0
D assets/final/full/superthruster_off.png => assets/final/full/superthruster_off.png +0 -0
D assets/final/full/superthruster_on.png => assets/final/full/superthruster_on.png +0 -0
D assets/final/full/thruster_off.png => assets/final/full/thruster_off.png +0 -0
D assets/final/full/thruster_on.png => assets/final/full/thruster_on.png +0 -0
M client/index.html => client/index.html +19 -6
@@ 38,14 38,20 @@
<script type="module">
let api_server = "http://localhost:8080";
- let servers = ["localhost:3000"];
+
+ let servers = [];
function server_url_to_ping_url(server) {
- return "http://" + server + "/ping"
+ return server + "/ping"
}
function server_url_to_gateway_url(server) {
- return "ws://" + server + "/ws"
+ let url = new URL(server);
+ if (url.protocol === "https:") {
+ return "wss://" + url.host + "/ws";
+ } else {
+ return "ws://" + url.host + "/ws";
+ }
}
function load_server(server) {
@@ 60,9 66,16 @@
})
}
- for (let i = 0; i < servers.length; i++) {
- load_server(servers[i]);
- }
+ // load servers from the api
+ fetch(`${api_server}/server-list`).then(response => {
+ response.json().then(response => {
+ servers = response["servers"];
+
+ for (let i = 0; i < servers.length; i++) {
+ load_server(servers[i]);
+ }
+ })
+ })
let query = new URLSearchParams(window.location.search);
M client/src/index.ts => client/src/index.ts +38 -34
@@ 273,54 273,58 @@ async function client_main(server: string, username: string, texture_quality: st
}
for (let i = 0; i < global.modules.length; i++) {
- let module = global.modules[i];
- // @ts-ignore
- let tex = global.spritesheet!["frames"][module_type_to_tex_id(module.moduleType)];
+ if (global.me !== null) {
+ let module = global.modules[i];
+ // @ts-ignore
+ let tex = global.spritesheet!["frames"][module_type_to_tex_id(module.moduleType)];
- global.context.save();
+ global.context.save();
- // x_{screen} = x_{world} - player_{x_{world}}
- // x_{world} = x_{screen} + player_{x_{world}}
+ // x_{screen} = x_{world} - player_{x_{world}}
+ // x_{world} = x_{screen} + player_{x_{world}}
- global.context.translate(module.x - global.me!.x, module.y - global.me!.y);
+ global.context.translate(module.x - global.me!.x, module.y - global.me!.y);
- global.context.rotate(module.rotation);
+ global.context.rotate(module.rotation);
- global.context.drawImage(global.spritesheet_img!,
- tex.frame.x,
- tex.frame.y,
- tex.frame.w,
- tex.frame.h,
- -25,
- -25, 50, 50);
-
- global.context.restore();
+ global.context.drawImage(global.spritesheet_img!,
+ tex.frame.x,
+ tex.frame.y,
+ tex.frame.w,
+ tex.frame.h,
+ -25,
+ -25, 50, 50);
+
+ global.context.restore();
+ }
}
for (let i = 0; i < global.players.length; i++) {
- let player = global.players[i];
- // @ts-ignore
- let tex = global.spritesheet!["frames"]["hearty.png"];
+ if (global.me !== null) {
+ let player = global.players[i];
+ // @ts-ignore
+ let tex = global.spritesheet!["frames"]["hearty.png"];
- global.context.save();
+ global.context.save();
- global.context.translate(player.x - global.me!.x, player.y - global.me!.y);
+ global.context.translate(player.x - global.me!.x, player.y - global.me!.y);
- global.context.textAlign = "center";
- global.context.font = "30px Segoe UI";
- global.context.fillStyle = "white";
- global.context.fillText(player.username, 0, -35);
+ global.context.textAlign = "center";
+ global.context.font = "30px Segoe UI";
+ global.context.fillStyle = "white";
+ global.context.fillText(player.username, 0, -35);
- global.context.rotate(player.rotation);
+ global.context.rotate(player.rotation);
- global.context.drawImage(global.spritesheet_img!,
- tex.frame.x, // sx
- tex.frame.y, // sy
- tex.frame.w, // sw
- tex.frame.h, // sh
- -25, -25, 50, 50); // dh
+ global.context.drawImage(global.spritesheet_img!,
+ tex.frame.x, // sx
+ tex.frame.y, // sy
+ tex.frame.w, // sw
+ tex.frame.h, // sh
+ -25, -25, 50, 50); // dh
- global.context.restore();
+ global.context.restore();
+ }
}
requestAnimationFrame(render);
M client/vite.config.ts => client/vite.config.ts +4 -0
@@ 9,5 9,9 @@ export default defineConfig({
index: "index.html",
}
},
+ commonjsOptions: { include: [] },
},
+ optimizeDeps: {
+ disabled: false
+ }
});
M docker/config.jinja.toml => docker/config.jinja.toml +3 -1
@@ 7,6 7,8 @@ game = "{{ game_url }}"
jwt_signing_secret = "{{ jwt_signing_secret }}"
+servers = ["{{ game_url }}"]
+
[realms.discord]
authorize_url = "https://api.e3t.cc/auth/discord/authorize.php"
public_key = "-----BEGIN PUBLIC KEY-----\nMIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHBcZsCM6ebFDCp3dFc+3EOzLw8B\n+fR+9Tx6S/lXOTghk49s7yaxza/zVRPxWaMqyjegfRCEepgV++jbWzBib7bhy91M\n+zlRbeZ9rf++N30Nf4R/XAnUAmhAHt8TzDC08DNQNYAFz37+r4EZlY7APHyND4qU\nd8w3qB95v/wMVB6nAgMBAAE=\n-----END PUBLIC KEY-----"
@@ 21,5 23,5 @@ listen = "0.0.0.0:8080"
[endpoints]
allowed_return_endpoints = [
"127.0.0.1:5173",
- "starkingdoms.tk"
+ "starkingdoms.io"
]=
\ No newline at end of file
M spacetime_rs/src/commands/api.rs => spacetime_rs/src/commands/api.rs +2 -2
@@ 33,7 33,7 @@ pub fn run_api(args: Vec<String>, root: PathBuf) -> Result<(), Box<dyn Error>> {
exec(
root.join("target/debug/starkingdoms-api").to_str().unwrap(),
- &root,
+ &root.join("api"),
args,
)?;
@@ 51,7 51,7 @@ pub fn run_api_prod(args: Vec<String>, root: PathBuf) -> Result<(), Box<dyn Erro
root.join("target/release/starkingdoms-api")
.to_str()
.unwrap(),
- &root,
+ &root.join("api"),
args,
)?;
M spacetime_rs/src/commands/docker.rs => spacetime_rs/src/commands/docker.rs +11 -5
@@ 9,12 9,13 @@ use std::process::Command;
use sedregex::find_and_replace;
fn _build(img: &str, channel: &str, root: &PathBuf) -> Result<(), Box<dyn Error>> {
+ let mut patched = "".to_string();
// compile the various thingies
if img == "server" {
build_server_prod(vec![], root.clone())?;
} else if img == "api" {
build_api_prod(vec![], root.clone())?;
- } else {
+ } else if img == "web" {
// we need to swap out the urls
// TODO
// for now i am just adding all three to all clients
@@ 24,20 25,21 @@ fn _build(img: &str, channel: &str, root: &PathBuf) -> Result<(), Box<dyn Error>
let (a, b) = match channel {
"stable" => ("starkingdoms", "tk"),
- _ => (channel, "starkingdoms.tk")
+ _ => (channel, "starkingdoms.io")
};
let index_html_path = root.clone().join("client/").join("index.html");
let index_html_src = fs::read_to_string(&index_html_path)?;
let index_html_patched = find_and_replace(&index_html_src, &[
- format!("s/let api_server = \"http:\\/\\/localhost:8080\";/let api_server = \"https:\\/\\/api.{}.{}\";/", a, b),
- format!("s/let servers = \\[\"http:\\/\\/localhost:3000\"\\];/let servers = [\"https:\\/\\/{}.{}\"];/", a, b)
+ format!("s/let api_server = \"http:\\/\\/localhost:8080\";/let api_server = \"https:\\/\\/api.{}.{}\";/", a, b)
])?;
fs::write(&index_html_path, index_html_patched.as_bytes())?;
- fs::write(root.clone().join("client/").join("index.html.orig"), index_html_src)?;
+ fs::write(root.clone().join("client/").join("index.html.orig"), index_html_src.clone())?;
+
+ patched = index_html_src.clone();
build_client_prod(vec![], root.clone())?
}
@@ 120,6 122,10 @@ fn _build(img: &str, channel: &str, root: &PathBuf) -> Result<(), Box<dyn Error>
.collect(),
)?;
+ if img == "web" {
+ fs::write(root.clone().join("client/").join("index.html"), patched)?;
+ }
+
Ok(())
}
M web/index.html => web/index.html +1 -1
@@ 33,7 33,7 @@
<script>
- let servers = ["http://localhost:3000"];
+ let servers = ["localhost:3000"];
function server_url_to_ping_url(server) { return server + "/ping" }
function server_url_to_gateway_url(server) { return "ws://" + server + "/ws" }