Skip to content

Commit

Permalink
Run lint + actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Jul 24, 2024
1 parent b506fb7 commit 6dc317a
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 94 deletions.
1 change: 1 addition & 0 deletions .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- launcher-db-overhual
tags:
- 'v*'
paths:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/app-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modrinth/app-frontend",
"private": true,
"version": "0.7.2",
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
10 changes: 2 additions & 8 deletions apps/app-frontend/src/helpers/utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
add_project_from_version as installMod,
check_installed,
get_full_path,
get_mod_full_path,
} from '@/helpers/profile'
import { useFetch } from '@/helpers/fetch.js'
import { handleError } from '@/store/notifications.js'
import { get_full_path, get_mod_full_path } from '@/helpers/profile'
import { invoke } from '@tauri-apps/api/tauri'

export async function isDev() {
Expand Down Expand Up @@ -55,6 +48,7 @@ export function debounce(fn, wait) {
if (timer) {
clearTimeout(timer) // clear any pre-existing timer
}
// eslint-disable-next-line @typescript-eslint/no-this-alias
const context = this // get the current context
timer = setTimeout(() => {
fn.apply(context, args) // call the function if time expires
Expand Down
122 changes: 61 additions & 61 deletions apps/app-playground/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,72 +43,72 @@ async fn main() -> theseus::Result<()> {
// Initialize state
State::init().await?;

// if minecraft_auth::users().await?.is_empty() {
// println!("No users found, authenticating.");
// authenticate_run().await?; // could take credentials from here direct, but also deposited in state users
// }
// //
// // st.settings
// // .write()
// // .await
// // .java_globals
// // .insert(JAVA_8_KEY.to_string(), check_jre(path).await?.unwrap());
// // Clear profiles
// println!("Clearing profiles.");
// {
// let h = profile::list().await?;
// for profile in h.into_iter() {
// profile::remove(&profile.path).await?;
// }
// }
//
// println!("Creating/adding profile.");
if minecraft_auth::users().await?.is_empty() {
println!("No users found, authenticating.");
authenticate_run().await?; // could take credentials from here direct, but also deposited in state users
}
//
// st.settings
// .write()
// .await
// .java_globals
// .insert(JAVA_8_KEY.to_string(), check_jre(path).await?.unwrap());
// Clear profiles
println!("Clearing profiles.");
{
let h = profile::list().await?;
for profile in h.into_iter() {
profile::remove(&profile.path).await?;
}
}

println!("Creating/adding profile.");

// let name = "Example".to_string();
// let game_version = "1.21".to_string();
// let modloader = ModLoader::Fabric;
// let loader_version = "stable".to_string();
//
// let pack = CreatePackLocation::FromVersionId {
// project_id: "1KVo5zza".to_string(),
// version_id: "lKloE8SA".to_string(),
// title: "Fabulously Optimized".to_string(),
// icon_url: Some("https://cdn.modrinth.com/data/1KVo5zza/d8152911f8fd5d7e9a8c499fe89045af81fe816e.png".to_string()),
// };
//
// let profile = get_profile_from_pack(pack.clone());
// let profile_path = profile_create(
// profile.name,
// profile.game_version,
// profile.modloader,
// profile.loader_version,
// None,
// None,
// None,
// )
// .await?;
// install_zipped_mrpack(pack, profile_path.to_string()).await?;
//
// let projects = profile::get_projects(&profile_path).await?;
//
// for (path, file) in projects {
// println!(
// "{path} {} {:?} {:?}",
// file.file_name, file.update_version_id, file.metadata
// )
// }
//
// println!("running");
// // Run a profile, running minecraft and store the RwLock to the process
// let process = profile::run(&profile_path).await?;
//
// println!("Minecraft PID: {}", process.pid);
//
// println!("All running process UUID {:?}", process::get_all().await?);
//
// // hold the lock to the process until it ends
// println!("Waiting for process to end...");
// process.wait_for().await?;

let pack = CreatePackLocation::FromVersionId {
project_id: "1KVo5zza".to_string(),
version_id: "lKloE8SA".to_string(),
title: "Fabulously Optimized".to_string(),
icon_url: Some("https://cdn.modrinth.com/data/1KVo5zza/d8152911f8fd5d7e9a8c499fe89045af81fe816e.png".to_string()),
};

let profile = get_profile_from_pack(pack.clone());
let profile_path = profile_create(
profile.name,
profile.game_version,
profile.modloader,
profile.loader_version,
None,
None,
None,
)
.await?;
install_zipped_mrpack(pack, profile_path.to_string()).await?;

let projects = profile::get_projects(&profile_path).await?;

for (path, file) in projects {
println!(
"{path} {} {:?} {:?}",
file.file_name, file.update_version_id, file.metadata
)
}

println!("running");
// Run a profile, running minecraft and store the RwLock to the process
let process = profile::run(&profile_path).await?;

println!("Minecraft PID: {}", process.pid);

println!("All running process UUID {:?}", process::get_all().await?);

// hold the lock to the process until it ends
println!("Waiting for process to end...");
process.wait_for().await?;

Ok(())
}
2 changes: 1 addition & 1 deletion apps/app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "theseus_gui"
version = "0.7.2"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
Expand Down
3 changes: 2 additions & 1 deletion apps/app/src/api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub async fn should_disable_mouseover() -> bool {
}

#[tauri::command]
pub fn show_in_folder(mut path: PathBuf) -> Result<()> {
pub fn show_in_folder(path: PathBuf) -> Result<()> {
{
#[cfg(target_os = "windows")]
{
Expand All @@ -90,6 +90,7 @@ pub fn show_in_folder(mut path: PathBuf) -> Result<()> {
{
use std::fs::metadata;

let mut path = path;
let path_string = path.to_string_lossy().to_string();

if metadata(&path)?.is_dir() {
Expand Down
2 changes: 1 addition & 1 deletion apps/app/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Modrinth App",
"version": "0.7.2"
"version": "0.8.0-beta.1"
},
"tauri": {
"allowlist": {
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/pages/dashboard/revenue/withdraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ const getRangeOfMethod = (method) => {
const maxWithdrawAmount = computed(() => {
const interval = selectedMethod.value.interval;
return interval?.standard ? interval.standard.max : interval?.fixed?.values.slice(-1)[0] ?? 0;
return interval?.standard ? interval.standard.max : (interval?.fixed?.values.slice(-1)[0] ?? 0);

Check failure on line 261 in apps/frontend/src/pages/dashboard/revenue/withdraw.vue

View workflow job for this annotation

GitHub Actions / Build, Test, and Lint

Replace `(interval?.fixed?.values.slice(-1)[0]·??·0)` with `interval?.fixed?.values.slice(-1)[0]·??·0`
});
const minWithdrawAmount = computed(() => {
const interval = selectedMethod.value.interval;
return interval?.standard ? interval.standard.min : interval?.fixed?.values?.[0] ?? fees.value;
return interval?.standard ? interval.standard.min : (interval?.fixed?.values?.[0] ?? fees.value);

Check failure on line 266 in apps/frontend/src/pages/dashboard/revenue/withdraw.vue

View workflow job for this annotation

GitHub Actions / Build, Test, and Lint

Replace `(interval?.fixed?.values?.[0]·??·fees.value)` with `interval?.fixed?.values?.[0]·??·fees.value`
});
const withdrawAccount = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "theseus"
version = "0.7.2"
version = "0.0.0"
authors = ["Jai A <[email protected]>"]
edition = "2018"

Expand Down
8 changes: 3 additions & 5 deletions packages/app-lib/src/api/pack/install_mrpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,8 @@ pub async fn install_zipped_mrpack_files(
.await?
.join(&project_path);

let bytes = bytes::Bytes::from(file);

cache_file_hash(
bytes.clone(),
file.clone(),
&profile_path,
&project_path,
project
Expand All @@ -199,7 +197,7 @@ pub async fn install_zipped_mrpack_files(
)
.await?;

write(&path, &bytes, &state.io_semaphore)
write(&path, &file, &state.io_semaphore)
.await?;
}
_ => {}
Expand Down Expand Up @@ -265,7 +263,7 @@ pub async fn install_zipped_mrpack_files(
&profile::get_full_path(&profile_path)
.await?
.join(new_path),
&*bytes,
&bytes,
&state.io_semaphore,
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions packages/app-lib/src/state/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl CacheValueType {

#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum CacheValue {
Project(Project),

Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/src/state/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl DirectoryInfo {
}

for entry_path in
crate::pack::import::get_all_subfiles(&source).await?
crate::pack::import::get_all_subfiles(source).await?
{
let relative_path = entry_path.strip_prefix(source)?;
let new_path = destination.join(relative_path);
Expand Down
6 changes: 3 additions & 3 deletions packages/app-lib/src/state/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl ModLoader {
}
}

pub fn from_str(val: &str) -> Self {
pub fn from_string(val: &str) -> Self {
match val {
"vanilla" => Self::Vanilla,
"forge" => Self::Forge,
Expand Down Expand Up @@ -257,7 +257,7 @@ impl TryFrom<ProfileQueryResult> for Profile {
name: x.name,
icon_path: x.icon_path,
game_version: x.game_version,
loader: ModLoader::from_str(&x.mod_loader),
loader: ModLoader::from_string(&x.mod_loader),
loader_version: x.mod_loader_version,
groups: serde_json::from_value(x.groups).unwrap_or_default(),
linked_data: if let Some(project_id) = x.linked_project_id {
Expand Down Expand Up @@ -787,7 +787,7 @@ impl Profile {

cache_file_hash(
bytes.clone(),
&profile_path,
profile_path,
&project_path,
hash,
exec,
Expand Down
8 changes: 1 addition & 7 deletions packages/app-lib/src/util/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ pub async fn fetch_advanced(
&& (url.starts_with("https://cdn.modrinth.com")
|| url.starts_with("https://api.modrinth.com"))
{
if let Some(creds) =
crate::state::ModrinthCredentials::get_active(exec).await?
{
Some(creds)
} else {
None
}
crate::state::ModrinthCredentials::get_active(exec).await?
} else {
None
};
Expand Down

0 comments on commit 6dc317a

Please sign in to comment.