mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
chore: bump rust edition to 2024
This commit is contained in:
parent
214f164fbc
commit
ebb23286d8
41 changed files with 70 additions and 69 deletions
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "api"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
pluralkit_models = { path = "../models" }
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ use fred::interfaces::*;
|
|||
use libpk::state::ShardState;
|
||||
use pk_macros::api_endpoint;
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct ClusterStats {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use axum::{extract::State, response::IntoResponse, Extension, Json};
|
||||
use axum::{Extension, Json, extract::State, response::IntoResponse};
|
||||
use pk_macros::api_endpoint;
|
||||
use serde_json::{json, Value};
|
||||
use serde_json::{Value, json};
|
||||
use sqlx::Postgres;
|
||||
|
||||
use pluralkit_models::{PKSystem, PKSystemConfig, PrivacyLevel};
|
||||
|
||||
use crate::{auth::AuthState, error::fail, ApiContext};
|
||||
use crate::{ApiContext, auth::AuthState, error::fail};
|
||||
|
||||
#[api_endpoint]
|
||||
pub async fn get_system_settings(
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
#![feature(let_chains)]
|
||||
|
||||
use auth::{AuthState, INTERNAL_APPID_HEADER, INTERNAL_SYSTEMID_HEADER};
|
||||
use axum::{
|
||||
Extension, Router,
|
||||
body::Body,
|
||||
extract::{Request as ExtractRequest, State},
|
||||
http::Uri,
|
||||
response::{IntoResponse, Response},
|
||||
routing::{delete, get, patch, post},
|
||||
Extension, Router,
|
||||
};
|
||||
use hyper_util::{
|
||||
client::legacy::{connect::HttpConnector, Client},
|
||||
client::legacy::{Client, connect::HttpConnector},
|
||||
rt::TokioExecutor,
|
||||
};
|
||||
use tracing::info;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use subtle::ConstantTimeEq;
|
|||
use tracing::error;
|
||||
|
||||
use crate::auth::AuthState;
|
||||
use crate::{util::json_err, ApiContext};
|
||||
use crate::{ApiContext, util::json_err};
|
||||
|
||||
pub async fn auth(State(ctx): State<ApiContext>, mut req: Request, next: Next) -> Response {
|
||||
let mut authed_system_id: Option<i32> = None;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::time::Instant;
|
|||
|
||||
use axum::{extract::MatchedPath, extract::Request, middleware::Next, response::Response};
|
||||
use metrics::{counter, histogram};
|
||||
use tracing::{info, span, warn, Instrument, Level};
|
||||
use tracing::{Instrument, Level, info, span, warn};
|
||||
|
||||
use crate::{auth::AuthState, util::header_or_unknown};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ use axum::{
|
|||
routing::url_params::UrlParams,
|
||||
};
|
||||
|
||||
use sqlx::{types::Uuid, Postgres};
|
||||
use sqlx::{Postgres, types::Uuid};
|
||||
use tracing::error;
|
||||
|
||||
use crate::auth::AuthState;
|
||||
use crate::{util::json_err, ApiContext};
|
||||
use crate::{ApiContext, util::json_err};
|
||||
use pluralkit_models::PKSystem;
|
||||
|
||||
// move this somewhere else
|
||||
|
|
@ -31,7 +31,7 @@ pub async fn params(State(ctx): State<ApiContext>, mut req: Request, next: Next)
|
|||
StatusCode::BAD_REQUEST,
|
||||
r#"{"message":"400: Bad Request","code": 0}"#.to_string(),
|
||||
)
|
||||
.into()
|
||||
.into();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use axum::{
|
|||
http::{HeaderValue, StatusCode},
|
||||
response::IntoResponse,
|
||||
};
|
||||
use serde_json::{json, to_string, Value};
|
||||
use serde_json::{Value, json, to_string};
|
||||
use tracing::error;
|
||||
|
||||
pub fn header_or_unknown(header: Option<&HeaderValue>) -> &str {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue