Skip to content

Commit

Permalink
Merge pull request #127 from vitrine-app/release/v0.10.1
Browse files Browse the repository at this point in the history
release: v0.10.1
  • Loading branch information
Paul Roman authored Feb 17, 2019
2 parents fb562c4 + eddfa4c commit 00cb81c
Show file tree
Hide file tree
Showing 106 changed files with 4,339 additions and 2,953 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Vitrine is using custom Node.js native addons, written in C++, which need to be

Vitrine is using multiple APIs to work (IGDB, Steam, Discord...). This keys are obviously not stored in the public repo, but a ciphered version is present.
To build Vitrine, you need an environment variable called `VITRINE_KEY`. If you want to work on the project, feel free to [contact me](mailto:paul.roman@epitech.eu) to retrieve the key!
Then, run `yarn keys:decipher` to build the `keys.hh` file that will contain clear API keys.
Then, run `yarn keys:decrypt` to build the `keys.hh` file that will contain clear APIs keys.
Then just hit with a `yarn run:app` and you're ready to go!


Expand Down
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 150,
"singleQuote": true
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ branches:
- gh-pages-src

before_script:
- yarn keys:decipher
- yarn keys:decrypt
- yarn build:modules-no-electron
- yarn test

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Vitrine Changelog

## 0.10.1 (17/02/2019)
- fix: Vitrine no longer launches forever at first startup

## 0.10.0 (01/11/2018)
- feat: add option to add every potential games at once
- fix: progress shows download percentage on Vitrine upgrade
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install:
- yarn install

before_build:
- yarn keys:decipher
- yarn keys:decrypt
- yarn build:modules-no-electron
- yarn test

Expand Down
3 changes: 0 additions & 3 deletions keys/apis_private_enc.keys

This file was deleted.

24 changes: 16 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vitrine",
"version": "0.10.0",
"version": "0.10.1",
"description": "Centralize all of your games within a simple interface.",
"main": "public/server.js",
"productName": "Vitrine",
Expand All @@ -13,7 +13,7 @@
],
"repository": {
"type": "git",
"url": "git://github.com/paul-roman/vitrine.git"
"url": "git://github.com/vitrine-app/vitrine.git"
},
"engines": {
"node": ">=10.2"
Expand All @@ -37,11 +37,12 @@
"glob-promise": "^3.4.0",
"google-translate-api": "^2.3.0",
"igdb-api-node": "3.1.4",
"jsonwebtoken": "^8.3.0",
"moment": "^2.22.0",
"react": "16.3.2",
"react-contextmenu": "^2.9.2",
"react-datetime": "^2.14.0",
"react-dom": "16.3.2",
"react-dom": "16.3.3",
"react-intl": "^2.7.0",
"react-redux": "5.0.7",
"react-toastify": "4.0.1",
Expand All @@ -60,6 +61,7 @@
"@types/flat": "^0.0.28",
"@types/fs-extra": "5.0.2",
"@types/glob": "7.1.1",
"@types/jsonwebtoken": "^8.3.0",
"@types/mocha": "^5.0.0",
"@types/node": "8.9.3",
"@types/react": "16.3.13",
Expand All @@ -71,7 +73,6 @@
"@types/source-map-support": "^0.4.1",
"@types/uuid": "^3.4.3",
"@types/winreg": "^1.2.30",
"aes256": "^1.0.4",
"asar": "^0.14.3",
"base64-inline-loader": "^1.1.1",
"chai": "^4.1.2",
Expand All @@ -91,16 +92,22 @@
"mocha": "^5.0.5",
"node-gyp": "^3.6.2",
"nyc": "^13.0.1",
"openpgp": "^4.2.1",
"parallel-webpack": "^2.3.0",
"prettier": "^1.15.3",
"semantic-ui-less": "^2.2.14",
"shelljs": "0.8.2",
"source-map-support": "^0.5.9",
"style-loader": "0.23.0",
"ts-loader": "^5.2.1",
"ts-node": "7.0.1",
"tsconfig-paths": "^3.7.0",
"tslint": "^5.9.1",
"tslint-config-prettier": "^1.17.0",
"tslint-eslint-rules": "^5.1.0",
"tslint-react": "^3.5.1",
"tweetnacl": "^1.0.0",
"tweetnacl-util": "^0.15.0",
"typescript": "3.1.1",
"webpack": "^4.4.0",
"webpack-cli": "^3.1.2"
Expand All @@ -119,16 +126,17 @@
"build:client-no-loader": "cross-env NO_LOADER=true parallel-webpack --progress --config=webpack/client.config.js",
"build:modules": "node scripts/build_modules.js",
"build:modules-no-electron": "cross-env NO_ELECTRON=true node scripts/build_modules.js",
"run:app": "yarn lint:app && yarn build:app && electron .",
"run:app": "yarn lint:app && yarn build:app && yarn start",
"run:server": "yarn lint:server && yarn build:server && yarn start",
"run:client": "yarn lint:client && yarn build:client && yarn start",
"run:client-no-loader": "yarn lint:client && yarn build:client-no-loader && yarn start",
"lint:app": "tslint sources/**/*.ts*",
"lint:server": "tslint sources/server/**/*.ts sources/models/**/*.ts",
"lint:client": "tslint sources/client/**/*.ts*",
"lint:prettier": "prettier --write sources/**/*.ts*",
"watch:client": "cross-env NO_LOADER=true parallel-webpack --progress --config=webpack/client.config.js --watch",
"keys:generate": "node scripts/keys_vault.js generate",
"keys:decipher": "node scripts/keys_vault.js decipher",
"keys:encrypt": "node scripts/crypto encrypt",
"keys:decrypt": "node scripts/crypto decrypt",
"test": "nyc mocha",
"test:run": "mocha",
"test:coverage": "nyc report --reporter=text-lcov | coveralls",
Expand All @@ -155,7 +163,7 @@
},
"husky": {
"hooks": {
"precommit": "tslint --fix sources/**/*.ts*"
"precommit": "tslint --fix sources/**/*.ts* && yarn lint:prettier"
}
}
}
37 changes: 37 additions & 0 deletions scripts/crypto.js
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.');
}
40 changes: 0 additions & 40 deletions scripts/keys_vault.js

This file was deleted.

96 changes: 96 additions & 0 deletions sources/client/app/App.tsx
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 };
Loading

0 comments on commit 00cb81c

Please sign in to comment.