Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.6.0 #33

Merged
merged 75 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1c7c48a
Update README.md
ktwrd Jun 26, 2024
1fe64cb
Update dependencies for fltk
ktwrd Jun 26, 2024
606cb37
Update build.rs for fltk
ktwrd Jun 26, 2024
95a3ece
Add structure for fltk dialog (build will break btw)
ktwrd Jun 26, 2024
575a78c
Add shared_ui.fl
ktwrd Jun 26, 2024
8264887
Use gui::dialog instead of native_dialog
ktwrd Jun 28, 2024
a6201df
Add function wait_for_quit
ktwrd Jun 28, 2024
9387f8a
Fix newlines on text box
ktwrd Jun 28, 2024
3d10ec5
Add function has_gui_support
ktwrd Jun 28, 2024
a955253
Fix show_msgbox_error
ktwrd Jun 28, 2024
9d6b980
Add functions to check for environment variables
ktwrd Jun 28, 2024
ff20513
Don't show dialog when has_gui_support() is false
ktwrd Jun 28, 2024
61b69c9
Add more comments
ktwrd Jun 30, 2024
704a3fc
Update girhub actions to support fltk on ubuntu
ktwrd Jun 30, 2024
8c69a03
Add dependency dark-light
ktwrd Jun 30, 2024
59fbb09
Detect what color theme to used based off system
ktwrd Jun 30, 2024
0f1c989
Fix initial button position not being correct
ktwrd Jun 30, 2024
50453b5
Add icons for fltk
ktwrd Jun 30, 2024
1a85b83
Rewrite dialog as DialogBuilder
ktwrd Jun 30, 2024
997a04f
Remove dependency native-dialog
ktwrd Jun 30, 2024
ef35a1e
Fix resize being triggered when it shouldn't be
ktwrd Jun 30, 2024
71ab26d
Merge branch 'develop' into feature/fltk-dialogs
ktwrd Jul 1, 2024
c27a02f
Merge branch 'develop' into feature/fltk-dialogs
ktwrd Jul 1, 2024
160e81b
Remove --all-features from CI
ktwrd Jul 1, 2024
85d290f
Fix indenting
ktwrd Jul 1, 2024
c18aa6c
Use fltk v1.4.32
ktwrd Jul 1, 2024
a3ffd32
Use gnu for fltk :/
ktwrd Jul 1, 2024
009d0e1
Remove musl-tools from compile.yml
ktwrd Jul 10, 2024
2d7e520
Remove musl-tools from release.yml
ktwrd Jul 10, 2024
d8729b6
Add functions to check if the SourceMod is running
ktwrd Jul 23, 2024
ade019a
Update error.rs
ktwrd Jul 23, 2024
0564d32
Don't report some errors since they're caused by the user
ktwrd Jul 23, 2024
94a2d70
Create UninstallWorkflow
ktwrd Jul 23, 2024
266f36c
Add sub-command for UninstallWorkflow
ktwrd Jul 23, 2024
0cad541
Add wizard option for UninstallWorkflow
ktwrd Jul 23, 2024
be66dc1
Update uninstall.rs
ktwrd Jul 23, 2024
833d062
Merge pull request #19 from ktwrd/feature/fltk-dialogs
ktwrd Jul 23, 2024
b247168
cargo fmt
toastxc Jul 23, 2024
23ff4bc
optimise code inline with clippy best practices
toastxc Jul 23, 2024
04e96b3
removed intoiter
toastxc Jul 29, 2024
81d873f
i found a bit more
toastxc Jul 29, 2024
b9e08cc
added supression for error size
toastxc Jul 29, 2024
5cdf587
`AlwaysNextLine` with fmt
toastxc Jul 29, 2024
7aa71c1
Update rustfmt.toml
ktwrd Jul 30, 2024
2cc88be
Apply new rules from 7aa71c1f
ktwrd Jul 30, 2024
7aa7697
Merge pull request #30 from ktwrd/housekeeping/clippy-1
ktwrd Jul 30, 2024
4920f8c
Backport rustfmt.toml from develop branch.
ktwrd Jul 30, 2024
7ace147
Merge branch 'develop' into feature/workflow-uninstall
ktwrd Jul 30, 2024
ee4760b
aaaaaaaaaaaaa fixed builds lol
ktwrd Jul 30, 2024
c54dfe9
Merge pull request #29 from ktwrd/feature/workflow-uninstall
ktwrd Jul 30, 2024
1274ed5
Add functions in crate for easily getting env vars
ktwrd Aug 6, 2024
5e8eb96
Show current&latest version when update is available
ktwrd Aug 12, 2024
5b7a2f1
Add progress bar for zstd decompression
ktwrd Aug 14, 2024
79a1701
Use cargo fmt
ktwrd Aug 14, 2024
3e8b84b
Merge pull request #32 from ktwrd/feature/extract-progress
ktwrd Aug 27, 2024
0fef0fe
[extract::unpack_tarball] Add error handling for extract w/o progress
ktwrd Sep 8, 2024
98eeacf
beans-rs v1.6.0
ktwrd Sep 8, 2024
bd17b92
bwah
toastxc Sep 9, 2024
0a7695e
converted to matches macro
toastxc Sep 9, 2024
0dfd776
reduced indents
toastxc Sep 9, 2024
5951f27
removed more indentation
toastxc Sep 9, 2024
802cced
oops...
toastxc Sep 9, 2024
63ba5c7
[BeansError] Add backtrace field to CleanTempFailure and DirectoryCre…
ktwrd Sep 10, 2024
d43120f
[DialogBuilder] Use TextDisplay instead of Label for error.
ktwrd Sep 10, 2024
ffbe924
[extract::unpack_tarball] Fix tarball entries not being unpacked prop…
ktwrd Sep 10, 2024
7986d27
[Launcher::find_arg_sourcemods_location] Create directory if it doesn…
ktwrd Sep 10, 2024
64040c2
[InstallWorkflow::install_from] Create output directory if it doesn't…
ktwrd Sep 10, 2024
d4b7a4d
final clippy changes
toastxc Sep 14, 2024
04a7421
Merge branch 'develop' into housekeeping/clippy-2-katefix
ktwrd Sep 15, 2024
747f89f
Merge branch 'develop' into housekeeping/clippy-2
ktwrd Sep 15, 2024
81ce7cd
[extract::unpack_tarball] Fix progress bar being cleared in for loop
ktwrd Sep 15, 2024
bf28450
[extract] Remove unused function
ktwrd Sep 15, 2024
6926b0d
Merge pull request #34 from ktwrd/housekeeping/clippy-2
ktwrd Sep 18, 2024
5081ff7
Merge pull request #31 from ktwrd/ktwrd-patch-1
ktwrd Sep 18, 2024
06f30bd
Updated README.md
ktwrd Sep 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,40 @@ jobs:
include:
- os: ubuntu-20.04
filename: 'beans-rs'
target: x86_64-unknown-linux-musl
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
filename: 'beans-rs.exe'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Build Dependencies (ubuntu)
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get update;
sudo apt-get install -y \
libssl-dev \
musl-tools
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev \
libfltk1.3 \
libfltk1.3-dev \
libssl-dev

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -41,9 +60,9 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --all-features --target ${{ matrix.target }}
args: --verbose --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/${{ matrix.filename }}
path: target/${{ matrix.target }}/debug/${{ matrix.filename }}
31 changes: 25 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,41 @@ jobs:
include:
- os: ubuntu-20.04
filename: 'beans-rs'
target: x86_64-unknown-linux-musl
target: x86_64-unknown-linux-gnu

- os: windows-latest
target: x86_64-pc-windows-msvc
filename: 'beans-rs.exe'

steps:
- uses: actions/checkout@master

- name: Install Build Dependencies (ubuntu)
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get update;
sudo apt-get install -y \
libssl-dev \
musl-tools
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev \
libfltk1.3 \
libfltk1.3-dev \
libssl-dev

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -42,7 +61,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target ${{ matrix.target }}
args: --release --target ${{ matrix.target }}

- name: Upload binaries to release
uses: softprops/action-gh-release@v1
Expand All @@ -61,4 +80,4 @@ jobs:
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# SENTRY_URL: https://sentry.kate.pet
# with:
# environment: production
# environment: production
11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beans-rs"
version = "1.5.2"
version = "1.6.0"
edition = "2021"
authors = [
"Kate Ward <[email protected]>"
Expand Down Expand Up @@ -29,13 +29,20 @@ simple-home-dir = "0.3.4"
clap = { version = "4.5.4", features = ["cargo"] }
bitflags = "2.5.0"
log = "0.4.21"
native-dialog = "0.7.0"
lazy_static = "1.4.0"
thread-id = "4.2.1"
colored = "2.1.0"
sentry-log = "0.34.0"
chrono = "0.4.38"

fltk = { version = "1.4.32" }
fltk-theme = "0.7.2"
dark-light = "1.1.1"
image = { version = "0.25.1", features = ["png"] }

[build-dependencies]
fl2rust = "0.5.19"

[target.'cfg(target_os = "windows")'.dependencies]
winconsole = { version = "0.11.1", features = ["window"] }
winreg = "0.52.0"
Expand Down
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# beans-rs
A Sourcemod Installer written with Rust, using the kachemak versioning system. Intended for general-purpose use, and for server owners.
A Sourcemod Installer written with Rust, using the Kachemak versioning system (based off TF2C). Intended for general-purpose use, and for server owners.

This is a complete rewrite of the original [beans](https://github.com/int-72h/ofinstaller-beans) installer, but with rust, and extended support.

`beans-rs` is licensed under `GPLv3-only`, so please respect it!

**Note** Releases for Linux v1.5.0 and later are built with Ubuntu 20.04 (using `libssl v1.1`)
**Note** Releases for Linux v1.5.0 and later are built with Ubuntu 20.04

## Developing
Requirements
- Rust Toolchain (nightly, only for building)
- Recommended to use [rustup](https://rustup.rs/) to install.
- x86-64/AMD64 Processor ([see notes](#notes-binaries))
- OpenSSL v3 (also required on deployments)
- fltk ([please read "FLTK Linux Dependencies"](#fltk-linux-dependencies))
- (Optional) `fluid` for creating `.fl` files.
- **Following requirements are only required for testing**
- Steam Installed
- Source SDK Base 2013 Multiplayer ([install](steam://instal/243750))
Expand Down Expand Up @@ -69,4 +71,48 @@ All the bundled/embedded binaries are for x86-64/AMD64 systems. We only support

Please do not make any PRs to remove the embedded executables in favor of downloading. Some users would like to use this application offline, or they may have unreliable internet.

Linux Systems not using glibc have not been tested.
Linux Systems not using glibc have not been tested.

### FLTK Linux Dependencies
When building `beans-rs`, some dependencies are required to build it since we need the build dependencies for fltk.

If your distribution is not listed (or the instructions are broken), please look at [`README.unix.txt` in the fltk repo.](https://github.com/fltk/fltk/blob/master/README.Unix.txt).

#### Debian-based
This includes and Linux Distribution that is based off Debian or Ubuntu. Like;
- [Ubuntu](https://ubuntu.com/),
- [Debian](https://www.debian.org/),
- [Linux Mint](https://www.linuxmint.com/),
- [Zorin OS](https://zorin.com/os/),
- [Pop!_OS](https://pop.system76.com/)

```bash
sudo apt update;
sudo apt-get install -y \
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev;
```

#### Fedora
```bash
sudo yum groupinstall -y "Development Tools"
sudo yum groupinstall -y "X Software Development"
sudo yum groupinstall -y "C Development Tools and Libraries"
```
70 changes: 59 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#[allow(dead_code, unused_macros, unused_imports)]
use std::path::PathBuf;
#[allow(dead_code, unused_macros, unused_imports)]
use std::{env,
io};


use std::{env, io};
#[cfg(target_os = "windows")]
use winres::WindowsResource;
#[allow(unused_macros)]
Expand All @@ -12,10 +13,47 @@ macro_rules! print {
}
pub const OVERRIDE_ICON_LOCATION: Option<&'static str> = option_env!("ICON_LOCATION");
pub const RUST_FLAGS: Option<&'static str> = option_env!("RUSTFLAGS");

fn main()
{
windows_icon().expect("Failed to embed icon");
fltk().expect("Failed to build fltk files");
}

/// generate files for fltk ui stuff
fn fltk() -> Result<(), BuildError>
{
println!("cargo:rerun-if-changed=src/gui/shared_ui.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
if let Err(e) = g.in_out(
"src/gui/shared_ui.fl",
out_path.join("shared_ui.rs").to_str().unwrap()
)
{
return Err(BuildError::FLTK(format!(
"Failed to build shared_ui.fl {:#?}",
e
)));
}

Ok(())
}

/// check if a location exists
#[allow(dead_code)]
fn path_exists(path: String) -> bool
{
std::path::Path::new(path.as_str()).exists()
}

/// set the icon to `icon.ico` when building for windows
#[cfg(target_os = "windows")]
fn main() -> io::Result<()> {
fn windows_icon() -> Result<(), BuildError>
{
let icon_location = OVERRIDE_ICON_LOCATION.unwrap_or("icon.ico");
if env::var_os("CARGO_CFG_WINDOWS").is_some() {
if env::var_os("CARGO_CFG_WINDOWS").is_some()
{
if !path_exists(icon_location.to_string())
{
print!("icon.ico not found. Not embedding icon");
Expand All @@ -33,13 +71,23 @@ fn main() -> io::Result<()> {
}
Ok(())
}
/// ignored since icon handling is done by fltk on non-windows
#[cfg(not(target_os = "windows"))]
fn main() -> io::Result<()> {
fn windows_icon() -> Result<(), BuildError>
{
Ok(())
}
#[allow(dead_code)]
fn path_exists(path: String) -> bool

#[derive(Debug)]
pub enum BuildError
{
IO(io::Error),
FLTK(String)
}
impl From<io::Error> for BuildError
{
let p = std::path::Path::new(path.as_str());
return p.exists();
}
fn from(e: io::Error) -> Self
{
BuildError::IO(e)
}
}
Binary file added data/img/default_error_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_error_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_warn_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_warn_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
brace_style="AlwaysNextLine"
combine_control_expr=false
condense_wildcard_suffixes=true
control_brace_style="AlwaysNextLine"
empty_item_single_line=false
fn_params_layout="Vertical"
fn_single_line=false
force_explicit_abi=true
format_code_in_doc_comments=true
format_generated_files=false
hard_tabs=false
hex_literal_case="Upper"
imports_indent="Visual"
imports_layout="Vertical"
indent_style="Block"
inline_attribute_width=0
imports_granularity="Crate"
normalize_comments=true
overflow_delimited_expr=true
group_imports="StdExternalCrate"
single_line_let_else_max_width=0
space_after_colon=true
space_before_colon=false
struct_lit_single_line=false
tab_spaces=4
trailing_comma="Never"
trailing_semicolon=true
where_single_line=false
wrap_comments=true
Loading
Loading