fixup! working just like it was before :)

This commit is contained in:
Iris System 2025-08-18 21:57:26 +12:00
parent 21da6f9525
commit be218c89cc
6 changed files with 9 additions and 15 deletions

View file

@ -13,6 +13,7 @@ use hyper_util::{
client::legacy::{connect::HttpConnector, Client},
rt::TokioExecutor,
};
use jsonwebtoken::{DecodingKey, EncodingKey};
use tracing::{error, info};
use pk_macros::api_endpoint;
@ -136,9 +137,9 @@ fn router(ctx: ApiContext) -> Router {
.route("/internal/apikey/user", post(endpoints::internal::create_api_key_user))
.route("/v2/systems/:system_id/oembed.json", get(rproxy))
.route("/v2/members/:member_id/oembed.json", get(rproxy))
.route("/v2/groups/:group_id/oembed.json", get(rproxy))
.route("/v2/systems/{system_id}/oembed.json", get(rproxy))
.route("/v2/members/{member_id}/oembed.json", get(rproxy))
.route("/v2/groups/{group_id}/oembed.json", get(rproxy))
.layer(middleware::ratelimit::ratelimiter(ctx.clone(), middleware::ratelimit::do_request_ratelimited))

View file

@ -142,11 +142,9 @@ pub async fn auth(State(ctx): State<ApiContext>, mut req: Request, next: Next) -
.await
.expect("failed to query apitoken in postgres")
{
authed_system_id = Some(token.system);
authed_api_key_id = Some(tid);
access_level = apikey_can_access(&token, req.method().to_string(), endpoint.clone());
if access_level != AccessLevel::None {
authed_system_id = Some(token.system);
}
}
else if let Some(system_id) =
match libpk::db::repository::legacy_token_auth(&ctx.db, system_auth_header).await {

View file

@ -60,13 +60,8 @@ pub struct ApiConfig {
pub remote_url: String,
#[serde(default)]
pub temp_token2: Option<String>,
pub token_privatekey: String,
pub token_publickey: String,
pub internal_request_secret: String,
}
#[derive(Deserialize, Clone, Debug)]

View file

@ -11,7 +11,6 @@ jsonwebtoken = { workspace = true }
sea-query = "0.32.1"
serde = { workspace = true }
serde_json = { workspace = true, features = ["preserve_order"] }
# in theory we want to default-features = false for sqlx
# but cargo doesn't seem to support this
sqlx = { workspace = true, features = ["chrono"] }
sqlx = { workspace = true }
uuid = { workspace = true }
tracing = { workspace = true }