mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(public): keep original GitHub links visible
(cherry picked from commit 7c93552697c9c35b77df35e117900ff8e9b62994)
This commit is contained in:
@@ -10,7 +10,7 @@ use crate::handlers::shared::{
|
||||
decrypt_catalog_secret_with_fallbacks, encrypt_catalog_secret_with_fallbacks,
|
||||
escape_admin_email_template_html, module_available_from_env, query_param_bool,
|
||||
query_param_optional_bool, query_param_value, read_admin_email_template_payload,
|
||||
render_admin_email_template_html, system_config_bool, system_config_string,
|
||||
render_admin_email_template_html, system_config_string,
|
||||
unix_secs_to_rfc3339,
|
||||
};
|
||||
use crate::{AppState, GatewayError};
|
||||
@@ -239,17 +239,10 @@ pub(crate) async fn maybe_build_local_public_support_response(
|
||||
.flatten()
|
||||
.and_then(|value| value.as_str().map(ToOwned::to_owned))
|
||||
.unwrap_or_else(|| "AI Gateway".to_string());
|
||||
let show_github_link = state
|
||||
.read_system_config_json_value("show_github_link")
|
||||
.await
|
||||
.ok()
|
||||
.flatten();
|
||||
let show_github_link = system_config_bool(show_github_link.as_ref(), true);
|
||||
return Some(
|
||||
Json(json!({
|
||||
"site_name": site_name,
|
||||
"site_subtitle": site_subtitle,
|
||||
"show_github_link": show_github_link,
|
||||
}))
|
||||
.into_response(),
|
||||
);
|
||||
|
||||
@@ -2455,6 +2455,7 @@ async fn gateway_completes_admin_provider_oauth_key_locally_with_trusted_admin_p
|
||||
.expect("account_state_recheck_error should be string when recheck is attempted");
|
||||
assert!(
|
||||
account_state_recheck_error == "backend-api/me API 返回状态码 401"
|
||||
|| account_state_recheck_error == "backend-api/me API 返回状态码 403"
|
||||
|| account_state_recheck_error.starts_with("backend-api/me 请求执行失败:"),
|
||||
"unexpected account_state_recheck_error: {account_state_recheck_error}"
|
||||
);
|
||||
@@ -4926,6 +4927,7 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_with_trusted_admin_p
|
||||
.expect("account_state_recheck_error should be string when attempted");
|
||||
assert!(
|
||||
account_state_recheck_error == "backend-api/me API 返回状态码 401"
|
||||
|| account_state_recheck_error == "backend-api/me API 返回状态码 403"
|
||||
|| account_state_recheck_error.starts_with("backend-api/me 请求执行失败:"),
|
||||
"unexpected account_state_recheck_error: {account_state_recheck_error}"
|
||||
);
|
||||
|
||||
@@ -669,7 +669,6 @@ async fn gateway_handles_public_catalog_site_info_without_proxying_upstream() {
|
||||
vec![
|
||||
("site_name".to_string(), json!("Aether Local")),
|
||||
("site_subtitle".to_string(), json!("Rust Only")),
|
||||
("show_github_link".to_string(), json!(false)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -686,7 +685,7 @@ async fn gateway_handles_public_catalog_site_info_without_proxying_upstream() {
|
||||
let payload: serde_json::Value = response.json().await.expect("json body should parse");
|
||||
assert_eq!(payload["site_name"], "Aether Local");
|
||||
assert_eq!(payload["site_subtitle"], "Rust Only");
|
||||
assert_eq!(payload["show_github_link"], false);
|
||||
assert_eq!(payload.as_object().map(|object| object.len()), Some(2));
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
gateway_handle.abort();
|
||||
|
||||
Reference in New Issue
Block a user