You've already forked AstralRinth
forked from didirus/AstralRinth
Subpackage common -> ariadne (#3323)
* Subpackage common -> ariadne * add common * Remove build * only build labrinth * common * set sqlx offline * copy dirs * Fix build
This commit is contained in:
@@ -127,6 +127,8 @@ async-stripe = { version = "0.39.1", features = ["runtime-tokio-hyper-rustls"] }
|
||||
rusty-money = "0.4.1"
|
||||
json-patch = "*"
|
||||
|
||||
ariadne = { path = "../../packages/ariadne" }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-http = "3.4.0"
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ ENV PKG_CONFIG_ALLOW_CROSS=1
|
||||
|
||||
WORKDIR /usr/src/labrinth
|
||||
COPY . .
|
||||
RUN cargo build --release
|
||||
ENV SQLX_OFFLINE=true
|
||||
COPY apps/labrinth/.sqlx/ .sqlx/
|
||||
RUN cargo build --release --package labrinth
|
||||
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
@@ -20,8 +22,8 @@ RUN apt-get update \
|
||||
RUN update-ca-certificates
|
||||
|
||||
COPY --from=build /usr/src/labrinth/target/release/labrinth /labrinth/labrinth
|
||||
COPY --from=build /usr/src/labrinth/migrations/* /labrinth/migrations/
|
||||
COPY --from=build /usr/src/labrinth/assets /labrinth/assets
|
||||
COPY --from=build /usr/src/labrinth/apps/labrinth/migrations/* /labrinth/migrations/
|
||||
COPY --from=build /usr/src/labrinth/apps/labrinth/assets /labrinth/assets
|
||||
WORKDIR /labrinth
|
||||
|
||||
CMD /labrinth/labrinth
|
||||
@@ -34,7 +34,7 @@ pub enum AuthenticationError {
|
||||
#[error("Error uploading user profile picture")]
|
||||
FileHosting(#[from] FileHostingError),
|
||||
#[error("Error while decoding PAT: {0}")]
|
||||
Decoding(#[from] crate::common::ids::DecodingError),
|
||||
Decoding(#[from] ariadne::ids::DecodingError),
|
||||
#[error("{0}")]
|
||||
Mail(#[from] email::MailError),
|
||||
#[error("Invalid Authentication Credentials")]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::ValidatedRedirectUri;
|
||||
use crate::auth::AuthenticationError;
|
||||
use crate::common::ids::DecodingError;
|
||||
use crate::models::error::ApiError;
|
||||
use actix_web::http::{header::LOCATION, StatusCode};
|
||||
use actix_web::HttpResponse;
|
||||
use ariadne::ids::DecodingError;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[error("{}", .error_type)]
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
pub use super::users::UserId;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Generates a random 64 bit integer that is exactly `n` characters
|
||||
/// long when encoded as base62.
|
||||
///
|
||||
/// Uses `rand`'s thread rng on every call.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This method panics if `n` is 0 or greater than 11, since a `u64`
|
||||
/// can only represent up to 11 character base62 strings
|
||||
#[inline]
|
||||
pub fn random_base62(n: usize) -> u64 {
|
||||
random_base62_rng(&mut rand::thread_rng(), n)
|
||||
}
|
||||
|
||||
/// Generates a random 64 bit integer that is exactly `n` characters
|
||||
/// long when encoded as base62, using the given rng.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This method panics if `n` is 0 or greater than 11, since a `u64`
|
||||
/// can only represent up to 11 character base62 strings
|
||||
pub fn random_base62_rng<R: rand::RngCore>(rng: &mut R, n: usize) -> u64 {
|
||||
random_base62_rng_range(rng, n, n)
|
||||
}
|
||||
|
||||
pub fn random_base62_rng_range<R: rand::RngCore>(
|
||||
rng: &mut R,
|
||||
n_min: usize,
|
||||
n_max: usize,
|
||||
) -> u64 {
|
||||
use rand::Rng;
|
||||
assert!(n_min > 0 && n_max <= 11 && n_min <= n_max);
|
||||
// gen_range is [low, high): max value is `MULTIPLES[n] - 1`,
|
||||
// which is n characters long when encoded
|
||||
rng.gen_range(MULTIPLES[n_min - 1]..MULTIPLES[n_max])
|
||||
}
|
||||
|
||||
const MULTIPLES: [u64; 12] = [
|
||||
1,
|
||||
62,
|
||||
62 * 62,
|
||||
62 * 62 * 62,
|
||||
62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62,
|
||||
62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62,
|
||||
u64::MAX,
|
||||
];
|
||||
|
||||
/// An ID encoded as base62 for use in the API.
|
||||
///
|
||||
/// All ids should be random and encode to 8-10 character base62 strings,
|
||||
/// to avoid enumeration and other attacks.
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub struct Base62Id(pub u64);
|
||||
|
||||
/// An error decoding a number from base62.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DecodingError {
|
||||
/// Encountered a non-base62 character in a base62 string
|
||||
#[error("Invalid character {0:?} in base62 encoding")]
|
||||
InvalidBase62(char),
|
||||
/// Encountered integer overflow when decoding a base62 id.
|
||||
#[error("Base62 decoding overflowed")]
|
||||
Overflow,
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! from_base62id {
|
||||
($($struct:ty, $con:expr;)+) => {
|
||||
$(
|
||||
impl From<Base62Id> for $struct {
|
||||
fn from(id: Base62Id) -> $struct {
|
||||
$con(id.0)
|
||||
}
|
||||
}
|
||||
impl From<$struct> for Base62Id {
|
||||
fn from(id: $struct) -> Base62Id {
|
||||
Base62Id(id.0)
|
||||
}
|
||||
}
|
||||
)+
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_base62_display {
|
||||
($struct:ty) => {
|
||||
impl std::fmt::Display for $struct {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&$crate::common::ids::base62_impl::to_base62(
|
||||
self.0,
|
||||
))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
impl_base62_display!(Base62Id);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! base62_id_impl {
|
||||
($struct:ty, $cons:expr) => {
|
||||
$crate::common::ids::from_base62id!($struct, $cons;);
|
||||
$crate::common::ids::impl_base62_display!($struct);
|
||||
}
|
||||
}
|
||||
base62_id_impl!(UserId, UserId);
|
||||
|
||||
pub use {base62_id_impl, from_base62id, impl_base62_display};
|
||||
|
||||
pub mod base62_impl {
|
||||
use serde::de::{self, Deserializer, Visitor};
|
||||
use serde::ser::Serializer;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{Base62Id, DecodingError};
|
||||
|
||||
impl<'de> Deserialize<'de> for Base62Id {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
struct Base62Visitor;
|
||||
|
||||
impl Visitor<'_> for Base62Visitor {
|
||||
type Value = Base62Id;
|
||||
|
||||
fn expecting(
|
||||
&self,
|
||||
formatter: &mut std::fmt::Formatter,
|
||||
) -> std::fmt::Result {
|
||||
formatter.write_str("a base62 string id")
|
||||
}
|
||||
|
||||
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
Ok(Base62Id(v))
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, string: &str) -> Result<Base62Id, E>
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
parse_base62(string).map(Base62Id).map_err(E::custom)
|
||||
}
|
||||
}
|
||||
|
||||
if deserializer.is_human_readable() {
|
||||
deserializer.deserialize_str(Base62Visitor)
|
||||
} else {
|
||||
deserializer.deserialize_u64(Base62Visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Base62Id {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
if serializer.is_human_readable() {
|
||||
serializer.serialize_str(&to_base62(self.0))
|
||||
} else {
|
||||
serializer.serialize_u64(self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const BASE62_CHARS: [u8; 62] =
|
||||
*b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
pub fn to_base62(mut num: u64) -> String {
|
||||
let length = (num as f64).log(62.0).ceil() as usize;
|
||||
let mut output = String::with_capacity(length);
|
||||
|
||||
while num > 0 {
|
||||
// Could be done more efficiently, but requires byte
|
||||
// manipulation of strings & Vec<u8> -> String conversion
|
||||
output.insert(0, BASE62_CHARS[(num % 62) as usize] as char);
|
||||
num /= 62;
|
||||
}
|
||||
output
|
||||
}
|
||||
|
||||
pub fn parse_base62(string: &str) -> Result<u64, DecodingError> {
|
||||
let mut num: u64 = 0;
|
||||
for c in string.chars() {
|
||||
let next_digit;
|
||||
if c.is_ascii_digit() {
|
||||
next_digit = (c as u8 - b'0') as u64;
|
||||
} else if c.is_ascii_uppercase() {
|
||||
next_digit = 10 + (c as u8 - b'A') as u64;
|
||||
} else if c.is_ascii_lowercase() {
|
||||
next_digit = 36 + (c as u8 - b'a') as u64;
|
||||
} else {
|
||||
return Err(DecodingError::InvalidBase62(c));
|
||||
}
|
||||
|
||||
// We don't want this panicking or wrapping on integer overflow
|
||||
if let Some(n) =
|
||||
num.checked_mul(62).and_then(|n| n.checked_add(next_digit))
|
||||
{
|
||||
num = n;
|
||||
} else {
|
||||
return Err(DecodingError::Overflow);
|
||||
}
|
||||
}
|
||||
Ok(num)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
pub mod ids;
|
||||
pub mod networking;
|
||||
pub mod users;
|
||||
@@ -1,65 +0,0 @@
|
||||
use crate::common::ids::UserId;
|
||||
use crate::common::users::UserStatus;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum ClientToServerMessage {
|
||||
StatusUpdate {
|
||||
profile_name: Option<String>,
|
||||
},
|
||||
|
||||
SocketListen {
|
||||
socket: Uuid,
|
||||
},
|
||||
SocketClose {
|
||||
socket: Uuid,
|
||||
},
|
||||
SocketSend {
|
||||
socket: Uuid,
|
||||
#[serde(with = "serde_bytes")]
|
||||
data: Vec<u8>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum ServerToClientMessage {
|
||||
StatusUpdate {
|
||||
status: UserStatus,
|
||||
},
|
||||
UserOffline {
|
||||
id: UserId,
|
||||
},
|
||||
FriendStatuses {
|
||||
statuses: Vec<UserStatus>,
|
||||
},
|
||||
FriendRequest {
|
||||
from: UserId,
|
||||
},
|
||||
FriendRequestRejected {
|
||||
from: UserId,
|
||||
},
|
||||
|
||||
FriendSocketListening {
|
||||
user: UserId,
|
||||
socket: Uuid,
|
||||
},
|
||||
FriendSocketStoppedListening {
|
||||
user: UserId,
|
||||
},
|
||||
|
||||
SocketConnected {
|
||||
to_socket: Uuid,
|
||||
new_socket: Uuid,
|
||||
},
|
||||
SocketClosed {
|
||||
socket: Uuid,
|
||||
},
|
||||
SocketData {
|
||||
socket: Uuid,
|
||||
#[serde(with = "serde_bytes")]
|
||||
data: Vec<u8>,
|
||||
},
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod message;
|
||||
pub mod serialization;
|
||||
@@ -1,56 +0,0 @@
|
||||
use super::message::{ClientToServerMessage, ServerToClientMessage};
|
||||
use either::Either;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SerializationError {
|
||||
#[error("Failed to (de)serialize message: {0}")]
|
||||
SerializationFailed(#[from] serde_json::Error),
|
||||
|
||||
#[error("Failed to (de)serialize binary message: {0}")]
|
||||
BinarySerializationFailed(#[from] serde_cbor::Error),
|
||||
}
|
||||
|
||||
macro_rules! message_serialization {
|
||||
($message_enum:ty $(,$binary_pattern:pat_param)* $(,)?) => {
|
||||
impl $message_enum {
|
||||
pub fn is_binary(&self) -> bool {
|
||||
match self {
|
||||
$(
|
||||
$binary_pattern => true,
|
||||
)*
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn serialize(
|
||||
&self,
|
||||
) -> Result<Either<String, Vec<u8>>, SerializationError> {
|
||||
Ok(match self {
|
||||
$(
|
||||
$binary_pattern => Either::Right(serde_cbor::to_vec(self)?),
|
||||
)*
|
||||
_ => Either::Left(serde_json::to_string(self)?),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn deserialize(
|
||||
msg: Either<&str, &[u8]>,
|
||||
) -> Result<Self, SerializationError> {
|
||||
Ok(match msg {
|
||||
Either::Left(text) => serde_json::from_str(&text)?,
|
||||
Either::Right(bytes) => serde_cbor::from_slice(&bytes)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
message_serialization!(
|
||||
ClientToServerMessage,
|
||||
ClientToServerMessage::SocketSend { .. },
|
||||
);
|
||||
message_serialization!(
|
||||
ServerToClientMessage,
|
||||
ServerToClientMessage::SocketData { .. },
|
||||
);
|
||||
@@ -1,15 +0,0 @@
|
||||
use super::ids::Base62Id;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
|
||||
#[serde(from = "Base62Id")]
|
||||
#[serde(into = "Base62Id")]
|
||||
pub struct UserId(pub u64);
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct UserStatus {
|
||||
pub user_id: UserId,
|
||||
pub profile_name: Option<String>,
|
||||
pub last_update: DateTime<Utc>,
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::DatabaseError;
|
||||
use crate::common::ids::base62_impl::to_base62;
|
||||
use crate::common::ids::{random_base62_rng, random_base62_rng_range};
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use ariadne::ids::{random_base62_rng, random_base62_rng_range};
|
||||
use censor::Censor;
|
||||
use rand::SeedableRng;
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::redis::RedisPool;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use dashmap::DashMap;
|
||||
use futures::TryStreamExt;
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::ids::*;
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models::DatabaseError;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::pats::Scopes;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::{DateTime, Utc};
|
||||
use dashmap::DashMap;
|
||||
use futures::TryStreamExt;
|
||||
|
||||
@@ -3,11 +3,11 @@ use super::loader_fields::{
|
||||
VersionField,
|
||||
};
|
||||
use super::{ids::*, User};
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models;
|
||||
use crate::database::models::DatabaseError;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::projects::{MonetizationStatus, ProjectStatus};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::{DateTime, Utc};
|
||||
use dashmap::{DashMap, DashSet};
|
||||
use futures::TryStreamExt;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::ids::*;
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models::DatabaseError;
|
||||
use crate::database::redis::RedisPool;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::{DateTime, Utc};
|
||||
use dashmap::DashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::ids::{ProjectId, UserId};
|
||||
use super::{CollectionId, ReportId, ThreadId};
|
||||
use crate::common::ids::base62_impl::{parse_base62, to_base62};
|
||||
use crate::database::models;
|
||||
use crate::database::models::{DatabaseError, OrganizationId};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::users::Badges;
|
||||
use ariadne::ids::base62_impl::{parse_base62, to_base62};
|
||||
use chrono::{DateTime, Utc};
|
||||
use dashmap::DashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::models::DatabaseError;
|
||||
use crate::common::ids::base62_impl::{parse_base62, to_base62};
|
||||
use ariadne::ids::base62_impl::{parse_base62, to_base62};
|
||||
use chrono::{TimeZone, Utc};
|
||||
use dashmap::DashMap;
|
||||
use deadpool_redis::{Config, Runtime};
|
||||
|
||||
@@ -25,8 +25,6 @@ use crate::{
|
||||
util::env::{parse_strings_from_var, parse_var},
|
||||
};
|
||||
|
||||
pub mod common;
|
||||
|
||||
pub mod auth;
|
||||
pub mod clickhouse;
|
||||
pub mod database;
|
||||
@@ -299,10 +297,8 @@ pub fn app_setup(
|
||||
}
|
||||
|
||||
let ip_salt = Pepper {
|
||||
pepper: crate::common::ids::Base62Id(
|
||||
crate::common::ids::random_base62(11),
|
||||
)
|
||||
.to_string(),
|
||||
pepper: ariadne::ids::Base62Id(ariadne::ids::random_base62(11))
|
||||
.to_string(),
|
||||
};
|
||||
|
||||
let payouts_queue = web::Data::new(PayoutsQueue::new());
|
||||
|
||||
@@ -12,12 +12,12 @@ pub use super::sessions::SessionId;
|
||||
pub use super::teams::TeamId;
|
||||
pub use super::threads::ThreadId;
|
||||
pub use super::threads::ThreadMessageId;
|
||||
pub use super::users::UserId;
|
||||
use crate::common::ids::base62_id_impl;
|
||||
pub use crate::common::ids::Base62Id;
|
||||
pub use crate::models::billing::{
|
||||
ChargeId, ProductId, ProductPriceId, UserSubscriptionId,
|
||||
};
|
||||
use ariadne::ids::base62_id_impl;
|
||||
pub use ariadne::ids::Base62Id;
|
||||
pub use ariadne::users::UserId;
|
||||
|
||||
base62_id_impl!(ProjectId, ProjectId);
|
||||
base62_id_impl!(VersionId, VersionId);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pub use crate::common::users::{UserId, UserStatus};
|
||||
use crate::{auth::AuthProvider, bitflags_serde_impl};
|
||||
pub use ariadne::users::{UserId, UserStatus};
|
||||
use chrono::{DateTime, Utc};
|
||||
use rust_decimal::Decimal;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -74,11 +74,10 @@ pub async fn count_download(
|
||||
let project_id: crate::database::models::ids::ProjectId =
|
||||
download_body.project_id.into();
|
||||
|
||||
let id_option = crate::common::ids::base62_impl::parse_base62(
|
||||
&download_body.version_name,
|
||||
)
|
||||
.ok()
|
||||
.map(|x| x as i64);
|
||||
let id_option =
|
||||
ariadne::ids::base62_impl::parse_base62(&download_body.version_name)
|
||||
.ok()
|
||||
.map(|x| x as i64);
|
||||
|
||||
let (version_id, project_id) = if let Some(version) = sqlx::query!(
|
||||
"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::auth::{get_user_from_headers, send_email};
|
||||
use crate::common::ids::base62_impl::{parse_base62, to_base62};
|
||||
use crate::database::models::charge_item::ChargeItem;
|
||||
use crate::database::models::{
|
||||
generate_charge_id, generate_user_subscription_id, product_item,
|
||||
@@ -16,6 +15,7 @@ use crate::models::users::Badges;
|
||||
use crate::queue::session::AuthQueue;
|
||||
use crate::routes::ApiError;
|
||||
use actix_web::{delete, get, patch, post, web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::{parse_base62, to_base62};
|
||||
use chrono::Utc;
|
||||
use log::{info, warn};
|
||||
use rust_decimal::prelude::ToPrimitive;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use crate::auth::email::send_email;
|
||||
use crate::auth::validate::get_user_record_from_bearer_token;
|
||||
use crate::auth::{get_user_from_headers, AuthProvider, AuthenticationError};
|
||||
use crate::common::ids::base62_impl::{parse_base62, to_base62};
|
||||
use crate::common::ids::random_base62_rng;
|
||||
use crate::database::models::flow_item::Flow;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::file_hosting::FileHost;
|
||||
@@ -20,6 +18,8 @@ use actix_web::web::{scope, Data, Query, ServiceConfig};
|
||||
use actix_web::{delete, get, patch, post, web, HttpRequest, HttpResponse};
|
||||
use argon2::password_hash::SaltString;
|
||||
use argon2::{Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
|
||||
use ariadne::ids::base62_impl::{parse_base62, to_base62};
|
||||
use ariadne::ids::random_base62_rng;
|
||||
use base64::Engine;
|
||||
use chrono::{Duration, Utc};
|
||||
use rand_chacha::rand_core::SeedableRng;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::ApiError;
|
||||
use crate::common::ids::random_base62;
|
||||
use crate::database;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::projects::ProjectStatus;
|
||||
@@ -7,6 +6,7 @@ use crate::queue::moderation::{ApprovalType, IdentifiedFile, MissingMetadata};
|
||||
use crate::queue::session::AuthQueue;
|
||||
use crate::{auth::check_is_moderator_from_headers, models::pats::Scopes};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::random_base62;
|
||||
use serde::Deserialize;
|
||||
use sqlx::PgPool;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
use crate::auth::validate::get_user_record_from_bearer_token;
|
||||
use crate::auth::AuthenticationError;
|
||||
use crate::common::ids::UserId;
|
||||
use crate::common::networking::message::{
|
||||
ClientToServerMessage, ServerToClientMessage,
|
||||
};
|
||||
use crate::common::users::UserStatus;
|
||||
use crate::database::models::friend_item::FriendItem;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::pats::Scopes;
|
||||
@@ -17,6 +12,11 @@ use crate::routes::ApiError;
|
||||
use actix_web::web::{Data, Payload};
|
||||
use actix_web::{get, web, HttpRequest, HttpResponse};
|
||||
use actix_ws::Message;
|
||||
use ariadne::ids::UserId;
|
||||
use ariadne::networking::message::{
|
||||
ClientToServerMessage, ServerToClientMessage,
|
||||
};
|
||||
use ariadne::users::UserStatus;
|
||||
use chrono::Utc;
|
||||
use either::Either;
|
||||
use futures_util::{StreamExt, TryStreamExt};
|
||||
|
||||
@@ -164,7 +164,7 @@ async fn find_version(
|
||||
pool: &PgPool,
|
||||
redis: &RedisPool,
|
||||
) -> Result<Option<QueryVersion>, ApiError> {
|
||||
let id_option = crate::common::ids::base62_impl::parse_base62(vcoords)
|
||||
let id_option = ariadne::ids::base62_impl::parse_base62(vcoords)
|
||||
.ok()
|
||||
.map(|x| x as i64);
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ pub enum ApiError {
|
||||
#[error("Captcha Error. Try resubmitting the form.")]
|
||||
Turnstile,
|
||||
#[error("Error while decoding Base62: {0}")]
|
||||
Decoding(#[from] crate::common::ids::DecodingError),
|
||||
Decoding(#[from] ariadne::ids::DecodingError),
|
||||
#[error("Image Parsing Error: {0}")]
|
||||
ImageParse(#[from] image::ImageError),
|
||||
#[error("Password Hashing Error: {0}")]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::ApiError;
|
||||
use crate::common::ids::base62_impl::to_base62;
|
||||
use crate::database;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::teams::ProjectPermissions;
|
||||
@@ -13,6 +12,7 @@ use crate::{
|
||||
queue::session::AuthQueue,
|
||||
};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::postgres::types::PgInterval;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::auth::checks::is_visible_collection;
|
||||
use crate::auth::{filter_visible_collections, get_user_from_headers};
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models::{
|
||||
collection_item, generate_collection_id, project_item,
|
||||
};
|
||||
@@ -18,6 +17,7 @@ use crate::util::validate::validation_errors_to_string;
|
||||
use crate::{database, models};
|
||||
use actix_web::web::Data;
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::Utc;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::auth::get_user_from_headers;
|
||||
use crate::common::networking::message::ServerToClientMessage;
|
||||
use crate::database::models::UserId;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::pats::Scopes;
|
||||
@@ -9,6 +8,7 @@ use crate::queue::socket::ActiveSockets;
|
||||
use crate::routes::internal::statuses::send_message_to_user;
|
||||
use crate::routes::ApiError;
|
||||
use actix_web::{delete, get, post, web, HttpRequest, HttpResponse};
|
||||
use ariadne::networking::message::ServerToClientMessage;
|
||||
use chrono::Utc;
|
||||
use sqlx::PgPool;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::{collections::HashSet, fmt::Display, sync::Arc};
|
||||
|
||||
use super::ApiError;
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::{
|
||||
auth::{checks::ValidateAuthorized, get_user_from_headers},
|
||||
database::{
|
||||
@@ -31,6 +30,7 @@ use actix_web::{
|
||||
web::{self, scope},
|
||||
HttpRequest, HttpResponse,
|
||||
};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::Utc;
|
||||
use itertools::Itertools;
|
||||
use rand::{distributions::Alphanumeric, Rng, SeedableRng};
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::sync::Arc;
|
||||
|
||||
use super::ApiError;
|
||||
use crate::auth::{filter_visible_projects, get_user_from_headers};
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models::team_item::TeamMember;
|
||||
use crate::database::models::{
|
||||
generate_organization_id, team_item, Organization,
|
||||
@@ -21,6 +20,7 @@ use crate::util::routes::read_from_payload;
|
||||
use crate::util::validate::validation_errors_to_string;
|
||||
use crate::{database, models};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use futures::TryStreamExt;
|
||||
use rust_decimal::Decimal;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use super::version_creation::{try_create_version_fields, InitialVersionData};
|
||||
use crate::auth::{get_user_from_headers, AuthenticationError};
|
||||
use crate::common::ids::base62_impl::to_base62;
|
||||
use crate::database::models::loader_fields::{
|
||||
Loader, LoaderField, LoaderFieldEnumValue,
|
||||
};
|
||||
@@ -28,6 +27,7 @@ use actix_multipart::{Field, Multipart};
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::web::{self, Data};
|
||||
use actix_web::{HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use chrono::Utc;
|
||||
use futures::stream::StreamExt;
|
||||
use image::ImageError;
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::sync::Arc;
|
||||
|
||||
use crate::auth::checks::{filter_visible_versions, is_visible_project};
|
||||
use crate::auth::{filter_visible_projects, get_user_from_headers};
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database::models::notification_item::NotificationBuilder;
|
||||
use crate::database::models::project_item::{GalleryItem, ModCategory};
|
||||
use crate::database::models::thread_item::ThreadMessageBuilder;
|
||||
@@ -30,6 +29,7 @@ use crate::util::img::{delete_old_images, upload_image_optimized};
|
||||
use crate::util::routes::read_from_payload;
|
||||
use crate::util::validate::validation_errors_to_string;
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::Utc;
|
||||
use futures::TryStreamExt;
|
||||
use itertools::Itertools;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::auth::{check_is_moderator_from_headers, get_user_from_headers};
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database;
|
||||
use crate::database::models::image_item;
|
||||
use crate::database::models::thread_item::{
|
||||
@@ -16,6 +15,7 @@ use crate::queue::session::AuthQueue;
|
||||
use crate::routes::ApiError;
|
||||
use crate::util::img;
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::Utc;
|
||||
use futures::StreamExt;
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::auth::checks::{
|
||||
filter_visible_versions, is_visible_project, is_visible_version,
|
||||
};
|
||||
use crate::auth::get_user_from_headers;
|
||||
use crate::common::ids::base62_impl::parse_base62;
|
||||
use crate::database;
|
||||
use crate::database::models::loader_fields::{
|
||||
self, LoaderField, LoaderFieldEnumValue, VersionField,
|
||||
@@ -28,6 +27,7 @@ use crate::search::SearchConfig;
|
||||
use crate::util::img;
|
||||
use crate::util::validate::validation_errors_to_string;
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/// This module is used for the indexing from any source.
|
||||
pub mod local_import;
|
||||
|
||||
use crate::common::ids::base62_impl::to_base62;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::search::{SearchConfig, UploadSearchProject};
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use local_import::index_local;
|
||||
use log::info;
|
||||
use meilisearch_sdk::client::{Client, SwapIndexes};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::common::ids::base62_impl::to_base62;
|
||||
use crate::database::models::legacy_loader_fields::MinecraftGameVersion;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::projects::ProjectId;
|
||||
use crate::routes::ApiError;
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::Serialize;
|
||||
use sqlx::PgPool;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use common::permissions::PermissionsTest;
|
||||
use common::permissions::PermissionsTestContext;
|
||||
@@ -7,7 +8,6 @@ use common::{
|
||||
environment::{with_test_environment, TestEnvironment},
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use labrinth::models::teams::ProjectPermissions;
|
||||
use labrinth::queue::payouts;
|
||||
use rust_decimal::{prelude::ToPrimitive, Decimal};
|
||||
|
||||
@@ -7,7 +7,7 @@ use labrinth::models::{
|
||||
teams::{OrganizationPermissions, ProjectPermissions},
|
||||
};
|
||||
|
||||
use crate::common::{api_v2::ApiV2, api_v3::ApiV3, dummy_data::TestFile};
|
||||
use ariadne::{api_v2::ApiV2, api_v3::ApiV3, dummy_data::TestFile};
|
||||
|
||||
use super::{
|
||||
models::{CommonProject, CommonVersion},
|
||||
@@ -81,7 +81,7 @@ delegate_api_variant!(
|
||||
[add_gallery_item, ServiceResponse, id_or_slug: &str, image: ImageData, featured: bool, title: Option<String>, description: Option<String>, ordering: Option<i32>, pat: Option<&str>],
|
||||
[remove_gallery_item, ServiceResponse, id_or_slug: &str, image_url: &str, pat: Option<&str>],
|
||||
[edit_gallery_item, ServiceResponse, id_or_slug: &str, image_url: &str, patch: HashMap<String, String>, pat: Option<&str>],
|
||||
[create_report, ServiceResponse, report_type: &str, id: &str, item_type: crate::common::api_common::models::CommonItemType, body: &str, pat: Option<&str>],
|
||||
[create_report, ServiceResponse, report_type: &str, id: &str, item_type: ariadne::api_common::models::CommonItemType, body: &str, pat: Option<&str>],
|
||||
[get_report, ServiceResponse, id: &str, pat: Option<&str>],
|
||||
[get_reports, ServiceResponse, ids: &[&str], pat: Option<&str>],
|
||||
[get_user_reports, ServiceResponse, pat: Option<&str>],
|
||||
@@ -100,9 +100,9 @@ delegate_api_variant!(
|
||||
#[async_trait(?Send)]
|
||||
impl ApiTags for GenericApi {
|
||||
[get_loaders, ServiceResponse,],
|
||||
[get_loaders_deserialized_common, Vec<crate::common::api_common::models::CommonLoaderData>,],
|
||||
[get_loaders_deserialized_common, Vec<ariadne::api_common::models::CommonLoaderData>,],
|
||||
[get_categories, ServiceResponse,],
|
||||
[get_categories_deserialized_common, Vec<crate::common::api_common::models::CommonCategoryData>,],
|
||||
[get_categories_deserialized_common, Vec<ariadne::api_common::models::CommonCategoryData>,],
|
||||
}
|
||||
);
|
||||
|
||||
@@ -110,18 +110,18 @@ delegate_api_variant!(
|
||||
#[async_trait(?Send)]
|
||||
impl ApiTeams for GenericApi {
|
||||
[get_team_members, ServiceResponse, team_id: &str, pat: Option<&str>],
|
||||
[get_team_members_deserialized_common, Vec<crate::common::api_common::models::CommonTeamMember>, team_id: &str, pat: Option<&str>],
|
||||
[get_team_members_deserialized_common, Vec<ariadne::api_common::models::CommonTeamMember>, team_id: &str, pat: Option<&str>],
|
||||
[get_teams_members, ServiceResponse, ids: &[&str], pat: Option<&str>],
|
||||
[get_project_members, ServiceResponse, id_or_slug: &str, pat: Option<&str>],
|
||||
[get_project_members_deserialized_common, Vec<crate::common::api_common::models::CommonTeamMember>, id_or_slug: &str, pat: Option<&str>],
|
||||
[get_project_members_deserialized_common, Vec<ariadne::api_common::models::CommonTeamMember>, id_or_slug: &str, pat: Option<&str>],
|
||||
[get_organization_members, ServiceResponse, id_or_title: &str, pat: Option<&str>],
|
||||
[get_organization_members_deserialized_common, Vec<crate::common::api_common::models::CommonTeamMember>, id_or_title: &str, pat: Option<&str>],
|
||||
[get_organization_members_deserialized_common, Vec<ariadne::api_common::models::CommonTeamMember>, id_or_title: &str, pat: Option<&str>],
|
||||
[join_team, ServiceResponse, team_id: &str, pat: Option<&str>],
|
||||
[remove_from_team, ServiceResponse, team_id: &str, user_id: &str, pat: Option<&str>],
|
||||
[edit_team_member, ServiceResponse, team_id: &str, user_id: &str, patch: serde_json::Value, pat: Option<&str>],
|
||||
[transfer_team_ownership, ServiceResponse, team_id: &str, user_id: &str, pat: Option<&str>],
|
||||
[get_user_notifications, ServiceResponse, user_id: &str, pat: Option<&str>],
|
||||
[get_user_notifications_deserialized_common, Vec<crate::common::api_common::models::CommonNotification>, user_id: &str, pat: Option<&str>],
|
||||
[get_user_notifications_deserialized_common, Vec<ariadne::api_common::models::CommonNotification>, user_id: &str, pat: Option<&str>],
|
||||
[get_notification, ServiceResponse, notification_id: &str, pat: Option<&str>],
|
||||
[get_notifications, ServiceResponse, ids: &[&str], pat: Option<&str>],
|
||||
[mark_notification_read, ServiceResponse, notification_id: &str, pat: Option<&str>],
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use labrinth::util::actix::MultipartSegment;
|
||||
|
||||
use crate::common::dummy_data::TestFile;
|
||||
use ariadne::dummy_data::TestFile;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct ProjectCreationRequestData {
|
||||
|
||||
@@ -24,7 +24,7 @@ use labrinth::{
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::database::MOD_USER_PAT;
|
||||
use ariadne::database::MOD_USER_PAT;
|
||||
|
||||
use super::{
|
||||
request_data::{self, get_public_project_creation_data},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::{
|
||||
use ariadne::{
|
||||
api_common::request_data::{
|
||||
ProjectCreationRequestData, VersionCreationRequestData,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::ApiV2;
|
||||
use crate::common::api_common::{Api, ApiUser, AppendsOptionalPat};
|
||||
use actix_web::{dev::ServiceResponse, test};
|
||||
use ariadne::api_common::{Api, ApiUser, AppendsOptionalPat};
|
||||
use async_trait::async_trait;
|
||||
|
||||
#[async_trait(?Send)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::{
|
||||
use ariadne::{
|
||||
api_common::request_data::{
|
||||
ProjectCreationRequestData, VersionCreationRequestData,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use actix_web::{dev::ServiceResponse, test};
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::common::api_common::{Api, ApiUser, AppendsOptionalPat};
|
||||
use ariadne::api_common::{Api, ApiUser, AppendsOptionalPat};
|
||||
|
||||
use super::ApiV3;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::common::get_json_val_str;
|
||||
use ariadne::get_json_val_str;
|
||||
use itertools::Itertools;
|
||||
use labrinth::models::v3::projects::Version;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use sqlx::{postgres::PgPoolOptions, PgPool};
|
||||
use std::time::Duration;
|
||||
use url::Url;
|
||||
|
||||
use crate::common::{dummy_data, environment::TestEnvironment};
|
||||
use ariadne::{dummy_data, environment::TestEnvironment};
|
||||
|
||||
use super::{api_v3::ApiV3, dummy_data::DUMMY_DATA_UPDATE};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use itertools::Itertools;
|
||||
use labrinth::models::teams::{OrganizationPermissions, ProjectPermissions};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::{
|
||||
use ariadne::{
|
||||
api_common::ApiTeams,
|
||||
database::{generate_random_name, ADMIN_USER_PAT},
|
||||
};
|
||||
|
||||
@@ -9,13 +9,11 @@ use labrinth::database::models::legacy_loader_fields::MinecraftGameVersion;
|
||||
use labrinth::models::v3;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::{ApiProject, ApiVersion};
|
||||
use crate::common::api_v3::request_data::get_public_project_creation_data;
|
||||
use crate::common::database::*;
|
||||
use ariadne::api_common::{ApiProject, ApiVersion};
|
||||
use ariadne::api_v3::request_data::get_public_project_creation_data;
|
||||
use ariadne::database::*;
|
||||
|
||||
use crate::common::dummy_data::{
|
||||
DummyProjectAlpha, DummyProjectBeta, TestFile,
|
||||
};
|
||||
use ariadne::dummy_data::{DummyProjectAlpha, DummyProjectBeta, TestFile};
|
||||
|
||||
// importing common module.
|
||||
mod common;
|
||||
|
||||
@@ -3,7 +3,7 @@ use common::{
|
||||
environment::with_test_environment_all,
|
||||
};
|
||||
|
||||
use crate::common::api_common::ApiTeams;
|
||||
use ariadne::api_common::ApiTeams;
|
||||
|
||||
mod common;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::common::{
|
||||
use actix_http::StatusCode;
|
||||
use ariadne::{
|
||||
api_common::{ApiProject, ApiTeams},
|
||||
database::{
|
||||
generate_random_name, ADMIN_USER_PAT, ENEMY_USER_ID_PARSED,
|
||||
@@ -9,7 +10,6 @@ use crate::common::{
|
||||
DummyImage, DummyOrganizationZeta, DummyProjectAlpha, DummyProjectBeta,
|
||||
},
|
||||
};
|
||||
use actix_http::StatusCode;
|
||||
use common::{
|
||||
api_v3::ApiV3,
|
||||
database::{FRIEND_USER_ID, FRIEND_USER_PAT, USER_USER_PAT},
|
||||
|
||||
@@ -6,7 +6,7 @@ use common::{database::*, environment::with_test_environment_all};
|
||||
use labrinth::models::pats::Scopes;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::AppendsOptionalPat;
|
||||
use ariadne::api_common::AppendsOptionalPat;
|
||||
|
||||
mod common;
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ use common::api_v3::ApiV3;
|
||||
use common::database::*;
|
||||
use common::dummy_data::DUMMY_CATEGORIES;
|
||||
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use common::environment::{
|
||||
with_test_environment, with_test_environment_all, TestEnvironment,
|
||||
};
|
||||
use common::permissions::{PermissionsTest, PermissionsTestContext};
|
||||
use futures::StreamExt;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use labrinth::database::models::project_item::{
|
||||
PROJECTS_NAMESPACE, PROJECTS_SLUGS_NAMESPACE,
|
||||
};
|
||||
@@ -18,10 +18,10 @@ use labrinth::models::teams::ProjectPermissions;
|
||||
use labrinth::util::actix::{MultipartSegment, MultipartSegmentData};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::models::CommonProject;
|
||||
use crate::common::api_common::request_data::ProjectCreationRequestData;
|
||||
use crate::common::api_common::{ApiProject, ApiTeams, ApiVersion};
|
||||
use crate::common::dummy_data::{
|
||||
use ariadne::api_common::models::CommonProject;
|
||||
use ariadne::api_common::request_data::ProjectCreationRequestData;
|
||||
use ariadne::api_common::{ApiProject, ApiTeams, ApiVersion};
|
||||
use ariadne::dummy_data::{
|
||||
DummyImage, DummyOrganizationZeta, DummyProjectAlpha, DummyProjectBeta,
|
||||
TestFile,
|
||||
};
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::common::api_common::{
|
||||
ApiProject, ApiTeams, ApiUser, ApiVersion, AppendsOptionalPat,
|
||||
};
|
||||
use crate::common::dummy_data::{
|
||||
DummyImage, DummyProjectAlpha, DummyProjectBeta,
|
||||
};
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::test;
|
||||
use ariadne::api_common::{
|
||||
ApiProject, ApiTeams, ApiUser, ApiVersion, AppendsOptionalPat,
|
||||
};
|
||||
use ariadne::dummy_data::{DummyImage, DummyProjectAlpha, DummyProjectBeta};
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use chrono::{Duration, Utc};
|
||||
use common::api_common::models::CommonItemType;
|
||||
use common::api_common::Api;
|
||||
@@ -18,7 +17,6 @@ use common::environment::{
|
||||
with_test_environment, with_test_environment_all, TestEnvironment,
|
||||
};
|
||||
use common::{database::*, scopes::ScopeTest};
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use labrinth::models::pats::Scopes;
|
||||
use labrinth::models::projects::ProjectId;
|
||||
use labrinth::models::users::UserId;
|
||||
|
||||
@@ -4,11 +4,11 @@ use common::database::*;
|
||||
|
||||
use common::dummy_data::DUMMY_CATEGORIES;
|
||||
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use common::environment::with_test_environment;
|
||||
use common::environment::TestEnvironment;
|
||||
use common::search::setup_search_projects;
|
||||
use futures::stream::StreamExt;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::Api;
|
||||
|
||||
@@ -7,7 +7,7 @@ use common::{
|
||||
},
|
||||
};
|
||||
|
||||
use crate::common::api_common::ApiTags;
|
||||
use ariadne::api_common::ApiTags;
|
||||
|
||||
mod common;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::common::{api_common::ApiTeams, database::*};
|
||||
use actix_http::StatusCode;
|
||||
use ariadne::{api_common::ApiTeams, database::*};
|
||||
use common::{
|
||||
api_v3::ApiV3,
|
||||
environment::{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::common::api_common::{ApiProject, ApiTeams};
|
||||
use ariadne::api_common::{ApiProject, ApiTeams};
|
||||
use common::dummy_data::TestFile;
|
||||
use common::{
|
||||
database::{FRIEND_USER_ID, FRIEND_USER_PAT, USER_USER_ID, USER_USER_PAT},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use crate::assert_status;
|
||||
use crate::common::api_common::ApiProject;
|
||||
use ariadne::api_common::ApiProject;
|
||||
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::test;
|
||||
use bytes::Bytes;
|
||||
|
||||
use crate::common::database::USER_USER_PAT;
|
||||
use crate::common::{
|
||||
use ariadne::database::USER_USER_PAT;
|
||||
use ariadne::{
|
||||
api_v2::ApiV2,
|
||||
environment::{with_test_environment, TestEnvironment},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::common::{
|
||||
use ariadne::{
|
||||
api_common::ApiTeams,
|
||||
api_v2::ApiV2,
|
||||
database::{FRIEND_USER_ID, FRIEND_USER_PAT, USER_USER_PAT},
|
||||
|
||||
@@ -16,9 +16,9 @@ use crate::{
|
||||
};
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::test;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use futures::StreamExt;
|
||||
use itertools::Itertools;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use labrinth::{
|
||||
database::models::project_item::PROJECTS_SLUGS_NAMESPACE,
|
||||
models::{projects::ProjectId, teams::ProjectPermissions},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use crate::common::api_common::ApiProject;
|
||||
use crate::common::api_common::ApiVersion;
|
||||
use crate::common::api_v2::request_data::get_public_project_creation_data;
|
||||
use crate::common::api_v2::ApiV2;
|
||||
use crate::common::dummy_data::TestFile;
|
||||
use crate::common::environment::with_test_environment;
|
||||
use crate::common::environment::TestEnvironment;
|
||||
use crate::common::scopes::ScopeTest;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use ariadne::api_common::ApiProject;
|
||||
use ariadne::api_common::ApiVersion;
|
||||
use ariadne::api_v2::request_data::get_public_project_creation_data;
|
||||
use ariadne::api_v2::ApiV2;
|
||||
use ariadne::dummy_data::TestFile;
|
||||
use ariadne::environment::with_test_environment;
|
||||
use ariadne::environment::TestEnvironment;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use ariadne::scopes::ScopeTest;
|
||||
use labrinth::models::pats::Scopes;
|
||||
use labrinth::models::projects::ProjectId;
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
use crate::assert_status;
|
||||
use crate::common::api_common::Api;
|
||||
use crate::common::api_common::ApiProject;
|
||||
use crate::common::api_common::ApiVersion;
|
||||
use crate::common::api_v2::ApiV2;
|
||||
use ariadne::api_common::Api;
|
||||
use ariadne::api_common::ApiProject;
|
||||
use ariadne::api_common::ApiVersion;
|
||||
use ariadne::api_v2::ApiV2;
|
||||
|
||||
use crate::common::database::*;
|
||||
use crate::common::dummy_data::TestFile;
|
||||
use crate::common::dummy_data::DUMMY_CATEGORIES;
|
||||
use crate::common::environment::with_test_environment;
|
||||
use crate::common::environment::TestEnvironment;
|
||||
use actix_http::StatusCode;
|
||||
use ariadne::database::*;
|
||||
use ariadne::dummy_data::TestFile;
|
||||
use ariadne::dummy_data::DUMMY_CATEGORIES;
|
||||
use ariadne::environment::with_test_environment;
|
||||
use ariadne::environment::TestEnvironment;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use futures::stream::StreamExt;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -3,7 +3,7 @@ use labrinth::routes::v2::tags::DonationPlatformQueryData;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use crate::common::{
|
||||
use ariadne::{
|
||||
api_v2::ApiV2,
|
||||
environment::{with_test_environment, TestEnvironment},
|
||||
};
|
||||
|
||||
@@ -9,13 +9,13 @@ use labrinth::{
|
||||
use serde_json::json;
|
||||
|
||||
use crate::assert_status;
|
||||
use crate::common::api_common::{ApiProject, ApiVersion};
|
||||
use crate::common::api_v2::ApiV2;
|
||||
use ariadne::api_common::{ApiProject, ApiVersion};
|
||||
use ariadne::api_v2::ApiV2;
|
||||
|
||||
use crate::common::api_v2::request_data::get_public_project_creation_data;
|
||||
use crate::common::dummy_data::{DummyProjectAlpha, DummyProjectBeta};
|
||||
use crate::common::environment::{with_test_environment, TestEnvironment};
|
||||
use crate::common::{
|
||||
use ariadne::api_v2::request_data::get_public_project_creation_data;
|
||||
use ariadne::dummy_data::{DummyProjectAlpha, DummyProjectBeta};
|
||||
use ariadne::environment::{with_test_environment, TestEnvironment};
|
||||
use ariadne::{
|
||||
database::{ENEMY_USER_PAT, USER_USER_PAT},
|
||||
dummy_data::TestFile,
|
||||
};
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::common::api_common::ApiVersion;
|
||||
use crate::common::database::*;
|
||||
use crate::common::dummy_data::{
|
||||
DummyProjectAlpha, DummyProjectBeta, TestFile,
|
||||
};
|
||||
use crate::common::get_json_val_str;
|
||||
use actix_http::StatusCode;
|
||||
use actix_web::test;
|
||||
use ariadne::api_common::ApiVersion;
|
||||
use ariadne::database::*;
|
||||
use ariadne::dummy_data::{DummyProjectAlpha, DummyProjectBeta, TestFile};
|
||||
use ariadne::get_json_val_str;
|
||||
use ariadne::ids::base62_impl::parse_base62;
|
||||
use common::api_v3::ApiV3;
|
||||
use common::asserts::assert_common_version_ids;
|
||||
use common::database::USER_USER_PAT;
|
||||
use common::environment::{with_test_environment, with_test_environment_all};
|
||||
use futures::StreamExt;
|
||||
use labrinth::common::ids::base62_impl::parse_base62;
|
||||
use labrinth::database::models::version_item::VERSIONS_NAMESPACE;
|
||||
use labrinth::models::projects::{
|
||||
Dependency, DependencyType, VersionId, VersionStatus, VersionType,
|
||||
|
||||
Reference in New Issue
Block a user