From 224d00718fa281a733a8cab0cb1ac8339dbbc254 Mon Sep 17 00:00:00 2001 From: Amatsugu Date: Wed, 21 May 2025 23:43:29 -0400 Subject: [PATCH] Misc fixes grpc.aoba.app for grpc calls --- AobaClient/src/main.rs | 4 ++++ AobaClient/src/rpc.rs | 4 ++-- AobaClient/src/views/settings.rs | 2 +- AobaCore/Models/Media.cs | 4 ++-- AobaServer/Controllers/Api/MediaApi.cs | 2 +- AobaServer/Models/ShareXDestination.cs | 2 +- docker-compose.yml | 2 ++ 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/AobaClient/src/main.rs b/AobaClient/src/main.rs index 75b421a..8ea533c 100644 --- a/AobaClient/src/main.rs +++ b/AobaClient/src/main.rs @@ -12,6 +12,10 @@ use route::Route; #[cfg(debug_assertions)] pub const HOST: &'static str = "http://localhost:5164"; +#[cfg(debug_assertions)] +pub const RPC_HOST: &'static str = "http://localhost:5164"; +#[cfg(not(debug_assertions))] +pub const RPC_HOST: &'static str = "https://grpc.aoba.app"; #[cfg(not(debug_assertions))] pub const HOST: &'static str = "https://aoba.app"; diff --git a/AobaClient/src/rpc.rs b/AobaClient/src/rpc.rs index dbe0594..f9bcfcf 100644 --- a/AobaClient/src/rpc.rs +++ b/AobaClient/src/rpc.rs @@ -4,7 +4,7 @@ use aoba::{aoba_rpc_client::AobaRpcClient, auth_rpc_client::AuthRpcClient}; use tonic::service::{Interceptor, interceptor::InterceptedService}; use tonic_web_wasm_client::Client; -use crate::HOST; +use crate::RPC_HOST; pub mod aoba { tonic::include_proto!("aoba"); @@ -37,7 +37,7 @@ impl RpcConnection { fn ensure_client(&self) { if self.aoba.read().unwrap().is_none() { - let wasm_client = Client::new(HOST.into()); + let wasm_client = Client::new(RPC_HOST.into()); let aoba_client = AobaRpcClient::with_interceptor(wasm_client.clone(), AuthInterceptor); *self.aoba.write().unwrap() = Some(aoba_client); *self.auth.write().unwrap() = Some(AuthRpcClient::new(wasm_client.clone())); diff --git a/AobaClient/src/views/settings.rs b/AobaClient/src/views/settings.rs index c02ae42..0f8c066 100644 --- a/AobaClient/src/views/settings.rs +++ b/AobaClient/src/views/settings.rs @@ -27,7 +27,7 @@ pub fn Settings() -> Element { div { pre { class: "codeSelect", - "test {d}" + "{d}" } } } diff --git a/AobaCore/Models/Media.cs b/AobaCore/Models/Media.cs index 3e0ab51..d50af8c 100644 --- a/AobaCore/Models/Media.cs +++ b/AobaCore/Models/Media.cs @@ -71,8 +71,8 @@ public class Media { return this switch { - Media { MediaType: MediaType.Raw or MediaType.Text or MediaType.Code} => $"/i/dl/{Id}/{Filename}", - _ => $"/i/{Id}" + //Media { MediaType: MediaType.Raw or MediaType.Text or MediaType.Code} => $"/i/dl/{MediaId}/{Filename}", + _ => $"/m/{MediaId}" }; } diff --git a/AobaServer/Controllers/Api/MediaApi.cs b/AobaServer/Controllers/Api/MediaApi.cs index d2d813d..8c60738 100644 --- a/AobaServer/Controllers/Api/MediaApi.cs +++ b/AobaServer/Controllers/Api/MediaApi.cs @@ -24,7 +24,7 @@ public class MediaApi(AobaService aoba) : ControllerBase return Ok(new { - media.Value, + media = media.Value, url = media.Value.GetMediaUrl() }); } diff --git a/AobaServer/Models/ShareXDestination.cs b/AobaServer/Models/ShareXDestination.cs index 6bc381b..d28505e 100644 --- a/AobaServer/Models/ShareXDestination.cs +++ b/AobaServer/Models/ShareXDestination.cs @@ -12,7 +12,7 @@ public class ShareXDestination public Dictionary Arguments { get; set; } = new() { { "name", "$filename$" } }; public string FileFormName { get; set; } = "file"; public string[] RegexList { get; set; } = ["([^/]+)/?$"]; - public string URL { get; set; } = "https://aoba.app$json:url$"; + public string URL { get; set; } = "https://aoba.app{json:url}"; public string? ThumbnailURL { get; set; } public string? DeletionURL { get; set; } } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 247d3ac..3d35cac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,3 +5,5 @@ services: dockerfile: AobaServer/Dockerfile ports: - "4321:8080" + environment: + - DB_STRING="mongodb://192.168.86.63:27017"