Skip to content

Commit

Permalink
Merge pull request #335 from FleekHQ/giancarlo/changes-for-public-repo
Browse files Browse the repository at this point in the history
Changes for repo renaming and make it public
  • Loading branch information
giankotarola authored Nov 13, 2020
2 parents d710b26 + fa1a2a3 commit 9df7cf0
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 84 deletions.
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DEV_DAEMON=false
DAEMON_PATH=/path/to/daemon

SPACE_SERVICES_URL=
SPACE_BILLING_SERVICE_URL=
REACT_APP_WS_AUTH_CHALLENGE_URL=

REACT_APP_TORUS_NETWORK=
REACT_APP_TORUS_GOOGLE_VERIFIER=
REACT_APP_TORUS_TWITTER_VERIFIER=
REACT_APP_TORUS_TWITTER_CLIENT_ID=
REACT_APP_TORUS_TWITTER_AUTH_DOMAIN=
REACT_APP_TORUS_PROXY_CONTRACT=
REACT_APP_TORUS_PROVIDERS_REDIRECT_URL=
REACT_APP_TORUS_GOOGLE_CLIENT_ID=
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ jobs:
FA_NPM_TOKEN: ${{secrets.FA_NPM_TOKEN}}
TERMINAL_NPM_TOKEN: ${{secrets.TERMINAL_NPM_TOKEN}}
SPACE_SERVICES_URL: ${{secrets.SPACE_SERVICES_URL}}
REACT_APP_FE_NODE_ENV: ${{secrets.REACT_APP_FE_NODE_ENV}}
REACT_APP_TORUS_NETWORK: ${{secrets.REACT_APP_TORUS_NETWORK}}
REACT_APP_TORUS_PROXY_CONTRACT: ${{secrets.REACT_APP_TORUS_PROXY_CONTRACT}}
REACT_APP_TORUS_GOOGLE_VERIFIER: ${{secrets.REACT_APP_TORUS_GOOGLE_VERIFIER}}
REACT_APP_WS_AUTH_CHALLENGE_URL: ${{secrets.REACT_APP_WS_AUTH_CHALLENGE_URL}}
REACT_APP_TORUS_TWITTER_VERIFIER: ${{secrets.REACT_APP_TORUS_TWITTER_VERIFIER}}
REACT_APP_TORUS_GOOGLE_CLIENT_ID: ${{secrets.REACT_APP_TORUS_GOOGLE_CLIENT_ID}}
REACT_APP_TORUS_TWITTER_CLIENT_ID: ${{secrets.REACT_APP_TORUS_TWITTER_CLIENT_ID}}
REACT_APP_TORUS_TWITTER_AUTH_DOMAIN: ${{secrets.REACT_APP_TORUS_TWITTER_AUTH_DOMAIN}}
REACT_APP_TORUS_PROVIDERS_REDIRECT_URL: ${{secrets.REACT_APP_TORUS_PROVIDERS_REDIRECT_URL}}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -42,8 +50,8 @@ jobs:
if: matrix.os == 'macos-latest'
run: yarn electron-pack --mac
- name: Windows app pack and release
# env:
# CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
# CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
# env:
# CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
# CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
if: matrix.os == 'windows-latest'
run: yarn electron-pack --win --x64 --ia32
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Test Action Status](https://github.com/FleekHQ/desktop-storage/workflows/Test/badge.svg)
![Build-Pack-Release Action Status](https://github.com/FleekHQ/desktop-storage/workflows/Build-Pack-Release/badge.svg)
![Test Action Status](https://github.com/FleekHQ/space-desktop/workflows/Test/badge.svg)
![Build-Pack-Release Action Status](https://github.com/FleekHQ/space-desktop/workflows/Build-Pack-Release/badge.svg)

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

Expand Down Expand Up @@ -60,6 +60,9 @@ Also, if the daemon requires additional env variables, you need to pass those en

You can also download the latest version of the daemon directly into the resource folder (same way as CI does). To do that you can run `yarn download-daemon`

### .env File
Take a look at the `.env.example` file to set the necessary environment variables with its right values when you run the project locally.

## Build app locally
The default behavior of the build process it's to try to sign the application. If you are not exporting the ENV variables required to sign the application, the build process is going to fail. If you want to skip the signing process in order to be able to run the build process locally you can pass the `CSC_IDENTITY_AUTO_DISCOVERY=false` env variable, so the sign step is going to be ignored

Expand All @@ -84,4 +87,4 @@ For the release process, will be just necessary to create and merge a PR from `d
**Note 2**: By running `npm version <patch|minor|major>`, the tag is automatically created with `v`, it just required to be pushed. Ex, `git push origin --tags `.
* Create a draft release selecting the tag version previously pushed.

After doing those actions, we are ready to create the PR to make the app release. When the release PR (`develop` to `master`) is merged, the CI process will be in charge of generating the installer for each OS (mac, linux, and windows) and links to the installers will be available on the [repository releases page](https://github.com/FleekHQ/desktop-storage/releases) based on the app version.
After doing those actions, we are ready to create the PR to make the app release. When the release PR (`develop` to `master`) is merged, the CI process will be in charge of generating the installer for each OS (mac, linux, and windows) and links to the installers will be available on the [repository releases page](https://github.com/FleekHQ/space-desktop/releases) based on the app version.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"homepage": "./",
"repository": {
"type": "git",
"url": "https://github.com/FleekHQ/desktop-storage.git"
"url": "https://github.com/FleekHQ/space-desktop.git"
},
"scripts": {
"start": "node scripts/start.js",
Expand Down Expand Up @@ -167,9 +167,8 @@
},
"publish": {
"provider": "github",
"repo": "desktop-storage",
"owner": "FleekHQ",
"private": true
"repo": "space-desktop",
"owner": "FleekHQ"
},
"files": [
"build/**/*",
Expand Down Expand Up @@ -207,7 +206,7 @@
"icon": "build/icon.png",
"iconSize": 70,
"contents": [
{ "x": 129, "y": 217, "type": "file", "path": "Space.app" },
{ "x": 129, "y": 217, "type": "file" },
{ "x": 481, "y": 217, "type": "link", "path": "/Applications" }
]
}
Expand Down
7 changes: 6 additions & 1 deletion public/electron/clients/api/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const ApiClient = require('./client');

// process.env.SPACE_SERVICES_URL is specially for local development
const baseURL = process.env.SPACE_SERVICES_URL || 'https://api.space.storage';
// eslint-disable-next-line no-console
console.log(`Init ApiClient, URL: ${baseURL}`);

const apiClient = new ApiClient({
baseURL,
timeout: 5000,
baseURL: process.env.SPACE_SERVICES_URL || 'https://api-dev.space.storage',
});

module.exports = apiClient;
22 changes: 14 additions & 8 deletions scripts/download-daemon.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
const fs = require('fs-extra');
const path = require('path');
const axios = require('axios');
Expand All @@ -24,16 +25,13 @@ async function getDaemon() {
responseType: 'stream',
url: daemonURL,
}).catch((error) => {
// eslint-disable-next-line no-console
console.error(`\nError when trying to download the daemon binary from: ${daemonURL}`);
// eslint-disable-next-line no-console
console.error(`Error : ${error.stack || error.message}`);
process.exit(1);
});

const totalLength = headers['content-length'];

// eslint-disable-next-line no-console
console.log(`Downloading space daemon binary from ${daemonURL}:`);
const progressBar = new ProgressBar(`File: ${headers['content-disposition'].split(';')[1].trim()} [:bar] :percent :etas`, {
width: 40,
Expand All @@ -55,21 +53,29 @@ async function getDaemon() {
data.destroy();
writer.destroy();

// eslint-disable-next-line no-console
console.error(`\nError when downloading the space daemon binary: ${error.stack || error.message}`);
process.exit(1);
});

writer.on('finish', () => {
// eslint-disable-next-line no-console
console.log('Space daemon was download successfully!');
writer.on('finish', async () => {
let tag = '';
let name = '';
try {
const { data: spaceDaemonReleaseInfo } = await axios.get('https://api.github.com/repos/FleekHQ/space-daemon/releases/latest');
name = spaceDaemonReleaseInfo.name;
tag = spaceDaemonReleaseInfo.tag_name;
} catch (error) {
console.error(`Could not get space daemon name and tag info: ${error.message}`);
}
console.log('Space daemon was download successfully:');
console.log(`\t•Tag: ${tag}`);
console.log(`\t•Name: ${name}`);
process.exit(0);
});

writer.on('error', (error) => {
writer.destroy();

// eslint-disable-next-line no-console
console.error(`\nError when saving the space daemon binary: ${error.stack || error.message}`);
process.exit(1);
});
Expand Down
100 changes: 37 additions & 63 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,46 @@
const { REACT_APP_FE_NODE_ENV } = process.env;
const {
NODE_ENV,
REACT_APP_TORUS_NETWORK,
REACT_APP_TORUS_GOOGLE_VERIFIER,
REACT_APP_TORUS_TWITTER_VERIFIER,
REACT_APP_TORUS_TWITTER_CLIENT_ID,
REACT_APP_TORUS_TWITTER_AUTH_DOMAIN,
REACT_APP_TORUS_PROXY_CONTRACT,
REACT_APP_TORUS_PROVIDERS_REDIRECT_URL,
REACT_APP_WS_AUTH_CHALLENGE_URL,
REACT_APP_TORUS_GOOGLE_CLIENT_ID,
} = process.env;

const config = {
development: {
ws: {
url: 'wss://gqo1oqz055.execute-api.us-west-2.amazonaws.com/dev',
},
torus: {
sdkConfig: {
enableLogging: true,
redirectToOpener: true,
redirectPathName: 'redirect.html',
baseUrl: 'https://floral-mountain-2401.on.fleek.co/',
proxyContractAddress: '0x4023d2a0D330bF11426B12C6144Cfb96B7fa6183', // details for test net
network: 'testnet', // details for test net
},
providers: {
google: {
name: 'Google',
typeOfLogin: 'google',
clientId: '480855465278-s0lcvq0m4hpn5hokhgs8s1ujfe3lbk4f.apps.googleusercontent.com',
verifier: 'space-google-testnet',
jwtParams: {},
},
twitter: {
name: 'Twitter',
typeOfLogin: 'twitter',
clientId: 'jMfyGURX9wbS3GpusgLOZkvOn0AvIaJj',
verifier: 'fleek-auth0-twitter',
jwtParams: {
domain: 'https://space-twitter.us.auth0.com',
},
},
},
},
export default {
ws: {
url: REACT_APP_WS_AUTH_CHALLENGE_URL,
},
production: {
ws: {
url: 'wss://auth.space.storage',
torus: {
sdkConfig: {
enableLogging: NODE_ENV !== 'production',
redirectToOpener: true,
redirectPathName: 'redirect.html',
baseUrl: REACT_APP_TORUS_PROVIDERS_REDIRECT_URL,
proxyContractAddress: REACT_APP_TORUS_PROXY_CONTRACT, // details for test net
network: REACT_APP_TORUS_NETWORK, // details for test net
},
torus: {
sdkConfig: {
enableLogging: false,
redirectToOpener: true,
redirectPathName: 'redirect.html',
baseUrl: 'https://floral-mountain-2401.on.fleek.co/',
proxyContractAddress: '0x4023d2a0D330bF11426B12C6144Cfb96B7fa6183', // details for test net
network: 'testnet', // details for test net
providers: {
google: {
name: 'Google',
typeOfLogin: 'google',
jwtParams: {},
verifier: REACT_APP_TORUS_GOOGLE_VERIFIER,
clientId: REACT_APP_TORUS_GOOGLE_CLIENT_ID,
},
providers: {
google: {
name: 'Google',
typeOfLogin: 'google',
clientId: '480855465278-s0lcvq0m4hpn5hokhgs8s1ujfe3lbk4f.apps.googleusercontent.com',
verifier: 'space-google-testnet',
jwtParams: {},
},
twitter: {
name: 'Twitter',
typeOfLogin: 'twitter',
clientId: 'jMfyGURX9wbS3GpusgLOZkvOn0AvIaJj',
verifier: 'fleek-auth0-twitter',
jwtParams: {
domain: 'https://space-twitter.us.auth0.com',
},
twitter: {
name: 'Twitter',
typeOfLogin: 'twitter',
verifier: REACT_APP_TORUS_TWITTER_VERIFIER,
clientId: REACT_APP_TORUS_TWITTER_CLIENT_ID,
jwtParams: {
domain: REACT_APP_TORUS_TWITTER_AUTH_DOMAIN,
},
},
},
},
};

export default config[REACT_APP_FE_NODE_ENV] || config.development;

0 comments on commit 9df7cf0

Please sign in to comment.