-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ import { GradientType, withGradient } from '@getstation/theme'; | |
import ElectronWebview from '../common/components/ElectronWebview'; | ||
import * as classNames from 'classnames'; | ||
import { clipboard } from 'electron'; | ||
import * as remote from '@electron/remote'; | ||
import services from '../services/servicesManager'; | ||
// import * as remote from '@electron/remote'; | ||
// @ts-ignore no declaration file | ||
import { fetchFavicon, setFetchFaviconTimeout } from '@getstation/fetch-favicon'; | ||
import Maybe from 'graphql/tsutils/Maybe'; | ||
|
@@ -51,6 +52,7 @@ import LazyWebview from './LazyWebview'; | |
import { withGetApplicationState } from './[email protected]'; | ||
import { getApplicationDescription } from './selectors'; | ||
import { ApplicationImmutable } from './types'; | ||
// @ts-ignore no declaration file | ||
import { getForeFrontNavigationStateProperty } from './utils'; | ||
|
||
type WebviewMethod = (webview: ElectronWebview) => void; | ||
|
@@ -97,6 +99,7 @@ export interface OwnProps { | |
loading: boolean, | ||
manifestURL: Maybe<string>, | ||
applicationId: string, | ||
appstoreApplicationId: string, | ||
|
||
applicationName: Maybe<string>, | ||
applicationIcon: Maybe<string>, | ||
|
@@ -388,12 +391,10 @@ class ApplicationImpl extends React.PureComponent { | |
const webview = this.webView.view; | ||
|
||
webview.addEventListener('dom-ready', () => { | ||
const webContents = remote.webContents.fromId(webview.getWebContentsId()); | ||
|
||
webview.addEventListener('did-navigate-in-page', (e: any) => this.handleDidNavigateInPage(e)); | ||
webview.addEventListener('did-navigate', (e: any) => this.handleDidNavigate(e)); | ||
webview.addEventListener('ipc-message', (e: any) => this.handleIPCMessage(e)); | ||
this.props.onWebcontentsAttached(webContents.id); | ||
this.props.onWebcontentsAttached(webview.getWebContentsId()); | ||
}); | ||
} | ||
} | ||
|
@@ -403,14 +404,27 @@ class ApplicationImpl extends React.PureComponent { | |
const useNativeWindowOpen = !this.props.notUseNativeWindowOpen; | ||
const tabUrl = tab.get('url', ''); | ||
const { | ||
applicationId, applicationName, applicationIcon, themeColor, manifestURL, | ||
applicationId, applicationName, applicationIcon, | ||
appstoreApplicationId, themeColor, manifestURL, | ||
askResetApplication, onChooseAccount, | ||
crashed, errorCode, errorDescription, | ||
canGoBack, themeGradient, email, | ||
promptBasicAuth, performBasicAuth, basicAuthInfo, | ||
useDefaultSession, | ||
} = this.props; | ||
|
||
const partition = useDefaultSession ? '' : `persist:${applicationId}`; | ||
|
||
// disable SSL check for private applications | ||
if (!useDefaultSession && Number(appstoreApplicationId) > 1000000) { | ||
services.defaultSession.disableSslCertVerification(partition); | ||
|
||
// const appSession = remote.session.fromPartition(partition); | ||
// appSession.setCertificateVerifyProc((_, callback) => { | ||
// callback(0); | ||
// }) | ||
} | ||
|
||
return ( | ||
<div> | ||
<div | ||
|
@@ -487,6 +501,7 @@ const Application = compose( | |
|
||
return { | ||
manifestURL: application.manifestURL(), | ||
appstoreApplicationId: application.appstoreApplicationId(), | ||
applicationId: data.variables.applicationId, | ||
applicationName: manifestData.name(), | ||
applicationIcon: manifestData.interpretedIconURL(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @ts-ignore: no declaration file | ||
import { disableSslCertVerification } from '../../../app/duck'; | ||
import { StationStoreWorker } from '../../../types'; | ||
import { RPC } from '../../lib/types'; | ||
import { SessionProviderService } from './interface'; | ||
|
||
export class SessionProviderServiceImpl extends SessionProviderService implements RPC.Interface<SessionProviderService> { | ||
store: StationStoreWorker; | ||
|
||
constructor(store: StationStoreWorker, uuid?: string) { | ||
super(uuid); | ||
this.store = store; | ||
} | ||
|
||
async disableSslCertVerification(partition: string) { | ||
this.store.dispatch(disableSslCertVerification(partition)); | ||
} | ||
} |