Linting & prettier

Bump version
This commit is contained in:
Thoronium
2023-04-26 14:51:19 -06:00
parent e38467f054
commit 6e711073ad
8 changed files with 38 additions and 35 deletions

View File

@@ -107,9 +107,9 @@ async fn parse_args(inp: &Vec<String>) -> Result<Args, ArgsError> {
if game_path.is_some() { if game_path.is_some() {
if args.value_of("non-elevated-game")? { if args.value_of("non-elevated-game")? {
system_helpers::run_un_elevated(game_path.unwrap().to_string(), Some(game_args)) system_helpers::run_un_elevated(game_path.unwrap(), Some(game_args))
} else { } else {
system_helpers::run_program(game_path.unwrap().to_string(), Some(game_args)) system_helpers::run_program(game_path.unwrap(), Some(game_args))
} }
} }
} }

View File

@@ -53,9 +53,7 @@ pub async fn unpatch_game() -> bool {
pub async fn get_game_rsa_path() -> Option<String> { pub async fn get_game_rsa_path() -> Option<String> {
let config = config::get_config(); let config = config::get_config();
if config.game_install_path.is_none() { config.game_install_path.as_ref()?;
return None;
}
let mut game_folder = PathBuf::from(config.game_install_path.unwrap()); let mut game_folder = PathBuf::from(config.game_install_path.unwrap());
game_folder.pop(); game_folder.pop();

View File

@@ -6,8 +6,7 @@ pub struct Release {
#[tauri::command] #[tauri::command]
pub async fn get_latest_release() -> Release { pub async fn get_latest_release() -> Release {
// NotThorny edition requests to repo so as to avoid update spam from official repo -alpha version diff. let url = "https://api.github.com/repos/Grasscutters/Cultivation/releases/latest";
let url = "https://api.github.com/repos/NotThorny/Cultivation/releases/latest";
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let response = client let response = client
.get(url) .get(url)
@@ -17,6 +16,7 @@ pub async fn get_latest_release() -> Release {
.unwrap(); .unwrap();
let text = response.text().await.unwrap(); let text = response.text().await.unwrap();
// This includes ip when github rate limits you, so avoid it for now to avoid leaks through screenshots
//println!("Response: {}", text); //println!("Response: {}", text);
// Parse "tag_name" from JSON // Parse "tag_name" from JSON

View File

@@ -230,7 +230,7 @@ pub fn service_status(service: String) -> bool {
} }
}; };
let status_result = my_service.query_status(); let status_result = my_service.query_status();
if status_result.is_ok() { if let Ok(..) = status_result {
let status = status_result.unwrap(); let status = status_result.unwrap();
println!("{} service status: {:?}", service, status.current_state); println!("{} service status: {:?}", service, status.current_state);
if status.current_state == Stopped { if status.current_state == Stopped {

View File

@@ -7,7 +7,7 @@
}, },
"package": { "package": {
"productName": "Cultivation", "productName": "Cultivation",
"version": "1.0.26" "version": "1.0.27"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -143,12 +143,13 @@ export class Mods extends React.Component<IProps, IState> {
} }
async setSearch(text: string) { async setSearch(text: string) {
if(this.timeout) clearTimeout(this.timeout); if (this.timeout) clearTimeout(this.timeout)
this.timeout = window.setTimeout(() => { this.timeout = window.setTimeout(() => {
this.setState({ this.setState(
search: text, {
}, search: text,
this.forceUpdate },
this.forceUpdate
) )
}, 300) }, 300)
} }
@@ -207,13 +208,15 @@ export class Mods extends React.Component<IProps, IState> {
{this.state.category != 'installed' && ( {this.state.category != 'installed' && (
<> <>
<div className="ModPagesPage"> <div className="ModPagesPage">
<TextInput <TextInput
id="search" id="search"
key="search" key="search"
placeholder={this.state.page.toString()} placeholder={this.state.page.toString()}
onChange={(text: string) => {this.setSearch(text)}} onChange={(text: string) => {
this.setSearch(text)
}}
initalValue={''} initalValue={''}
/> />
</div> </div>
<ModPages onClick={this.setPage} headers={pages} defaultHeader={this.state.page} /> <ModPages onClick={this.setPage} headers={pages} defaultHeader={this.state.page} />
</> </>

View File

@@ -17,11 +17,11 @@ interface IState {
horny: boolean horny: boolean
modList: ModData[] | null modList: ModData[] | null
installedList: installedList:
| { | {
path: string path: string
info: ModData | PartialModData info: ModData | PartialModData
}[] }[]
| null | null
} }
export class ModList extends React.Component<IProps, IState> { export class ModList extends React.Component<IProps, IState> {
@@ -68,7 +68,9 @@ export class ModList extends React.Component<IProps, IState> {
if (!(this.props.search == '')) { if (!(this.props.search == '')) {
// idk the api so just filter all mods to search // idk the api so just filter all mods to search
mods = (await getAllMods(this.props.mode)).filter(mod => mod.name.toLowerCase().includes(this.props.search.toLowerCase())) mods = (await getAllMods(this.props.mode)).filter((mod) =>
mod.name.toLowerCase().includes(this.props.search.toLowerCase())
)
} else { } else {
mods = await getMods(this.props.mode, this.props.page) mods = await getMods(this.props.mode, this.props.page)
} }
@@ -89,21 +91,21 @@ export class ModList extends React.Component<IProps, IState> {
return ( return (
<div className="ModList"> <div className="ModList">
{(this.state.modList && this.props.mode !== 'installed') || {(this.state.modList && this.props.mode !== 'installed') ||
(this.state.installedList && this.props.mode === 'installed') ? ( (this.state.installedList && this.props.mode === 'installed') ? (
<div className="ModListInner"> <div className="ModListInner">
{this.props.mode === 'installed' {this.props.mode === 'installed'
? this.state.installedList?.map((mod) => ( ? this.state.installedList?.map((mod) => (
<ModTile <ModTile
horny={this.state.horny} horny={this.state.horny}
path={mod.path} path={mod.path}
mod={mod.info} mod={mod.info}
key={mod.info.name} key={mod.info.name}
onClick={this.downloadMod} onClick={this.downloadMod}
/> />
)) ))
: this.state.modList?.map((mod: ModData) => ( : this.state.modList?.map((mod: ModData) => (
<ModTile horny={this.state.horny} mod={mod} key={mod.id} onClick={this.downloadMod} /> <ModTile horny={this.state.horny} mod={mod} key={mod.id} onClick={this.downloadMod} />
))} ))}
</div> </div>
) : ( ) : (
<LoadingCircle /> <LoadingCircle />

View File

@@ -124,7 +124,7 @@ export default class NewsSection extends React.Component<IProps, IState> {
case 'latest_version': case 'latest_version':
news = ( news = (
<tr> <tr>
<td>Latest version: Grasscutter 1.4.8 - Cultivation 1.0.26</td> <td>Latest version: Grasscutter 1.4.8 - Cultivation 1.0.27</td>
</tr> </tr>
) )
break break