Skip to content

Commit

Permalink
Merge pull request #50 from cohstats/master
Browse files Browse the repository at this point in the history
Release update 1.2.2
  • Loading branch information
petrvecera authored Apr 3, 2023
2 parents 5a532bc + aae4349 commit 2325bea
Show file tree
Hide file tree
Showing 41 changed files with 1,446 additions and 1,410 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: cohstats
6 changes: 6 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
template: |
## What’s Changed
$CHANGES
34 changes: 34 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"tabWidth": 2,
"semi": false,
"singleQuote": false
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coh3-stats-desktop-app",
"private": true,
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/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 src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coh3-stats-desktop-app"
version = "1.2.1"
version = "1.2.2"
description = "A Tauri App"
authors = ["you"]
license = ""
Expand Down
40 changes: 33 additions & 7 deletions src-tauri/src/parse_log_file.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use rev_lines::RevLines;
use nom;
use std::io::BufReader;
use std::io::BufRead;
use std::fs::File;
use log::{info};

Expand Down Expand Up @@ -62,7 +62,26 @@ pub struct LogFileData {
#[tauri::command]
pub fn parse_log_file_reverse(path: String) -> LogFileData {
let file = File::open(path).unwrap();
let rev_lines = RevLines::new(BufReader::new(file)).unwrap();
let reader = BufReader::new(file);

let mut string_array: Vec<String> = Vec::new();

// Because some of the lines are not UTF-8, I needed to skip them while parsing
// this is less effective than using RevLines because we first load the whole log
// and than read it backwards. But I couldn't figure out how to fix it with revlines.
for result in reader.lines() {
match result {
Ok(line) => {
// If the conversion is successful, process the line
string_array.push(line);
}
Err(_) => {
// If the conversion fails, skip the line
// println!("Skipped non-UTF-8 line");
}
}
}

let mut full_game = false;
let mut game_running = true;
let mut game_loading = false;
Expand All @@ -77,8 +96,10 @@ pub fn parse_log_file_reverse(path: String) -> LogFileData {
let mut player_name = "".to_string();
let mut player_steam_id = "".to_string();
let mut language_code = "".to_string();

// Read log file in reverse order line by line
for line in rev_lines {
for line in string_array.iter().rev() {

// Is the line when the game is being closed correctly
if nom::bytes::complete::tag::<&str, &str, ()>("Application closed")(line.as_str()).is_ok() {
game_running = false;
Expand Down Expand Up @@ -190,33 +211,38 @@ pub fn parse_log_file_reverse(path: String) -> LogFileData {
}
}

// Is the line that logs the playing players name
// Is the line that logs the playing players name
} else if let Ok((steam_name, _)) = get_game_player_name(tail) {
player_name = steam_name.to_string();
break;

// Is the line that logs the games language
// Is the line that logs the games language
} else if let Ok((game_language, _)) = get_game_language(tail) {
language_code = game_language.to_string();
}
} else if param == "MOD" {
if let Ok((duration_str, _)) = get_game_over(tail) {
if !full_game {
if let Ok(duration) = duration_str.parse::<u64>() {
game_duration = duration/8;
game_duration = duration / 8;
//println!("Game Duration {}s", duration/8);
}
game_ended = true;
}
}
}
}
}
}


}

let game_state = determine_game_state(game_running, game_ended, game_loading, game_started);
let left_team = get_team_data(left);
let right_team = get_team_data(right);

info!("Log file parsed: Found {} players", left_team.players.len() + right_team.players.len());

LogFileData {
game_state,
game_type: determine_game_type(&left_team, &right_team),
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Coh3 Stats Desktop App",
"version": "1.2.1"
"version": "1.2.2"
},
"tauri": {
"allowlist": {
Expand Down
167 changes: 87 additions & 80 deletions src/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,97 @@ import { getVersion } from "@tauri-apps/api/app"
import { open } from "@tauri-apps/api/shell"
import { useState, useEffect } from "react"
import {
Navbar,
AppShell,
Stack,
Title,
Code,
Text,
Group,
Anchor,
Divider,
Button,
Space,
Box,
Grid,
Navbar,
AppShell,
Stack,
Title,
Code,
Text,
Group,
Anchor,
Divider,
Button,
Space,
Box,
Grid,
} from "@mantine/core"
import logoBig from "./assets/logo/Square310x310Logo.png"
import events from "./mixpanel/mixpanel"

export const About: React.FC = () => {
const [appVersion, setAppVersion] = useState<string>()
useEffect(() => {
getVersion().then((version) => setAppVersion(version))
events.open_about()
}, [])
const [appVersion, setAppVersion] = useState<string>()
useEffect(() => {
getVersion().then((version) => setAppVersion(version))
events.open_about()
}, [])

return (
<>
<Title size="h3" p="md">
About the App
</Title>
<Divider p="xs" />
<Grid style={{ margin: 0 }}>
<Grid.Col span="content">
<img src={logoBig} alt="Coh3Stats Logo" width={200} />
</Grid.Col>
<Grid.Col span="auto" pt="md">
<Group spacing="xs">
<Text fw={600}>Version </Text>
<Code color="green">{appVersion}</Code>
</Group>
<Text component="p" size="sm">
Visit our website{" "}
<Anchor onClick={() => open("https://coh3stats.com/")}>
coh3stats.com
</Anchor>
.
</Text>
<Text component="p" size="sm">
Want to help?{" "}
<Anchor
onClick={() =>
open(
"https://github.com/cohstats/coh3-stats-desktop-app/issues"
)
}
>
Report a bug
</Anchor>
,{" "}
<Anchor
onClick={() => open("https://coh3stats.com/about")}
>
make a donation
</Anchor>{" "}
or{" "}
<Anchor
onClick={() =>
open("https://discord.gg/jRrnwqMfkr")
}
>
join our discord and get involved!
</Anchor>
</Text>
<Button onClick={() => open("https://ko-fi.com/cohstats")}>
<Group spacing="xs">
<img
src="https://storage.ko-fi.com/cdn/cup-border.png"
alt="Ko-fi donations"
width={20}
/>
Donate
</Group>
</Button>
</Grid.Col>
</Grid>
</>
)
return (
<>
<Title size="h3" p="md">
About the App
</Title>
<Divider p="xs" />
<Grid style={{ margin: 0 }}>
<Grid.Col span="content">
<img src={logoBig} alt="Coh3Stats Logo" width={200} />
</Grid.Col>
<Grid.Col span="auto" pt="md">
<Group spacing="xs">
<Text fw={600}>Version </Text>
<Code color="green">{appVersion}</Code>
</Group>
<Text component="p" size="sm">
Visit our website{" "}
<Anchor onClick={() => open("https://coh3stats.com/")}>
coh3stats.com
</Anchor>
.
</Text>
<Text component="p" size="sm">
Want to help?{" "}
<Anchor
onClick={() =>
open(
"https://github.com/cohstats/coh3-stats-desktop-app/issues"
)
}
>
Report a bug
</Anchor>
,{" "}
<Anchor onClick={() => open("https://coh3stats.com/about")}>
make a donation
</Anchor>{" "}
or{" "}
<Anchor onClick={() => open("https://discord.gg/jRrnwqMfkr")}>
join our discord and get involved!
</Anchor>
</Text>
<Title order={5}>Reporting a bug</Title>
<Text component="p" size="sm">
In case of issues please, please try to report them in Discord
sections bugs-and-questions with as much details as possible.
<br />
Also try to provide the warnings.log file from:
<br />{" "}
<Code>
{" "}
C:\Users\Username\Documents\My Games\Company of Heroes
3\warnings.log
</Code>
</Text>
<Button onClick={() => open("https://ko-fi.com/cohstats")}>
<Group spacing="xs">
<img
src="https://storage.ko-fi.com/cdn/cup-border.png"
alt="Ko-fi donations"
width={20}
/>
Donate
</Group>
</Button>
</Grid.Col>
</Grid>
</>
)
}
Loading

0 comments on commit 2325bea

Please sign in to comment.