Skip to content

Commit

Permalink
Changed build method to use Tauri to bring bundle size down from 133M…
Browse files Browse the repository at this point in the history
…B > 8.7MB
  • Loading branch information
zevnda committed May 16, 2024
1 parent 9d8440d commit 33aa1d6
Show file tree
Hide file tree
Showing 57 changed files with 8,474 additions and 10,054 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/feature_request.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/ISSUE_TEMPLATE/issue_report.yml

This file was deleted.

41 changes: 36 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
node_modules
*.log
.next
app
dist
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
40 changes: 0 additions & 40 deletions .vscode/launch.json

This file was deleted.

21 changes: 0 additions & 21 deletions .vscode/tasks.json

This file was deleted.

15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="./resources/example.png" width='400' alt='Click for larger image'/>
<h1 align="center">Steam Game Idler</h1>
<p align="center">Idle any game in your Steam library. All you need is your Steam username or ID64. No password, token, or any other login information needed.</p>
<p align="center">Built with NextJS + Electron using Nextron.</p>
<p align="center">Built with NextJS + Tauri.</p>
</p>
<p align="center">
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
Expand All @@ -16,8 +16,13 @@
</a>
</p>

# Ready To Go Executable
Download the latest release from [Releases](https://github.com/ProbablyRaging/steam-game-idler/releases)
# Portable Executable
Download the latest `.zip` release from [Releases](https://github.com/ProbablyRaging/steam-game-idler/releases)

*[WebView2](https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH#download-section) required. On Windows 10 (Version 1803 and later with all updates applied) and Windows 11, the WebView2 runtime is distributed as part of the operating system. **Use the MSI Installer if you're unsure, as it comes bundled with all dependencies.***

# MSI Installer
Download the latest `.msi` release from [Releases](https://github.com/ProbablyRaging/steam-game-idler/releases)

# Build It Yourself
1. Clone the repoistory
Expand All @@ -30,9 +35,9 @@ npm install
```
3. Build the app
```
npm run build
npm run tauri build
```
4. Run the `Steam Game Idler.exe` created in `dist/win-unpacked/`
4. Check the console output for build directory *(usually `/src-tauri/target/release/bundle`)*

# Usage
1. Enter your Steam username or [SteamID64](https://steamid.io/)
Expand Down
35 changes: 18 additions & 17 deletions renderer/components/GameList.jsx → components/GameList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import Image from 'next/image';
import moment from 'moment';
import { invoke } from '@tauri-apps/api/tauri';
import { Input, Select, SelectItem, Skeleton } from '@nextui-org/react';
import { MdAvTimer } from "react-icons/md";
import { IoGameController } from 'react-icons/io5';
Expand Down Expand Up @@ -34,14 +35,14 @@ export default function GameList({ steamId }) {
const [inputValue, setInputValue] = useState('');

useEffect(() => {
window.ipc.send('api/user-game-list', { steamId: steamId });

window.ipc.on('user-game-list', (reply) => {
if (reply.error) {
setError(true);
} else {
console.log(reply);
setGameList(reply);
fetch(`https://steeeam.vercel.app/api/ext-user-game-list`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ data: { steamId: steamId } }),
}).then(async res => {
if (res.status !== 500) {
const gameList = await res.json();
setGameList(gameList);
}
});
}, []);
Expand All @@ -51,15 +52,15 @@ export default function GameList({ steamId }) {
setFavorites(favorites.map(JSON.parse));
}, []);

const handleClick = (appId) => {
window.ipc.send('api/status');
window.ipc.once('status', (reply) => {
if (reply) {
window.ipc.send('api/idle', { appId: appId });
} else {
toast.error('Steam is not running');
}
});
const handleClick = async (appId) => {
const status = await invoke('check_status');
if (status) {
const path = await invoke('get_file_path');
const fullPath = path.replace('steam-game-idler.exe', 'lib\\steam-idle.exe');
await invoke('idle_game', { filePath: fullPath, argument: appId.toString() });
} else {
toast.error('Steam is not running');
}
};

const handleSelection = (e, value) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 11 additions & 7 deletions renderer/components/SetupModal.jsx → components/SetupModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@ export default function SetupModal({ setUserSummary }) {

const verify = (uid) => {
setIsLoading(true);
window.ipc.send('api/user-summary', { uid: uid });

window.ipc.on('user-summary', (reply) => {
if (reply.error) {
fetch(`https://steeeam.vercel.app/api/ext-user-summary`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ data: { uid: uid } }),
}).then(async res => {
if (res.status !== 500) {
const userSummary = await res.json()
localStorage.setItem('userSummary', JSON.stringify(userSummary));
setUserSummary(userSummary);
setIsLoading(false);
} else {
setError(<p className='text-red-400'>Check the Steam username or ID and try again</p>);
setIsLoading(false);
setTimeout(() => {
setError(<p>What is <Link href={'https://help.steampowered.com/en/faqs/view/2816-BE67-5B69-0FEC'} target='_blank'>SteamID64</Link>?</p>);
}, 3000);
} else {
localStorage.setItem('userSummary', JSON.stringify(reply));
setUserSummary(reply);
setIsLoading(false);
}
});
};
Expand Down
13 changes: 5 additions & 8 deletions renderer/components/Status.jsx → components/Status.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { Tooltip } from '@nextui-org/react';
import React, { useEffect, useState } from 'react';
import { invoke } from '@tauri-apps/api/tauri';

export default function Status() {
const [steamRunning, setSteamRunning] = useState(false);

useEffect(() => {
setInterval(() => {
window.ipc.send('api/status');

window.ipc.once('status', (reply) => {
console.log(reply);
setSteamRunning(reply);
});
}, 5000);
setInterval(async () => {
const status = await invoke('check_status');
setSteamRunning(status);
}, 1000);
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export default function ThemeSwitch() {

return (
<React.Fragment>
<div className='flex justify-center items-center max-h-[24px]'>
<div className='flex justify-center items-center'>
<div className={`${theme === 'dark' && 'bg-btn-active'} p-2 rounded-full cursor-pointer group`} onClick={() => handleClick('dark')}>
<LuMoonStar fontSize={14} className={`${theme === 'dark' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
<LuMoonStar fontSize={18} className={`${theme === 'dark' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
</div>
<div className={`${theme === 'light' && 'bg-btn-active'} p-2 rounded-full cursor-pointer group`} onClick={() => handleClick('light')}>
<LuSun fontSize={14} className={`${theme === 'light' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
<LuSun fontSize={18} className={`${theme === 'light' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
</div>
<div className={`${theme === 'system' && 'bg-btn-active'} p-2 rounded-full cursor-pointer group`} onClick={() => handleClick('system')}>
<HiMiniComputerDesktop fontSize={14} className={`${theme === 'system' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
<HiMiniComputerDesktop fontSize={18} className={`${theme === 'system' ? 'text-link-hover' : 'text-link'} group-hover:text-link-hover`} />
</div>
</div>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { ThemeProvider as NextThemesProvider } from 'next-themes'
import React from 'react';
import { ThemeProvider as NextThemesProvider } from 'next-themes';

export function ThemeProvider({ children, ...props }) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
Expand Down
3 changes: 0 additions & 3 deletions dist/win-unpacked/steam-game-idler-1.0.1.zip

This file was deleted.

12 changes: 0 additions & 12 deletions electron-builder.yml

This file was deleted.

7 changes: 7 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}
Loading

0 comments on commit 33aa1d6

Please sign in to comment.