Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env sh
set -eu

if git diff --cached --quiet -- \
"package.json" \
"package-lock.json" \
"Steam Desktop Authenticator/tailwind.config.js" \
"Steam Desktop Authenticator/ui/tailwind-input.css" \
':(glob)Steam Desktop Authenticator/ui/**/*.html'; then
if ! git diff --cached --quiet -- "Steam Desktop Authenticator/ui/assets/css/app.css"; then
echo "Stage the UI source changes with app.css so the stylesheet matches the committed source." >&2
exit 1
fi
exit 0
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if ! git diff --quiet -- \
"package.json" \
"package-lock.json" \
"Steam Desktop Authenticator/tailwind.config.js" \
"Steam Desktop Authenticator/ui/tailwind-input.css" \
':(glob)Steam Desktop Authenticator/ui/**/*.html'; then
echo "Stage or stash all UI source changes before committing so app.css is generated from the staged source." >&2
exit 1
fi

npm run build:ui
git add -- "Steam Desktop Authenticator/ui/assets/css/app.css"
12 changes: 12 additions & 0 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ jobs:
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm

- name: Install UI build dependencies
run: npm ci

- name: Verify generated UI stylesheet
run: npm run check:ui

- name: Install .NET Core
uses: actions/setup-dotnet@v6
with:
Expand Down
43 changes: 34 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,33 @@ jobs:
- name: Checkout
uses: actions/checkout@v7

- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm

- name: Install UI build dependencies
run: npm ci

- name: Install .NET Core
uses: actions/setup-dotnet@v6
with:
dotnet-version: 8.0.x

- name: Generate and commit local UI assets
run: |
npm run build:ui
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add "Steam Desktop Authenticator\ui\assets\css\app.css"
if (git diff --cached --quiet) {
Write-Host "Local UI stylesheet is current."
} else {
git commit -m "Build local UI stylesheet"
git push
}

- name: Update Version Numbers
run: |
$version = $env:VERSION
Expand Down Expand Up @@ -78,25 +100,28 @@ jobs:
- name: Clean and publish the release package
run: |
dotnet clean $env:Solution_Name -c Release
dotnet publish "Steam Desktop Authenticator\Steam Desktop Authenticator.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o publish\ASDA
dotnet publish "Launcher\Launcher.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o publish\ASDA

Remove-Item publish\ASDA\*.pdb, publish\ASDA\*.xml, publish\ASDA\*.config -Force -ErrorAction SilentlyContinue
Remove-Item publish\ASDA\bin\*.pdb, publish\ASDA\bin\*.xml, publish\ASDA\bin\*.config -Force -ErrorAction SilentlyContinue

$requiredPaths = @(
"publish\ASDA\Steam Desktop Authenticator.exe",
"publish\ASDA\WebView2Loader.dll",
"publish\ASDA\runtimes",
"publish\ASDA\app\wwwroot\index.html",
"publish\ASDA\app\wwwroot\login.html",
"publish\ASDA\app\wwwroot\input.html"
"publish\ASDA\bin\Steam Desktop Authenticator.exe",
"publish\ASDA\bin\WebView2Loader.dll",
"publish\ASDA\bin\runtimes",
"publish\ASDA\bin\app\ui\index.html",
"publish\ASDA\bin\app\ui\login.html",
"publish\ASDA\bin\app\ui\input.html",
"publish\ASDA\bin\app\ui\assets\css\app.css",
"publish\ASDA\bin\app\ui\assets\fonts\inter-latin.woff2",
"publish\ASDA\bin\app\ui\assets\fonts\jetbrains-mono-latin.woff2",
"publish\ASDA\bin\app\ui\assets\icons\check.svg"
)
$missingPaths = $requiredPaths | Where-Object { -not (Test-Path $_) }
if ($missingPaths) {
throw "Release package is incomplete: $($missingPaths -join ', ')"
}
if (Test-Path publish\ASDA\bin) {
throw "Release package unexpectedly contains the legacy launcher bin folder."
}

- name: Zip Build Output
run: |
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ bld/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Uncomment if you have tasks that create the project's static files in ui
#ui/

# Visual Studio 2017 auto generated files
Generated\ Files/
Expand Down Expand Up @@ -554,6 +554,8 @@ maFiles/
*.maFile
# Steam Guard authenticator exports contain account secrets. Never commit them.
*.[mM][aA][fF][iI][lL][eE]
# Ignore every casing and location of the account-data directory, including manifest.json within it.
**/[mM][aA][fF][iI][lL][eE][sS]/

# Debug and JSON files generated during our analysis
raw_issues.json
Expand Down
2 changes: 1 addition & 1 deletion Launcher/Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<Target Name="PublishMainApp" AfterTargets="Publish">
<Exec Command="dotnet publish &quot;..\Steam Desktop Authenticator\Steam Desktop Authenticator.csproj&quot; -c $(Configuration) --self-contained false -o &quot;$(PublishDir)bin&quot;" />
<Exec Command="dotnet publish &quot;..\Steam Desktop Authenticator\Steam Desktop Authenticator.csproj&quot; -c $(Configuration) -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o &quot;$(PublishDir)bin&quot;" />

<!-- Move the Launcher's PDB to the bin folder to keep the root clean -->
<Move SourceFiles="$(PublishDir)Steam Desktop Authenticator.pdb" DestinationFolder="$(PublishDir)bin" Condition="Exists('$(PublishDir)Steam Desktop Authenticator.pdb')" />
Expand Down
2 changes: 2 additions & 0 deletions Launcher/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics;

const string DataDirectoryEnvironmentVariable = "ASDA_DATA_DIRECTORY";
string binPath = Path.Combine(AppContext.BaseDirectory, "bin", "Steam Desktop Authenticator.exe");

if (File.Exists(binPath))
Expand All @@ -10,6 +11,7 @@
WorkingDirectory = Path.Combine(AppContext.BaseDirectory, "bin"),
UseShellExecute = false
};
processInfo.Environment[DataDirectoryEnvironmentVariable] = AppContext.BaseDirectory;

// Pass along any arguments
foreach (var arg in args)
Expand Down
103 changes: 92 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,104 @@ All credit for the original design and implementation goes to Jessecar96 and the
- Added multi-account trade-confirmation monitoring and notification support.
- Added optional diagnostic logging so users can view and report issues.

## How to Compile / Build
## Build from Source on Windows

If you prefer to compile the program from source rather than downloading the pre-built binaries, follow these steps:
The committed UI assets are included in a normal .NET publish, so Node.js is not required for an ordinary release build.

1. **Install Prerequisites**: You must have the **[.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)** installed on your machine.
2. **Clone the Repository**:
```bash
### Prerequisites

- Windows 10 or later, 64-bit
- **[.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)**

To run the built application, install the .NET 8 Desktop Runtime if the SDK is not installed, and install the [Microsoft Edge WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/#download-section).

### Build a release package from Command Prompt

1. Clone the repository and open the cloned folder:

```powershell
git clone https://github.com/AstroZer01/Astro-Steam-Desktop-Authenticator.git
cd Astro-Steam-Desktop-Authenticator
```
3. **Publish the Application**:
Create the same portable release layout used by the release workflow:
```bash
dotnet publish "Steam Desktop Authenticator/Steam Desktop Authenticator.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o publish/ASDA

2. From the repository root, run this command in Command Prompt:

```bat
dotnet publish "Launcher\Launcher.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o "publish\ASDA"
```

Close any copy of the app running from that folder before rebuilding so Windows can replace its executable. `dotnet publish` restores the required Windows x64 dependencies automatically and preserves an existing root `publish\ASDA\maFiles` folder.

3. When `dotnet publish` completes successfully, start:

```text
publish\ASDA\Steam Desktop Authenticator.exe
```
*Alternatively, open `SteamDesktopAuthenticator.sln` in **Visual Studio 2022**, right-click the **Steam Desktop Authenticator** project, and choose **Publish** (not Build). Use a Folder target with the same Windows x64, framework-dependent, single-file settings and output folder shown above.*
4. **Run the Application**: Start `publish/ASDA/Steam Desktop Authenticator.exe`. Keep the complete `publish/ASDA` folder together; it contains the WebView files and runtime dependencies. The `maFiles` folder is created there on first launch and stores your local account data.

Keep the complete `publish\ASDA` folder together in a folder your Windows account can write to; do not install this portable package under `Program Files`. The root executable is the Launcher; it starts the real app from `publish\ASDA\bin`. The `bin` folder contains the WebView files and runtime dependencies, while the application creates `publish\ASDA\maFiles` beside the Launcher on first launch. Back up that `maFiles` folder securely.

#### Reusable personal build script

If you keep a personal `.bat` file outside the repository, use this version. Change the two paths to your own locations. It intentionally never deletes `%OUTPUT%`, so an existing `%OUTPUT%\maFiles\manifest.json` and its `.maFile` account secrets survive every rebuild. `dotnet clean` only removes intermediate files from the source checkout; it does not affect the release folder.

```bat
@echo off
setlocal EnableExtensions
title Build Astro Steam Desktop Assistant

set "PROJECT_ROOT=E:\Desktop\cursor projects\SteamDesktopAuthenticator-master"
set "OUTPUT=E:\Desktop\Astro Steam Desktop Assistant"

cd /d "%PROJECT_ROOT%" || goto :failed

dotnet clean "SteamDesktopAuthenticator.sln" -c Release || goto :failed
dotnet publish "Launcher\Launcher.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=false -p:PublishTrimmed=false -p:EnableCompressionInSingleFile=false -p:DebugSymbols=false -o "%OUTPUT%" || goto :failed

del /q "%OUTPUT%\*.pdb" "%OUTPUT%\*.xml" "%OUTPUT%\*.config" 2>nul
del /q "%OUTPUT%\bin\*.pdb" "%OUTPUT%\bin\*.xml" "%OUTPUT%\bin\*.config" 2>nul

echo.
echo Compilation finished:
echo %OUTPUT%
pause
exit /b 0

:failed
echo.
echo Compilation failed. Close any running copy of the app and try again.
pause
exit /b 1
```

Never use `rmdir /s`, `del /s`, or a file-cleanup tool on the release root. If you need to discard a release, first copy `maFiles` somewhere secure, then remove only the files you explicitly intend to replace. Git ignores `maFiles` folders and `.maFile` exports so account secrets do not enter commits, pull requests, or releases from this repository.

### Build with Visual Studio 2022

1. Open `SteamDesktopAuthenticator.sln`.
2. Select the `Release` configuration.
3. In Solution Explorer, right-click **Launcher** — not **Steam Desktop Authenticator** — then choose **Publish**.
4. Select a **Folder** target. Use `publish\ASDA` as the target location and select **Windows x64** with **Framework-dependent** deployment.
5. In publish settings, enable **Produce single file** and leave trimming disabled, then select **Publish**.

Visual Studio's regular **Build** command places development output under `bin`; use **Publish** when you want the portable release folder described above.

### UI stylesheet for contributors

The WebView UI ships with committed, local CSS and fonts. Normal .NET builds use the committed `ui/assets/css/app.css` and do not require Node.js.

After changing an HTML template, `tailwind.config.js`, or `ui/tailwind-input.css`, install **[Node.js 22 LTS](https://nodejs.org/)** and run:

```powershell
npm ci # once after cloning or when package-lock.json changes
npm run build:ui
```

Commit the resulting `Steam Desktop Authenticator/ui/assets/css/app.css` with the UI change.

- `npm run build:ui` regenerates `Steam Desktop Authenticator/ui/assets/css/app.css`.
- `npm run check:ui` regenerates the stylesheet and fails if the generated file was not committed.

The hook runs only when staged UI templates, the Tailwind configuration, or the Tailwind input stylesheet change. CI verifies the same invariant, and the release workflow regenerates the stylesheet before publishing.


<p align="center">
Expand Down
42 changes: 38 additions & 4 deletions Steam Desktop Authenticator/ApplicationPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,53 @@ namespace Steam_Desktop_Authenticator
{
internal static class ApplicationPaths
{
private static readonly string[] RequiredWebResourceNames = { "index.html", "login.html", "input.html" };
public const string DataDirectoryEnvironmentVariable = "ASDA_DATA_DIRECTORY";

private static readonly string[] RequiredWebResourceNames =
{
"index.html",
"login.html",
"input.html",
Path.Combine("assets", "css", "app.css"),
Path.Combine("assets", "fonts", "inter-latin.woff2"),
Path.Combine("assets", "fonts", "jetbrains-mono-latin.woff2"),
Path.Combine("assets", "icons", "check.svg")
};

public static string InstallDirectory => Path.TrimEndingDirectorySeparator(AppContext.BaseDirectory);

public static string WebRootDirectory => Path.Combine(InstallDirectory, "app", "wwwroot");
public static string DataDirectory => ResolveDataDirectory();

public static string UiDirectory => Path.Combine(InstallDirectory, "app", "ui");

public static string WebViewUserDataDirectory => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Astro Steam Desktop Authenticator",
"WebView2");

public static string WebViewUserDataDirectory => Path.Combine(InstallDirectory, "app", "webview2");
private static string ResolveDataDirectory()
{
string configuredDataDirectory = Environment.GetEnvironmentVariable(DataDirectoryEnvironmentVariable);
if (String.IsNullOrWhiteSpace(configuredDataDirectory))
{
return InstallDirectory;
}

try
{
return Path.TrimEndingDirectorySeparator(Path.GetFullPath(configuredDataDirectory));
}
catch (Exception)
{
return InstallDirectory;
}
}

public static bool TryGetMissingWebResource(out string missingResource)
{
foreach (string resourceName in RequiredWebResourceNames)
{
string resourcePath = Path.Combine(WebRootDirectory, resourceName);
string resourcePath = Path.Combine(UiDirectory, resourceName);
if (!File.Exists(resourcePath))
{
missingResource = resourcePath;
Expand Down
2 changes: 1 addition & 1 deletion Steam Desktop Authenticator/InputForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private async void SetupModernUI(string label, bool isPassword)
webView.CoreWebView2.ExecuteScriptAsync($"setupInput('{jsLabel}', {isPassStr})");
};

string htmlPath = System.IO.Path.Combine(ApplicationPaths.WebRootDirectory, "input.html");
string htmlPath = System.IO.Path.Combine(ApplicationPaths.UiDirectory, "input.html");
webView.Source = new Uri(htmlPath);
}

Expand Down
2 changes: 1 addition & 1 deletion Steam Desktop Authenticator/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private async void SetupModernUI()
}
};

string htmlPath = System.IO.Path.Combine(ApplicationPaths.WebRootDirectory, "login.html");
string htmlPath = System.IO.Path.Combine(ApplicationPaths.UiDirectory, "login.html");
webView.Source = new Uri(htmlPath);
}

Expand Down
Loading
Loading