Skip to content

Commit f38724c

Browse files
chore: update frontend version to v0.1.8-p1 (#87)
1 parent 730c05b commit f38724c

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

build-config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# - "main" (branch)
99
# - "v1.2.3" (tag)
1010
# - "abc123def456" (commit hash)
11-
private_chat_frontend_version = "c585b0dfd83a7e5bb6974534f0bb91b694c96e31" # v0.1.8
11+
private_chat_frontend_version = "36f18d6ef6b326147e68990a7718b1a2397be9bf" # v0.1.8-p1
1212

1313
# PostHog key and host for the private-chat frontend
1414
posthog_key = "phc_glaMeuuO1gLFSB2U9y27MchidXEmSnFOQLB8cceyVSb"

crates/api/src/routes/api.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/// Error message when a user is banned from using /v1/responses
2-
const NEAR_BAN_ERROR_MESSAGE: &str =
3-
"User is temporarily banned from using this feature; please try again later";
41
use crate::consts::LIST_FILES_LIMIT_MAX;
52
use crate::middleware::auth::AuthenticatedUser;
63
use axum::{
@@ -37,6 +34,10 @@ const NEAR_BALANCE_BAN_DURATION_SECS: i64 = 60 * 60;
3734
/// Duration to cache NEAR balance checks in memory (in seconds)
3835
const NEAR_BALANCE_CACHE_TTL_SECS: i64 = 5 * 60;
3936

37+
/// Error message when a user is banned
38+
pub const USER_BANNED_ERROR_MESSAGE: &str =
39+
"Access temporarily restricted. Please try again later.";
40+
4041
/// Create the OpenAI API proxy router
4142
pub fn create_api_router(
4243
rate_limit_state: crate::middleware::RateLimitState,
@@ -1307,7 +1308,7 @@ async fn ensure_near_balance_for_near_user(
13071308
Err((
13081309
StatusCode::FORBIDDEN,
13091310
Json(ErrorResponse {
1310-
error: NEAR_BAN_ERROR_MESSAGE.to_string(),
1311+
error: USER_BANNED_ERROR_MESSAGE.to_string(),
13111312
}),
13121313
)
13131314
.into_response())
@@ -1353,7 +1354,7 @@ async fn ensure_user_not_banned(
13531354
return Err((
13541355
StatusCode::FORBIDDEN,
13551356
Json(ErrorResponse {
1356-
error: NEAR_BAN_ERROR_MESSAGE.to_string(),
1357+
error: USER_BANNED_ERROR_MESSAGE.to_string(),
13571358
}),
13581359
)
13591360
.into_response());

crates/api/tests/near_balance_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mod common;
22

3+
use api::routes::api::USER_BANNED_ERROR_MESSAGE;
34
use common::create_test_server;
45
use serde_json::json;
56
use tokio::time::sleep;
@@ -158,7 +159,7 @@ async fn test_near_balance_blocks_poor_account() {
158159
let error = body.get("error").and_then(|v| v.as_str());
159160
assert_eq!(
160161
error,
161-
Some("User is temporarily banned from using this feature; please try again later"),
162+
Some(USER_BANNED_ERROR_MESSAGE),
162163
"Ban error message should indicate a temporary ban without exposing NEAR balance details"
163164
);
164165
}

0 commit comments

Comments
 (0)