Misc fixes

grpc.aoba.app for grpc calls
This commit is contained in:
2025-05-21 23:43:29 -04:00
parent 7061b4c313
commit 224d00718f
7 changed files with 13 additions and 7 deletions

View File

@@ -12,6 +12,10 @@ use route::Route;
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
pub const HOST: &'static str = "http://localhost:5164"; 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))] #[cfg(not(debug_assertions))]
pub const HOST: &'static str = "https://aoba.app"; pub const HOST: &'static str = "https://aoba.app";

View File

@@ -4,7 +4,7 @@ use aoba::{aoba_rpc_client::AobaRpcClient, auth_rpc_client::AuthRpcClient};
use tonic::service::{Interceptor, interceptor::InterceptedService}; use tonic::service::{Interceptor, interceptor::InterceptedService};
use tonic_web_wasm_client::Client; use tonic_web_wasm_client::Client;
use crate::HOST; use crate::RPC_HOST;
pub mod aoba { pub mod aoba {
tonic::include_proto!("aoba"); tonic::include_proto!("aoba");
@@ -37,7 +37,7 @@ impl RpcConnection {
fn ensure_client(&self) { fn ensure_client(&self) {
if self.aoba.read().unwrap().is_none() { 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); let aoba_client = AobaRpcClient::with_interceptor(wasm_client.clone(), AuthInterceptor);
*self.aoba.write().unwrap() = Some(aoba_client); *self.aoba.write().unwrap() = Some(aoba_client);
*self.auth.write().unwrap() = Some(AuthRpcClient::new(wasm_client.clone())); *self.auth.write().unwrap() = Some(AuthRpcClient::new(wasm_client.clone()));

View File

@@ -27,7 +27,7 @@ pub fn Settings() -> Element {
div { div {
pre { pre {
class: "codeSelect", class: "codeSelect",
"test {d}" "{d}"
} }
} }
} }

View File

@@ -71,8 +71,8 @@ public class Media
{ {
return this switch return this switch
{ {
Media { MediaType: MediaType.Raw or MediaType.Text or MediaType.Code} => $"/i/dl/{Id}/{Filename}", //Media { MediaType: MediaType.Raw or MediaType.Text or MediaType.Code} => $"/i/dl/{MediaId}/{Filename}",
_ => $"/i/{Id}" _ => $"/m/{MediaId}"
}; };
} }

View File

@@ -24,7 +24,7 @@ public class MediaApi(AobaService aoba) : ControllerBase
return Ok(new return Ok(new
{ {
media.Value, media = media.Value,
url = media.Value.GetMediaUrl() url = media.Value.GetMediaUrl()
}); });
} }

View File

@@ -12,7 +12,7 @@ public class ShareXDestination
public Dictionary<string, string> Arguments { get; set; } = new() { { "name", "$filename$" } }; public Dictionary<string, string> Arguments { get; set; } = new() { { "name", "$filename$" } };
public string FileFormName { get; set; } = "file"; public string FileFormName { get; set; } = "file";
public string[] RegexList { get; set; } = ["([^/]+)/?$"]; 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? ThumbnailURL { get; set; }
public string? DeletionURL { get; set; } public string? DeletionURL { get; set; }
} }

View File

@@ -5,3 +5,5 @@ services:
dockerfile: AobaServer/Dockerfile dockerfile: AobaServer/Dockerfile
ports: ports:
- "4321:8080" - "4321:8080"
environment:
- DB_STRING="mongodb://192.168.86.63:27017"