Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed Apr 18, 2024
1 parent 9380e64 commit 0b502b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gamercade_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ path = "src/main.rs"
gamercade_interface = { path = "../gamercade_interface" }

rfd = "0.11.3"
radix_fmt = "1.0.0"

tokio = { version = "1.28.1", features = ["full"] }
tokio-stream = "0.1.14"
Expand Down
7 changes: 5 additions & 2 deletions gamercade_app/src/urls.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use gamercade_interface::{Session, SESSION_METADATA_KEY};
use gamercade_interface::{Session, SESSION_METADATA_KEY, URL_RADIX};
use radix_fmt::radix;
use tonic::{metadata::MetadataValue, Request};

pub const SERVICE_IP_GRPC: &str = "http://127.0.0.1:50051";
pub const SERVICE_IP_HTTP: &str = "http://127.0.0.1:3000";

pub fn game_release_url(game_id: i64, release_id: i64) -> String {
format!("{SERVICE_IP_HTTP}/games/{game_id:x}/releases/{release_id:x}")
let game_id = radix(game_id, URL_RADIX as u8);
let release_id = radix(release_id, URL_RADIX as u8);
format!("{SERVICE_IP_HTTP}/games/{game_id}/releases/{release_id}")
}

#[derive(Debug)]
Expand Down
1 change: 1 addition & 0 deletions gamercade_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub const AUTHOR_TITLE_MAX_LENGTH: usize = 31;
pub const REVIEW_COMMENTS_MAX_LENGTH: usize = 1027;

pub const SESSION_METADATA_KEY: &str = "gc-session-bin";
pub const URL_RADIX: usize = 16;

#[derive(Debug, Clone)]
pub struct Session([u8; 16]);
Expand Down

0 comments on commit 0b502b8

Please sign in to comment.