-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from vitrine-app/release/v0.10.1
release: v0.10.1
- Loading branch information
Showing
106 changed files
with
4,339 additions
and
2,953 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 150, | ||
"singleQuote": true | ||
} |
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 was deleted.
Oops, something went wrong.
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,37 @@ | ||
const fs = require('fs-extra'); | ||
const openpgp = require('openpgp'); | ||
|
||
const secret = process.env.VITRINE_KEY; | ||
if (!secret) | ||
throw new Error('VITRINE_KEY is missing.'); | ||
|
||
async function encrypt() { | ||
const file = await fs.readFile('./sources/modules/keysProvider/srcs/keys.hh'); | ||
const { data } = await openpgp.encrypt({ | ||
message: await openpgp.message.fromBinary(file), | ||
passwords: [ secret ], | ||
armor: true | ||
}); | ||
await fs.writeFile('./sources/modules/keysProvider/srcs/keys.hh.asc', data); | ||
} | ||
|
||
async function decrypt() { | ||
const file = await fs.readFile('./sources/modules/keysProvider/srcs/keys.hh.asc'); | ||
const { data } = await openpgp.decrypt({ | ||
message: await openpgp.message.readArmored(file.toString()), | ||
passwords: [ secret ], | ||
format: 'ascii' | ||
}); | ||
await fs.writeFile('./sources/modules/keysProvider/srcs/keys.hh', Buffer.from(data)); | ||
} | ||
|
||
switch (process.argv[2]) { | ||
case 'encrypt': | ||
encrypt(); | ||
break; | ||
case 'decrypt': | ||
decrypt(); | ||
break; | ||
default: | ||
throw new Error('Provide an argument.'); | ||
} |
This file was deleted.
Oops, something went wrong.
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,96 @@ | ||
import * as React from 'react'; | ||
import { IntlProvider } from 'react-intl'; | ||
import { connect } from 'react-redux'; | ||
import { Dispatch } from 'redux'; | ||
|
||
import { ErrorsWrapper } from './features/errors/ErrorsWrapper'; | ||
import { Vitrine } from './features/homescreen/Vitrine'; | ||
import { Action } from './features/redux/actions/actionsTypes'; | ||
import { setLocale, setLocales, updateModulesConfig, updateSettings } from './features/redux/actions/settings'; | ||
import { AppState } from './features/redux/AppState'; | ||
import { serverListener } from './features/serverListener'; | ||
|
||
interface Props { | ||
settings: any; | ||
locales: any[]; | ||
currentLocale: string; | ||
updateSettings: (settings: any) => void; | ||
setLocale: (locale: string) => void; | ||
setLocales: (locales: any) => void; | ||
updateModulesConfig: (modulesConfig: any) => void; | ||
} | ||
|
||
interface State { | ||
settingsReceived: boolean; | ||
} | ||
|
||
class App extends React.Component<Props, State> { | ||
public constructor(props: Props) { | ||
super(props); | ||
|
||
this.state = { | ||
settingsReceived: false | ||
}; | ||
} | ||
|
||
public async componentDidMount() { | ||
serverListener.listen('init-settings', (settings: any, modulesConfig: any, locales: any[]) => { | ||
this.props.setLocales(locales); | ||
this.props.updateSettings(settings); | ||
const currentLocale: any = locales.find(locale => locale.locale === navigator.language); | ||
this.props.setLocale(settings.lang || currentLocale ? currentLocale.locale : 'en'); | ||
this.props.updateModulesConfig(modulesConfig); | ||
this.setState( | ||
{ | ||
settingsReceived: true | ||
}, | ||
() => { | ||
serverListener.send('ready'); | ||
} | ||
); | ||
}); | ||
|
||
serverListener.send('settings-asked'); | ||
} | ||
|
||
public render(): JSX.Element { | ||
const locale: any = this.props.locales.find((currentLocale: any) => currentLocale.locale === this.props.currentLocale); | ||
|
||
return this.state.settingsReceived ? ( | ||
<IntlProvider locale={this.props.currentLocale} messages={locale.messages}> | ||
<ErrorsWrapper> | ||
<Vitrine /> | ||
</ErrorsWrapper> | ||
</IntlProvider> | ||
) : null; | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: AppState) => ({ | ||
currentLocale: state.locale, | ||
locales: state.locales, | ||
settings: state.settings | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch<Action>) => ({ | ||
setLocales(locales: any) { | ||
dispatch(setLocales(locales)); | ||
}, | ||
setLocale(locale: string) { | ||
dispatch(setLocale(locale)); | ||
}, | ||
updateModulesConfig(modulesConfig: any) { | ||
dispatch(updateModulesConfig(modulesConfig)); | ||
}, | ||
updateSettings(settings: any) { | ||
dispatch(updateSettings(settings)); | ||
dispatch(setLocale(settings.lang || 'mdr')); | ||
}, | ||
}); | ||
|
||
const AppContainer = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(App); | ||
|
||
export { AppContainer as App }; |
Oops, something went wrong.