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

[Fix] Added check if heroic can communicate with internet (ping some common websites) #1677

Merged
merged 5 commits into from
Aug 17, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions electron/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ export const Winetricks = {
return execAsync(downloadCommand)
.then(() => {
exec(`chmod +x ${path}`)
logInfo('Downloaded Winetricks', LogPrefix.Backend)
logInfo('Downloaded Winetricks', LogPrefix.WineTricks)
})
.catch(() => {
logWarning('Error Downloading Winetricks', LogPrefix.Backend)
logWarning('Error Downloading Winetricks', LogPrefix.WineTricks)
})
},
run: async (wineVersion: WineInstallation, baseWinePrefix: string) => {
Expand Down
29 changes: 28 additions & 1 deletion electron/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,34 @@ function semverGt(target: string, base: string) {
}

function isOnline() {
return net.isOnline()
let online = net.isOnline()
if (online) {
const hosts = ['google.com', 'store.epicgames.com', 'gog.com']
const errors = [] as string[]
online = hosts.some((host) => {
const args = [host] as string[]

if (isWindows) {
args.push('-n', '1')
} else {
args.push('-c', '1')
}

const { status, stderr } = spawnSync('ping', args)
if (stderr.length) {
errors.push(
[`Ping of ${host} failed with:`, stderr.toString()].join('\n')
)
}
return status === 0
})

if (!online && errors.length) {
logError(errors.join('\n'), LogPrefix.Backend)
}
}

return online
}

export const getFileSize = fileSize.partial({ base: 2 })
Expand Down
4 changes: 2 additions & 2 deletions public/locales/pt_BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@
"open-config-file": "Abrir arquivo de configuração",
"reset-heroic": "Redefinir Heroic",
"saves": {
"warning": "O recurso Cloud Saves está em Beta, faça backup de seus saves antes de sincronizar (caso algo dê errado)",
"label": "Save Location:"
"label": "Save Location:",
"warning": "O recurso Cloud Saves está em Beta, faça backup de seus saves antes de sincronizar (caso algo dê errado)"
}
},
"Settings": "Configurações",
Expand Down