parent
9d9122a03f
commit
b94c748ec9
|
|
@ -1,17 +0,0 @@
|
|||
curseforge:
|
||||
api_key: $2a$10$sHAftMsje4Bz/RsaYp3pQ.LpoQKZ8yEOI8gLUMIDASaBkVmJr1uZu
|
||||
|
||||
sql:
|
||||
auth:
|
||||
username: velux_api
|
||||
password: $velux$.api
|
||||
|
||||
api:
|
||||
supported_apis:
|
||||
- modrinth
|
||||
- curseforge
|
||||
- velux
|
||||
- ftb
|
||||
|
||||
port: 1429
|
||||
ip: 127.0.0.1
|
||||
1923
velux_api/Cargo.lock
generated
1923
velux_api/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -1,17 +0,0 @@
|
|||
[package]
|
||||
name = "velux_api"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4"
|
||||
lazy_static = "1.4.0"
|
||||
reqwest = { version = "0.12.4", features = ["json"] }
|
||||
serde_json = "1.0.116"
|
||||
serde_yaml = "0.9.34+deprecated"
|
||||
|
||||
[dependencies.serde]
|
||||
version="1.0.198"
|
||||
features = ["derive"]
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
name: Neo's Skyblock
|
||||
platform: CurseForge
|
||||
authors:
|
||||
- f3af39adb
|
||||
version: 1.0.0
|
||||
image_hash: some hash
|
||||
version_hash: 117b75e40df8a8bc2223375b4714e6b98c8c5b86
|
||||
mods:
|
||||
- name: Applied Energistics 2
|
||||
version: 4.3.2
|
||||
version_hash: c876ed10004d841b8707211a50e030201ba560f9
|
||||
summary: Does some cool things.
|
||||
file: applied-energistics-1.20.1-release.jar
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
use lazy_static::lazy_static;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct ConfigurationBase {
|
||||
pub curseforge: CurseforgeConfig,
|
||||
pub sql: SqlConfig,
|
||||
pub api: ApiConfig
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct CurseforgeConfig {
|
||||
pub api_key: String
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct SqlConfig {
|
||||
pub auth: SqlAuthConfig
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct SqlAuthConfig {
|
||||
pub username: String,
|
||||
pub password: String
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct ApiConfig {
|
||||
pub supported_apis: Vec<String>,
|
||||
pub port: u16,
|
||||
pub ip: String
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref APPLICATION_CONFIG: ConfigurationBase = serde_yaml::from_str(include_str!("../../.config.yaml")).unwrap();
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/*
|
||||
This is a Category struct used by the database.
|
||||
*/
|
||||
pub struct RawCategory {
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
pub mod modpack_defintiions;
|
||||
pub mod categories;
|
||||
pub mod application_config;
|
||||
|
||||
// This is the curseforge API ID for Minecraft.
|
||||
pub const CURSEFORGE_MINECRAFT_GAME_ID: i32 = 432;
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
pub enum Distributor {
|
||||
CurseForge,
|
||||
Modrinth,
|
||||
Velux,
|
||||
FTB
|
||||
}
|
||||
|
||||
pub struct ModPack {
|
||||
name: String,
|
||||
project_id: String,
|
||||
distributor: Distributor,
|
||||
description: String
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
mod routes;
|
||||
mod data;
|
||||
|
||||
use std::ops::Deref;
|
||||
use actix_web::{App, HttpServer, web};
|
||||
use reqwest::{Client, RequestBuilder};
|
||||
use serde::Serialize;
|
||||
use crate::data::application_config::APPLICATION_CONFIG;
|
||||
use crate::data::CURSEFORGE_MINECRAFT_GAME_ID;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename = "camelCase")]
|
||||
struct CurseForgeTestQuery {
|
||||
game_id: u32,
|
||||
sort_field: u32,
|
||||
sort_order: String,
|
||||
}
|
||||
|
||||
async fn test() -> String {
|
||||
let query = CurseForgeTestQuery {
|
||||
game_id: CURSEFORGE_MINECRAFT_GAME_ID as u32,
|
||||
sort_field: 1,
|
||||
sort_order: "desc".to_string()
|
||||
};
|
||||
let client = Client::new();
|
||||
let res = client.get("https://api.curseforge.com")
|
||||
.header("x-api-key", "$2a$10$sHAftMsje4Bz/RsaYp3pQ.LpoQKZ8yEOI8gLUMIDASaBkVmJr1uZu")
|
||||
.query(&query).send().await.unwrap().json();
|
||||
|
||||
println!("{:?}", res);
|
||||
|
||||
"{}".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
println!("Attempting to start on http://{}:{}", APPLICATION_CONFIG.api.ip, APPLICATION_CONFIG.api.port);
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.route("/", test);
|
||||
})
|
||||
.bind((APPLICATION_CONFIG.api.ip.as_str(), APPLICATION_CONFIG.api.port))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
use actix_web::cookie::time::format_description::modifier::UnixTimestamp;
|
||||
|
||||
#[serde(rename = "camelCase")]
|
||||
pub struct CurseForgeApiCategory {
|
||||
id: u32,
|
||||
name: String,
|
||||
slug: String,
|
||||
icon_url: String,
|
||||
date_modified: UnixTimestamp,
|
||||
parent_category_id: u32,
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
use actix_web::cookie::time::format_description::modifier::UnixTimestamp;
|
||||
use serde::Serialize;
|
||||
|
||||
pub enum CurseForgeApiFileReleaseType {
|
||||
Release,
|
||||
Beta,
|
||||
Alpha
|
||||
}
|
||||
|
||||
pub enum CurseForgeApiHashAlgorithm {
|
||||
Sha1,
|
||||
Md5
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiFileHash {
|
||||
value: String,
|
||||
algo: CurseForgeApiHashAlgorithm
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiFile {
|
||||
id: u32,
|
||||
mod_id: u32,
|
||||
is_available: bool,
|
||||
display_name: String,
|
||||
file_name: String,
|
||||
release_type: CurseForgeApiFileReleaseType,
|
||||
hashes: Vec<CurseForgeApiFileHash>,
|
||||
file_date: UnixTimestamp,
|
||||
file_length: u64,
|
||||
download_count: u64,
|
||||
file_size_on_disk: Option<u64>,
|
||||
download_url: String,
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
use actix_web::cookie::time::format_description::modifier::UnixTimestamp;
|
||||
use serde::Serialize;
|
||||
use crate::routes::curseforge::cf_file::CurseForgeApiFile;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiModLinks {
|
||||
pub website_url: String,
|
||||
pub wiki_url: String,
|
||||
pub issues_url: String,
|
||||
pub source_url: String
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiAuthor {
|
||||
pub id: u32,
|
||||
pub name: String
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiModAsset {
|
||||
id: u32,
|
||||
url: String
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CurseForgeApiMod {
|
||||
pub id: u32,
|
||||
pub name: String,
|
||||
pub slug: String,
|
||||
pub links: CurseForgeApiModLinks,
|
||||
pub summary: String,
|
||||
pub status: u32,
|
||||
pub download_count: u64,
|
||||
pub authors: Vec<CurseForgeApiAuthor>,
|
||||
pub logo: CurseForgeApiModAsset,
|
||||
pub screenshots: Vec<CurseForgeApiModAsset>,
|
||||
pub main_file_id: u32,
|
||||
pub latest_files: Vec<CurseForgeApiFile>,
|
||||
pub date_created: UnixTimestamp,
|
||||
pub date_modified: UnixTimestamp,
|
||||
pub date_released: UnixTimestamp,
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
pub mod cf_mods;
|
||||
mod cf_categories;
|
||||
mod cf_file;
|
||||
|
|
@ -1 +0,0 @@
|
|||
pub mod curseforge;
|
||||
Loading…
Reference in New Issue
Block a user