This commit is contained in:
SpikeHD
2022-10-01 16:12:32 -07:00
parent 258c656815
commit 6206b6762a
4 changed files with 8 additions and 39 deletions

View File

@@ -13,7 +13,6 @@ use tauri::api::path::data_dir;
use tauri::async_runtime::block_on;
use std::thread;
use structs::APIQuery;
use sysinfo::{System, SystemExt};
use crate::admin::reopen_as_admin;
@@ -25,7 +24,6 @@ mod gamebanana;
mod lang;
mod metadata_patcher;
mod proxy;
mod structs;
mod system_helpers;
mod unzip;
mod web;
@@ -87,7 +85,6 @@ fn main() {
connect,
disconnect,
req_get,
get_bg_file,
is_game_running,
get_theme_list,
system_helpers::run_command,
@@ -251,8 +248,3 @@ async fn get_theme_list(data_dir: String) -> Vec<HashMap<String, String>> {
themes
}
#[tauri::command]
async fn get_bg_file(bg_path: String, appdata: String) -> String {
return "".to_string(); // This is the greatest Cultivation update of all time.
}

View File

@@ -1,8 +0,0 @@
#![allow(non_snake_case)]
use serde::Deserialize;
#[derive(Deserialize)]
pub(crate) struct APIQuery {
pub bg_file: String,
}

View File

@@ -5,7 +5,6 @@ import DownloadHandler from '../utils/download'
import { getConfigOption } from '../utils/configuration'
import { getTheme, loadTheme } from '../utils/themes'
import { convertFileSrc, invoke } from '@tauri-apps/api/tauri'
import { dataDir } from '@tauri-apps/api/path'
import { Main } from './Main'
import { Mods } from './Mods'
@@ -28,10 +27,6 @@ class App extends React.Component<Readonly<unknown>, IState> {
}
async componentDidMount() {
const game_exe = await getConfigOption('game_install_path')
const game_path = game_exe?.substring(0, game_exe.replace(/\\/g, '/').lastIndexOf('/')) || ''
const root_path = game_path?.substring(0, game_path.replace(/\\/g, '/').lastIndexOf('/')) || ''
// Load a theme if it exists
const theme = await getConfigOption('theme')
if (theme && theme !== 'default') {
@@ -42,23 +37,7 @@ class App extends React.Component<Readonly<unknown>, IState> {
// Get custom bg AFTER theme is loaded !! important !!
const custom_bg = await getConfigOption('customBackground')
if (!custom_bg || !/png|jpg|jpeg$/.test(custom_bg)) {
if (game_path) {
// Get the bg by invoking, then set the background to that bg.
const bgLoc: string = await invoke('get_bg_file', {
bgPath: root_path,
appdata: await dataDir(),
})
bgLoc &&
this.setState(
{
bgFile: bgLoc,
},
this.forceUpdate
)
}
} else {
if (custom_bg) {
const isUrl = /^http(s)?:\/\//gm.test(custom_bg)
if (!isUrl) {

View File

@@ -83,7 +83,13 @@ export class ModList extends React.Component<IProps, IState> {
<div className="ModListInner">
{this.props.mode === 'installed'
? this.state.installedList?.map((mod) => (
<ModTile path={mod.path} mod={mod.info} key={mod.info.name} onClick={this.downloadMod} />
<ModTile
horny={this.state.horny}
path={mod.path}
mod={mod.info}
key={mod.info.name}
onClick={this.downloadMod}
/>
))
: this.state.modList?.map((mod: ModData) => (
<ModTile horny={this.state.horny} mod={mod} key={mod.id} onClick={this.downloadMod} />