Skip to content

Commit

Permalink
[General] Webview improvements and fixes (#836)
Browse files Browse the repository at this point in the history
* rule does not exist

* improve webview responsiveness

* completely block webview until state change

* correct loginurl case removeEventListener

ditto

* Fix Creating Game Shortcuts on Linux

* Fix Check for System Requirements #831

* Add MAC to CI build on Main

* fixed discord RPC indicating macOS was "MacOS" (wrong capitalization use) (#837)

* apply for all urls

* resolve git conflict (hopefully)

* fix case for login. also removes some imports.

* forgorr to remove log :|

* Update translation files

Updated by "Squash Git commits" hook in Weblate.

Update translation files

Updated by "Squash Git commits" hook in Weblate.

Co-authored-by: Hosted Weblate <[email protected]>
Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/
Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/globals/
Translation: Heroic Games Launcher/GamePage
Translation: Heroic Games Launcher/Globals

* [General] Add Login with SID as alternative to Login with Epic (#875)

* chore: wait before getting the sid

* feat: add Login with sid as second option

* 1i8n: updated keys

* Revert "[General] Add Login with SID as alternative to Login with Epic (#875)"

This reverts commit 4eefa9a.

* Revert "Update translation files"

This reverts commit b1dc1bb.

* {} curlies after if

* realign lock

* fix webview URL, swap user agent spoofing to win10

* use did-stop-loading for url

* update url to use did-navigate

Co-authored-by: Flavio F Lima <[email protected]>
Co-authored-by: Andy Lin <[email protected]>
Co-authored-by: Hosted Weblate <[email protected]>
  • Loading branch information
4 people authored Jan 11, 2022
1 parent f92f765 commit b67668e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion downloadCount.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */
/* eslint-disable @typescript-eslint/no-var-requires */
const axios = require('axios')
const { writeFileSync } = require('graceful-fs')
Expand Down
2 changes: 1 addition & 1 deletion src/components/UI/WebviewControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function index({ webview, initURL }: Props) {
const [url, setUrl] = React.useState(initURL)

if (webview) {
webview.addEventListener('did-navigate-in-page', () =>
webview.addEventListener('update-target-url', () =>
setUrl(webview.getURL())
)
}
Expand Down
6 changes: 6 additions & 0 deletions src/screens/WebView/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
height: calc(100vh - 32px);
margin-top: 32px;
}

webview {
position: absolute;
width: var(--content-width);
height: 100%;
}
15 changes: 6 additions & 9 deletions src/screens/WebView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import React, { useContext, useLayoutEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocation } from 'react-router'
import ElectronStore from 'electron-store'

import { UpdateComponent } from 'src/components/UI'
import WebviewControls from 'src/components/UI/WebviewControls'
import ContextProvider from 'src/state/ContextProvider'
import { Webview } from 'src/types'

const Store = window.require('electron-store')
const configStore: ElectronStore = new Store({
cwd: 'store'
})
const { clipboard, ipcRenderer } = window.require('electron')
import './index.css'

Expand All @@ -24,7 +19,7 @@ type SID = {
}

const USER_AGENT =
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.113 Safari/537.36 Vivaldi/5.0.2497.32'
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.137 Safari/537.36'

export default function WebView({ isLogin }: Props) {
const { i18n } = useTranslation()
Expand All @@ -35,7 +30,6 @@ export default function WebView({ isLogin }: Props) {
refresh: boolean
message: string
}>({ refresh: true, message: t('loading.website', 'Loading Website') })
const user = configStore.get('userInfo')

let lang = i18n.language
if (i18n.language === 'pt') {
Expand Down Expand Up @@ -63,9 +57,12 @@ export default function WebView({ isLogin }: Props) {
if (webview) {
const loadstop = () => {
setLoading({ ...loading, refresh: false })

// Ignore the login handling if not on login page
if (pathname !== '/') {
return
}
// Deals with Login
if (!user) {
else {
setTimeout(() => {
webview.findInPage('sid')
webview.addEventListener('found-in-page', async (res) => {
Expand Down

0 comments on commit b67668e

Please sign in to comment.