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:
4
.github/workflows/labrinth-docker.yml
vendored
4
.github/workflows/labrinth-docker.yml
vendored
@@ -38,8 +38,10 @@ jobs:
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
env:
|
||||
SQLX_OFFLINE: true
|
||||
with:
|
||||
context: ./apps/labrinth
|
||||
file: ./apps/labrinth/Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
|
||||
3
.idea/code.iml
generated
3
.idea/code.iml
generated
@@ -11,9 +11,10 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/apps/labrinth/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/packages/app-lib/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/packages/rust-common/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/packages/ariadne/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
18
Cargo.lock
generated
18
Cargo.lock
generated
@@ -426,6 +426,21 @@ dependencies = [
|
||||
"password-hash 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ariadne"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"either",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_cbor",
|
||||
"serde_json",
|
||||
"thiserror 1.0.64",
|
||||
"uuid 1.12.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.6"
|
||||
@@ -4238,6 +4253,7 @@ dependencies = [
|
||||
"actix-web-prom",
|
||||
"actix-ws",
|
||||
"argon2",
|
||||
"ariadne",
|
||||
"async-stripe",
|
||||
"async-trait",
|
||||
"base64 0.21.7",
|
||||
@@ -8900,6 +8916,7 @@ dependencies = [
|
||||
name = "theseus"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"ariadne",
|
||||
"async-recursion",
|
||||
"async-tungstenite",
|
||||
"async_zip",
|
||||
@@ -8916,7 +8933,6 @@ dependencies = [
|
||||
"flate2",
|
||||
"futures 0.3.30",
|
||||
"indicatif",
|
||||
"labrinth",
|
||||
"lazy_static",
|
||||
"notify",
|
||||
"notify-debouncer-mini",
|
||||
|
||||
@@ -7,6 +7,7 @@ members = [
|
||||
'./apps/labrinth',
|
||||
'./apps/daedalus_client',
|
||||
'./packages/daedalus',
|
||||
'./packages/ariadne',
|
||||
]
|
||||
|
||||
# Optimize for speed and reduce size on release builds
|
||||
|
||||
@@ -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,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,
|
||||
|
||||
@@ -63,7 +63,7 @@ base64 = "0.22.0"
|
||||
|
||||
sqlx = { version = "0.8.2", features = [ "runtime-tokio", "sqlite", "macros" ] }
|
||||
|
||||
labrinth = { path = "../../apps/labrinth" }
|
||||
ariadne = { path = "../ariadne" }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.52.0"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::state::{FriendsSocket, UserFriend};
|
||||
use labrinth::common::users::UserStatus;
|
||||
use ariadne::users::UserStatus;
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn friends() -> crate::Result<Vec<UserFriend>> {
|
||||
|
||||
@@ -21,7 +21,7 @@ pub mod data {
|
||||
Project, ProjectType, SearchResult, SearchResults, Settings,
|
||||
TeamMember, Theme, User, UserFriend, Version, WindowSize,
|
||||
};
|
||||
pub use labrinth::common::users::UserStatus;
|
||||
pub use ariadne::users::UserStatus;
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
|
||||
@@ -15,7 +15,7 @@ pub enum ErrorKind {
|
||||
|
||||
#[error("Serialization error (websocket): {0}")]
|
||||
WebsocketSerializationError(
|
||||
#[from] labrinth::common::networking::serialization::SerializationError,
|
||||
#[from] ariadne::networking::serialization::SerializationError,
|
||||
),
|
||||
|
||||
#[error("Error parsing UUID: {0}")]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Theseus state management system
|
||||
use ariadne::users::{UserId, UserStatus};
|
||||
use dashmap::DashMap;
|
||||
use labrinth::common::users::{UserId, UserStatus};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
#[cfg(feature = "tauri")]
|
||||
|
||||
@@ -5,6 +5,10 @@ use crate::event::FriendPayload;
|
||||
use crate::state::tunnel::InternalTunnelSocket;
|
||||
use crate::state::{ProcessManager, Profile, TunnelSocket};
|
||||
use crate::util::fetch::{fetch_advanced, fetch_json, FetchSemaphore};
|
||||
use ariadne::networking::message::{
|
||||
ClientToServerMessage, ServerToClientMessage,
|
||||
};
|
||||
use ariadne::users::{UserId, UserStatus};
|
||||
use async_tungstenite::tokio::{connect_async, ConnectStream};
|
||||
use async_tungstenite::tungstenite::client::IntoClientRequest;
|
||||
use async_tungstenite::tungstenite::Message;
|
||||
@@ -14,10 +18,6 @@ use dashmap::DashMap;
|
||||
use either::Either;
|
||||
use futures::stream::SplitSink;
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use labrinth::common::networking::message::{
|
||||
ClientToServerMessage, ServerToClientMessage,
|
||||
};
|
||||
use labrinth::common::users::{UserId, UserStatus};
|
||||
use reqwest::header::HeaderValue;
|
||||
use reqwest::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::state::friends::{TunnelSockets, WriteSocket};
|
||||
use crate::state::FriendsSocket;
|
||||
use labrinth::common::networking::message::ClientToServerMessage;
|
||||
use ariadne::networking::message::ClientToServerMessage;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
15
packages/ariadne/Cargo.toml
Normal file
15
packages/ariadne/Cargo.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "ariadne"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0"
|
||||
uuid = { version = "1.2.2", features = ["v4", "fast-rng", "serde"] }
|
||||
serde_bytes = "0.11"
|
||||
rand = "0.8.5"
|
||||
either = "1.13"
|
||||
chrono = { version = "0.4.26", features = ["serde"] }
|
||||
serde_cbor = "0.11"
|
||||
@@ -94,9 +94,7 @@ 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,
|
||||
))
|
||||
f.write_str(&$crate::ids::base62_impl::to_base62(self.0))
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -106,8 +104,8 @@ 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);
|
||||
$crate::ids::from_base62id!($struct, $cons;);
|
||||
$crate::ids::impl_base62_display!($struct);
|
||||
}
|
||||
}
|
||||
base62_id_impl!(UserId, UserId);
|
||||
3
packages/ariadne/src/mod.rs
Normal file
3
packages/ariadne/src/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod ids;
|
||||
pub mod networking;
|
||||
pub mod users;
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::common::ids::UserId;
|
||||
use crate::common::users::UserStatus;
|
||||
use crate::ids::UserId;
|
||||
use crate::users::UserStatus;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
Reference in New Issue
Block a user