You've already forked pages
forked from didirus/AstralRinth
This reverts commit 609e3896eb.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use crate::database::models::categories::LinkPlatform;
|
||||
use crate::database::models::{project_item, version_item};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::file_hosting::{CdnChoice, CdnConfig};
|
||||
use crate::file_hosting::{FileHost, UseAltCdn};
|
||||
use crate::file_hosting::FileHost;
|
||||
use crate::models::projects::{
|
||||
Link, MonetizationStatus, Project, ProjectStatus, SearchRequest, Version,
|
||||
};
|
||||
@@ -268,8 +267,6 @@ pub async fn dependency_list(
|
||||
pool: web::Data<PgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
// TODO: tests, probably
|
||||
let response = v3::projects::dependency_list(
|
||||
@@ -278,8 +275,6 @@ pub async fn dependency_list(
|
||||
pool.clone(),
|
||||
redis.clone(),
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -551,7 +546,7 @@ pub async fn project_edit(
|
||||
version_item::DBVersion::get_many(&version_ids, &**pool, &redis)
|
||||
.await?;
|
||||
for version in versions {
|
||||
let version = Version::from(version, &CdnChoice::Default);
|
||||
let version = Version::from(version);
|
||||
let mut fields = version.fields;
|
||||
let (current_client_side, current_server_side) =
|
||||
v2_reroute::convert_v3_side_types_to_v2_side_types(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use super::ApiError;
|
||||
use crate::database::ReadOnlyPgPool;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::file_hosting::{CdnConfig, UseAltCdn};
|
||||
use crate::models::projects::{Project, Version, VersionType};
|
||||
use crate::models::v2::projects::{LegacyProject, LegacyVersion};
|
||||
use crate::queue::session::AuthQueue;
|
||||
@@ -39,8 +38,6 @@ pub async fn get_version_from_hash(
|
||||
redis: web::Data<RedisPool>,
|
||||
hash_query: web::Query<HashQuery>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let response = v3::version_file::get_version_from_hash(
|
||||
req,
|
||||
@@ -49,8 +46,6 @@ pub async fn get_version_from_hash(
|
||||
redis,
|
||||
hash_query,
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -74,7 +69,6 @@ pub async fn download_version(
|
||||
redis: web::Data<RedisPool>,
|
||||
hash_query: web::Query<HashQuery>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
// Returns TemporaryRedirect, so no need to convert to V2
|
||||
v3::version_file::download_version(
|
||||
@@ -84,7 +78,6 @@ pub async fn download_version(
|
||||
redis,
|
||||
hash_query,
|
||||
session_queue,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)
|
||||
@@ -129,8 +122,6 @@ pub async fn get_update_from_hash(
|
||||
hash_query: web::Query<HashQuery>,
|
||||
update_data: web::Json<UpdateData>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let update_data = update_data.into_inner();
|
||||
let mut loader_fields = HashMap::new();
|
||||
@@ -155,8 +146,6 @@ pub async fn get_update_from_hash(
|
||||
hash_query,
|
||||
web::Json(update_data),
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -186,8 +175,6 @@ pub async fn get_versions_from_hashes(
|
||||
redis: web::Data<RedisPool>,
|
||||
file_data: web::Json<FileHashes>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let file_data = file_data.into_inner();
|
||||
let file_data = v3::version_file::FileHashes {
|
||||
@@ -200,8 +187,6 @@ pub async fn get_versions_from_hashes(
|
||||
redis,
|
||||
web::Json(file_data),
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -296,8 +281,6 @@ pub async fn update_files(
|
||||
pool: web::Data<ReadOnlyPgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
update_data: web::Json<ManyUpdateData>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let update_data = update_data.into_inner();
|
||||
let update_data = v3::version_file::ManyUpdateData {
|
||||
@@ -308,15 +291,10 @@ pub async fn update_files(
|
||||
hashes: update_data.hashes,
|
||||
};
|
||||
|
||||
let response = v3::version_file::update_files(
|
||||
pool,
|
||||
redis,
|
||||
web::Json(update_data),
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
let response =
|
||||
v3::version_file::update_files(pool, redis, web::Json(update_data))
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
|
||||
// Convert response to V2 format
|
||||
match v2_reroute::extract_ok_json::<HashMap<String, Version>>(response)
|
||||
@@ -357,8 +335,6 @@ pub async fn update_individual_files(
|
||||
redis: web::Data<RedisPool>,
|
||||
update_data: web::Json<ManyFileUpdateData>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let update_data = update_data.into_inner();
|
||||
let update_data = v3::version_file::ManyFileUpdateData {
|
||||
@@ -392,8 +368,6 @@ pub async fn update_individual_files(
|
||||
redis,
|
||||
web::Json(update_data),
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
|
||||
@@ -2,7 +2,6 @@ use std::collections::HashMap;
|
||||
|
||||
use super::ApiError;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::file_hosting::{CdnConfig, UseAltCdn};
|
||||
use crate::models;
|
||||
use crate::models::ids::VersionId;
|
||||
use crate::models::projects::{
|
||||
@@ -48,8 +47,6 @@ pub async fn version_list(
|
||||
pool: web::Data<PgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let loaders = if let Some(loaders) = filters.loaders {
|
||||
if let Ok(mut loaders) = serde_json::from_str::<Vec<String>>(&loaders) {
|
||||
@@ -107,8 +104,6 @@ pub async fn version_list(
|
||||
pool,
|
||||
redis,
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -134,8 +129,6 @@ pub async fn version_project_get(
|
||||
pool: web::Data<PgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let id = info.into_inner();
|
||||
let response = v3::versions::version_project_get_helper(
|
||||
@@ -144,8 +137,6 @@ pub async fn version_project_get(
|
||||
pool,
|
||||
redis,
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -171,8 +162,6 @@ pub async fn versions_get(
|
||||
pool: web::Data<PgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let ids = v3::versions::VersionIds { ids: ids.ids };
|
||||
let response = v3::versions::versions_get(
|
||||
@@ -181,8 +170,6 @@ pub async fn versions_get(
|
||||
pool,
|
||||
redis,
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
@@ -207,21 +194,12 @@ pub async fn version_get(
|
||||
pool: web::Data<PgPool>,
|
||||
redis: web::Data<RedisPool>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let id = info.into_inner().0;
|
||||
let response = v3::versions::version_get_helper(
|
||||
req,
|
||||
id,
|
||||
pool,
|
||||
redis,
|
||||
session_queue,
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
let response =
|
||||
v3::versions::version_get_helper(req, id, pool, redis, session_queue)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
// Convert response to V2 format
|
||||
match v2_reroute::extract_ok_json::<Version>(response).await {
|
||||
Ok(version) => {
|
||||
@@ -275,8 +253,6 @@ pub async fn version_edit(
|
||||
redis: web::Data<RedisPool>,
|
||||
new_version: web::Json<EditVersion>,
|
||||
session_queue: web::Data<AuthQueue>,
|
||||
cdn_config: web::Data<CdnConfig>,
|
||||
use_alt_cdn: UseAltCdn,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
let new_version = new_version.into_inner();
|
||||
|
||||
@@ -295,8 +271,6 @@ pub async fn version_edit(
|
||||
pool.clone(),
|
||||
redis.clone(),
|
||||
session_queue.clone(),
|
||||
cdn_config,
|
||||
use_alt_cdn,
|
||||
)
|
||||
.await
|
||||
.or_else(v2_reroute::flatten_404_error)?;
|
||||
|
||||
Reference in New Issue
Block a user