Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.35.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Feb 12, 2019
2 parents 5953c70 + da32d57 commit 6805a07
Show file tree
Hide file tree
Showing 26 changed files with 4,392 additions and 4,663 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Expand Up @@ -36,3 +36,15 @@ tmp
.idea
.swp
yarn.lock
native/windows/.vs/
native/windows/BlockstackBrowser/bin/
native/windows/BlockstackBrowser/obj/
native/windows/ProtocolHandler/bin/
native/windows/ProtocolHandler/obj/
native/windows/BlockstackBrowser/Resources/node.exe
native/windows/BlockstackBrowser/Resources/cors-proxy/corsproxy.js
native/windows/BlockstackSetup/obj/
native/windows/BlockstackSetup/bin/
native/macos/Blockstack/Blockstack/server/corsproxy.js
native/macos/Blockstack/Blockstack/server/blockstackProxy.js
native/macos/Blockstack/Blockstack/server/node
33 changes: 24 additions & 9 deletions README.md
Expand Up @@ -7,6 +7,7 @@ The Blockstack Browser allows you to explore the Blockstack internet.
- [Releases](#releases)
- [Developing](#developing)
- [Building for macOS](#building-for-macos)
- [Building for Windows](#building-for-windows)
- [Building for the Web](#building-for-the-web)
- [Contributing](#contributing)
- [Logging](#logging)
Expand Down Expand Up @@ -59,21 +60,17 @@ reload the page. For example, if your `auth=` query looks like

## Building for macOS

1. Make sure you have a working installation of Xcode 9 or higher & valid Mac Developer signing certificate
1. Make sure you have an OpenSSL ready for bottling by homebrew by running `brew install openssl --build-bottle`
1. Make sure you have `hg` installed by running `brew install hg`
1. Run `npm install nexe -g` to install the "node to native" binary tool globally
1. Open the Blockstack macOS project in Xcode and configure your code signing development team (You only need to do this once)
1. Run `npm run mac` to build a debug release signed with your Mac Developer certificate

*Note: You only need to run `nexe` once but the first build will take a while as `nexe` downloads and compiles a source copy of node. Then it creates and copies the needed proxy binaries into place and copies a built version of the browser web app into the source tree.*
1. Make sure you have a working installation of Xcode >=9 and Node.js >=10.
1. Run `npm run mac:release:dev` to build an unsigned application bundle.
1. The output bundle is located at `native/macos/export/Blockstack.app`.

*Note: This has only been tested on macOS High Sierra 10.13*

### Building a macOS release for distribution

1. Ensure you have valid Developer ID signing credentials in your Keychain. (See https://developer.apple.com/developer-id/ for more information)
1. Follow the instructions in the above section for building for macOS.
1. Open the Blockstack macOS project in Xcode and configure your code signing development team (You only need to do this once)
1. Make sure you have an OpenSSL ready for bottling by homebrew by running `brew install openssl --build-bottle`
1. Open the Blockstack macOS project in Xcode.
1. Select the Product menu and click Archive.
1. When the archive build completes, the Organizer window will open. Select your new build.
Expand All @@ -83,6 +80,24 @@ reload the page. For example, if your `auth=` query looks like
1. Click "Export" and select the location to which you would like to save the signed build.


## Building for Windows

Prerequisites:
* Wix Toolset v3.11.1 (download and run wix311.exe from https://github.com/wixtoolset/wix3/releases/tag/wix3111rtm)
* Visual Studio 2017 (https://visualstudio.microsoft.com/downloads/)

Run `npm run win32`.

This will:
* Run the webpack build.
* Setup the resources used by msbuild and the WiX msi project.
* Run msbuild to compile the native app and create the msi installation file.

The output file can be found at `native\windows\BlockstackSetup\bin\Release\en-us\BlockstackSetup.msi`.

This does not perform any code or installer file signing.


## Building for the Web

1. Make sure you've cloned the repo and installed all npm assets (as shown above)
Expand Down
1 change: 0 additions & 1 deletion app/js/App.js
Expand Up @@ -12,7 +12,6 @@ import {
setOrUnsetUrlsToRegTest,
getRegTestModeFromURL
} from './utils/api-utils'
import SupportButton from './components/SupportButton'
import { SanityActions } from './store/sanity'
import { CURRENT_VERSION } from './store/reducers'
import { isCoreEndpointDisabled } from './utils/window-utils'
Expand Down
2 changes: 2 additions & 0 deletions app/js/account/StorageProvidersPage.js
Expand Up @@ -159,6 +159,8 @@ class StorageProvidersPage extends Component {
<a
href="https://github.com/blockstack/gaia/tree/master/hub"
className="btn btn-primary btn-storage btn-lg btn-block"
target="_blank"
rel="noopener noreferrer"
>
Run your own Gaia storage hub
</a>
Expand Down
51 changes: 47 additions & 4 deletions app/js/auth/index.js
Expand Up @@ -5,14 +5,17 @@ import { Initial, LegacyGaia } from './views'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { AuthActions } from './store/auth'
import { IdentityActions } from '../profiles/store/identity'
import { decodeToken } from 'jsontokens'
import { parseZoneFile } from 'zone-file'
import queryString from 'query-string'
import {
makeAuthResponse,
getAuthRequestFromURL,
redirectUserToApp,
getAppBucketUrl,
isLaterVersion
isLaterVersion,
updateQueryStringParameter
} from 'blockstack'
import { AppsNode } from '@utils/account-utils'
import {
Expand Down Expand Up @@ -79,7 +82,7 @@ function mapStateToProps(state) {
}

function mapDispatchToProps(dispatch) {
const actions = Object.assign({}, AuthActions)
const actions = Object.assign({}, AuthActions, IdentityActions)
return bindActionCreators(actions, dispatch)
}

Expand All @@ -106,7 +109,8 @@ class AuthPage extends React.Component {
email: PropTypes.string,
noCoreSessionToken: PropTypes.func.isRequired,
addresses: PropTypes.array.isRequired,
publicKeychain: PropTypes.string.isRequired
publicKeychain: PropTypes.string.isRequired,
refreshIdentities: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -115,11 +119,13 @@ class AuthPage extends React.Component {
this.state = {
currentIdentityIndex: this.props.defaultIdentity,
authRequest: null,
echoRequestId: null,
appManifest: null,
coreSessionToken: null,
decodedToken: null,
storageConnected: this.props.api.storageConnected,
processing: false,
refreshingIdentities: true,
invalidScopes: false,
sendEmail: false,
blockchainId: null,
Expand All @@ -137,12 +143,16 @@ class AuthPage extends React.Component {
}

componentWillMount() {
const queryDict = queryString.parse(location.search)
const echoRequestId = queryDict.echo

const authRequest = getAuthRequestFromURL()
const decodedToken = decodeToken(authRequest)
const { scopes } = decodedToken.payload

this.setState({
authRequest,
echoRequestId,
decodedToken,
scopes: {
...this.state.scopes,
Expand All @@ -152,10 +162,34 @@ class AuthPage extends React.Component {
})

this.props.verifyAuthRequestAndLoadManifest(authRequest)

this.getFreshIdentities()
}

redirectUserToEchoReply() {
let redirectURI = this.state.decodedToken.payload.redirect_uri
if (redirectURI) {
// Get the current localhost authentication url that the app will redirect back to,
// and remove the 'echo' param from it.
const authContinuationURI = updateQueryStringParameter(window.location.href, 'echo', '')
redirectURI = updateQueryStringParameter(redirectURI, 'echoReply', this.state.echoRequestId)
redirectURI = updateQueryStringParameter(redirectURI, 'authContinuation', encodeURIComponent(authContinuationURI))
} else {
throw new Error('Invalid redirect echo reply URI')
}
this.setState({ responseSent: true })
window.location = redirectURI
}

componentWillReceiveProps(nextProps) {

if (!this.state.responseSent) {

if (this.state.echoRequestId) {
this.redirectUserToEchoReply()
return
}

const storageConnected = this.props.api.storageConnected
this.setState({
storageConnected
Expand Down Expand Up @@ -230,7 +264,7 @@ class AuthPage extends React.Component {

const gaiaBucketAddress = nextProps.identityKeypairs[0].address
const identityAddress = nextProps.identityKeypairs[identityIndex].address
const gaiaUrlBase = 'https://gaia.blockstack.org/hub'
const gaiaUrlBase = nextProps.api.gaiaHubConfig.url_prefix

if (!profileUrlPromise) {
profileUrlPromise = fetchProfileLocations(
Expand Down Expand Up @@ -323,6 +357,14 @@ class AuthPage extends React.Component {
}
}

getFreshIdentities = async () => {
await this.props.refreshIdentities(
this.props.api,
this.props.addresses
)
this.setState({ refreshingIdentities: false })
}

completeAuthResponse = (
privateKey,
blockchainId,
Expand Down Expand Up @@ -556,6 +598,7 @@ class AuthPage extends React.Component {
deny: () => console.log('go back to app'),
accounts: this.props.localIdentities,
processing: this.state.processing,
refreshingIdentities: this.state.refreshingIdentities,
selectedIndex: this.state.currentIdentityIndex,
disableBackOnView: 0
}
Expand Down
22 changes: 16 additions & 6 deletions app/js/auth/views/initial.js
Expand Up @@ -6,7 +6,13 @@ const basicInfo = 'read your basic info'
const readEmail = 'read your email address'
const publishData = 'publish data stored for this app'

const Accounts = ({ list, handleClick, processing, selectedIndex }) => {
const Accounts = ({ list, handleClick, processing, refreshingIdentities, selectedIndex }) => {
let loadingMessage = null
if (processing) {
loadingMessage = 'Signing in...'
} else if (refreshingIdentities) {
loadingMessage = 'Loading...'
}
if (list.length) {
return list.map(({ username, ownerAddress, profile, ...account }, i) => {
const person = new Person(profile)
Expand All @@ -17,9 +23,9 @@ const Accounts = ({ list, handleClick, processing, selectedIndex }) => {
id={ownerAddress}
avatarUrl={person.avatarUrl()}
onClick={() => handleClick(i)}
loading={processing && i === selectedIndex}
disabled={processing}
placeholder="Signing in..."
loading={refreshingIdentities || (processing && i === selectedIndex)}
disabled={refreshingIdentities || processing}
placeholder={loadingMessage}
style={{ transform: 'translate3d(0,0,0)' }}
hideID
/>
Expand Down Expand Up @@ -75,6 +81,7 @@ const InitialScreen = ({
processing,
selectedIndex,
login,
refreshingIdentities,
...rest
}) => {
const generatePermissionsList = () => {
Expand Down Expand Up @@ -108,6 +115,7 @@ const InitialScreen = ({
list={accounts}
handleClick={login}
processing={processing}
refreshingIdentities={refreshingIdentities}
selectedIndex={selectedIndex}
/>
</Buttons>
Expand All @@ -134,13 +142,15 @@ InitialScreen.propTypes = {
permissions: PropTypes.array,
processing: PropTypes.bool,
selectedIndex: PropTypes.number,
login: PropTypes.func
login: PropTypes.func,
refreshingIdentities: PropTypes.bool
}
Accounts.propTypes = {
list: PropTypes.array.isRequired,
handleClick: PropTypes.func,
processing: PropTypes.bool,
selectedIndex: PropTypes.number
selectedIndex: PropTypes.number,
refreshingIdentities: PropTypes.bool
}

PermissionsList.propTypes = {
Expand Down
5 changes: 4 additions & 1 deletion app/js/components/ui/containers/shell-parent.js
Expand Up @@ -87,7 +87,10 @@ class ShellParent extends React.Component {

const internalBackLabel = backLabel !== '' ? backLabel : 'Back'
const defaultBackLabel = isFirstView ? backLabel : internalBackLabel
const label = isFirstView && app ? `Back to ${app.name}` : defaultBackLabel
const label =
backLabel === '' && isFirstView && app
? ``
: defaultBackLabel

const Component = views[view]

Expand Down

0 comments on commit 6805a07

Please sign in to comment.