Skip to content

Commit

Permalink
Fix #90
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyben committed Jun 20, 2022
1 parent 59c9839 commit fbb032f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/renderer-process/left-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ ipcRenderer.on('version', (event, arg) => {
document.getElementById('version').textContent = arg[0];
});

ipcRenderer.on('disableFirewallMessage', (event, arg) => {
document.getElementById('firewallMessage').textContent = "";
});

function resetListOfServers() {
const span = document.getElementById('servers-list');
span.innerHTML = ``;
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ <h1 class="nav-title"><strong>CS:GO </strong>MM server picker</h1>
</header>

<center>
<p style="color:red;font-style: italic;font-weight:bold;font-size:11px">You must enable Windows Firewall for the
<p id="firewallMessage" style="color:red;font-style: italic;font-weight:bold;font-size:11px">You must enable
Windows Firewall for the
app to work</p>
<button class="demo-button" id="ping">📡 Ping</button>
</center>
Expand Down
17 changes: 17 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function initialize() {
getServersFile();
getUpdate();
getMessage();
getFirewallStatusOnWindows();
win.webContents.send('version', [app.getVersion()]);
});
}
Expand Down Expand Up @@ -125,4 +126,20 @@ async function getMessage() {
}
}

function getFirewallStatusOnWindows() {
var cmd = "Invoke-Command -ScriptBlock {[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(\"LocalMachine\",$env:COMPUTERNAME).OpenSubKey(\"System\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\").GetValue(\"EnableFirewall\")}";

if (process.platform !== 'win32') {
return;
}

const { exec } = require('child_process');
exec(cmd, { 'shell': 'powershell.exe' }, (error, stdout, stderr) => {
if (stdout == 1) {
win.webContents.send('disableFirewallMessage');
}
})

}

initialize();
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "csgo-mm-server-picker",
"version": "v1.1.7",
"version": "v1.1.8",
"description": "Server picker for CS:GO matchmaking",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit fbb032f

Please sign in to comment.