diff --git a/AobaClient/src/main.rs b/AobaClient/src/main.rs index 5097102..cba8dbf 100644 --- a/AobaClient/src/main.rs +++ b/AobaClient/src/main.rs @@ -10,6 +10,11 @@ use contexts::AuthContext; use dioxus::prelude::*; use route::Route; +#[cfg(debug_assertions)] +pub const HOST: &'static str = "http://localhost:5164"; +#[cfg(not(debug_assertions))] +pub const HOST: &'static str = "https://aoba.app"; + const FAVICON: Asset = asset!("/assets/favicon.ico"); const MAIN_CSS: Asset = asset!("/assets/style/main.scss"); diff --git a/AobaClient/src/rpc.rs b/AobaClient/src/rpc.rs index 89b15f7..d50015a 100644 --- a/AobaClient/src/rpc.rs +++ b/AobaClient/src/rpc.rs @@ -3,13 +3,13 @@ use std::sync::RwLock; use aoba::{aoba_rpc_client::AobaRpcClient, auth_rpc_client::AuthRpcClient}; use tonic_web_wasm_client::Client; +use crate::HOST; + pub mod aoba { tonic::include_proto!("aoba"); tonic::include_proto!("aoba.auth"); } -const HOST: &'static str = "http://localhost:5164"; - static RPC_CLIENT: RpcConnection = RpcConnection { aoba: RwLock::new(None), auth: RwLock::new(None), diff --git a/AobaServer/Proto/Aoba.proto b/AobaServer/Proto/Aoba.proto index 4508e59..79f9959 100644 --- a/AobaServer/Proto/Aoba.proto +++ b/AobaServer/Proto/Aoba.proto @@ -5,16 +5,19 @@ package aoba; service AobaRpc { rpc GetMedia (Id) returns (MediaResponse); + rpc DeleteMedia (Id) returns (Empty); + rpc UpdateMedia (Empty) returns (Empty); rpc ListMedia(PageFilter) returns (ListResponse); + rpc GetUser(Id) returns (UserResponse); } -message PageFilter{ +message PageFilter { optional int32 page = 1; optional int32 pageSize = 2; optional string query = 3; } -message Id{ +message Id { string value = 1; } @@ -25,7 +28,7 @@ message MediaResponse { } } -message ListResponse{ +message ListResponse { repeated MediaModel items = 1; Pagination pagination = 2; } @@ -38,7 +41,21 @@ message Pagination { optional string query = 5; } -message Empty{} +message UserResponse { + oneof userResult { + UserModel user = 1; + Empty empty = 2; + } +} + +message UserModel { + Id id = 1; + string username = 2; + string email = 3; + bool isAdmin = 4; +} + +message Empty {} message MediaModel { Id id = 1;