-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/JS-6113-space-store-migration' into nightly-ci-…
…test
- Loading branch information
Showing
371 changed files
with
13,887 additions
and
14,592 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<title>Anytype Web Clipper</title> | ||
</head> | ||
<body> | ||
<script type="text/javascript" src="../js/main.js"></script> | ||
</body> | ||
</html> |
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
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import * as React from 'react'; | ||
import * as hs from 'history'; | ||
import { Router, Route, Switch } from 'react-router-dom'; | ||
import { RouteComponentProps } from 'react-router'; | ||
import { Provider } from 'mobx-react'; | ||
import { configure } from 'mobx'; | ||
import { S, U } from 'Lib'; | ||
|
||
import Index from './auth/index'; | ||
import Success from './auth/success'; | ||
import Util from './lib/util'; | ||
|
||
import './scss/auth.scss'; | ||
|
||
configure({ enforceActions: 'never' }); | ||
|
||
const Routes = [ | ||
{ path: '/' }, | ||
{ path: '/:page' }, | ||
]; | ||
|
||
const Components = { | ||
index: Index, | ||
success: Success, | ||
}; | ||
|
||
const memoryHistory = hs.createMemoryHistory; | ||
const history = memoryHistory(); | ||
|
||
class RoutePage extends React.Component<RouteComponentProps> { | ||
|
||
render () { | ||
const { match } = this.props; | ||
const params = match.params as any; | ||
const page = params.page || 'index'; | ||
const Component = Components[page]; | ||
|
||
return Component ? <Component /> : null; | ||
}; | ||
|
||
}; | ||
|
||
class Auth extends React.Component { | ||
|
||
render () { | ||
return ( | ||
<Router history={history}> | ||
<Provider {...S}> | ||
<div> | ||
<Switch> | ||
{Routes.map((item: any, i: number) => ( | ||
<Route path={item.path} exact={true} key={i} component={RoutePage} /> | ||
))} | ||
</Switch> | ||
</div> | ||
</Provider> | ||
</Router> | ||
); | ||
}; | ||
|
||
componentDidMount () { | ||
U.Router.init(history); | ||
|
||
/* @ts-ignore */ | ||
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { | ||
switch (msg.type) { | ||
case 'initAuth': | ||
const { appKey, gatewayPort, serverPort } = msg; | ||
|
||
Util.init(serverPort, gatewayPort); | ||
Util.authorize(appKey); | ||
|
||
sendResponse({}); | ||
break; | ||
}; | ||
return true; | ||
}); | ||
}; | ||
|
||
}; | ||
|
||
export default Auth; |
Oops, something went wrong.