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.28.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Apr 10, 2018
2 parents 2bc97b2 + ed0e755 commit 4621f74
Show file tree
Hide file tree
Showing 47 changed files with 427 additions and 647 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.*/node_modules/config-chain/*
.*/node_modules/npmconf/*
.*/node_modules/immutable/*
.*/blockstack.js/node_modules/*
.*/blockstack.js/src/*
.*/tmp/nexe/*

[include]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Following these guidelines helps to communicate that you respect the time of eve

## Using the issue tracker

The [issue tracker](/issues) is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following
The [issue tracker](https://github.com/blockstack/blockstack-browser/issues) is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following
restrictions:

* Please **do not** use the issue tracker for personal support requests. Please use the [Forum](https://forum.blockstack.org) or [Slack](https://chat.blockstack.org) as they are better places to get help.
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get update && apt-get install -y nodejs

# Install cors-proxy
RUN npm install -g corsproxy-https
RUN npm install -g cors-anywhere
RUN echo '#!/bin/bash' >> /usr/bin/corsproxy
RUN echo 'node /src/blockstack-browser/corsproxy/corsproxy.js 0 0 0.0.0.0' >> /usr/bin/corsproxy
RUN chmod +x /usr/bin/corsproxy

# Alias the cors-proxy
RUN ln /usr/bin/corsproxy /usr/bin/blockstack-cors-proxy
Expand Down
Binary file added app/images/app-icon-diffuse-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/app-icon-diffuse-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/images/app-icon-isotach-1024x1024.png
Binary file not shown.
Binary file removed app/images/app-icon-isotach-256x256.png
Binary file not shown.
20 changes: 8 additions & 12 deletions app/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { IdentityActions } from './profiles/store/identity'
import { SettingsActions } from './account/store/settings'
import { AppsActions } from './store/apps'
import WelcomeModal from './welcome/WelcomeModal'
import { getCoreAPIPasswordFromURL, getLogServerPortFromURL,
getRegTestModeFromURL } from './utils/api-utils'
import { getCoreAPIPasswordFromURL, getLogServerPortFromURL, setOrUnsetUrlsToRegTest,
getRegTestModeFromURL } from './utils/api-utils'
import SupportButton from './components/SupportButton'
import { SanityActions } from './store/sanity'
import { CURRENT_VERSION } from './store/reducers'
Expand Down Expand Up @@ -114,7 +114,7 @@ class App extends Component {
if (coreAPIPassword !== null) {
api = Object.assign({}, api, { coreAPIPassword })
this.props.updateApi(api)
} else if (isCoreEndpointDisabled()) {
} else if (isCoreEndpointDisabled(api.corePingUrl)) {
logger.debug('Core-less build. Pretending to have a valid core connection.')
api = Object.assign({}, api, { coreAPIPassword: 'PretendPasswordAPI' })
this.props.updateApi(api)
Expand All @@ -125,8 +125,9 @@ class App extends Component {
this.props.updateApi(api)
}

if (regTestMode !== null) {
api = Object.assign({}, api, { regTestMode })
if (regTestMode !== null && regTestMode !== api.regTestMode) {
logger.info('Regtest mode activating.')
api = setOrUnsetUrlsToRegTest(api, regTestMode)
this.props.updateApi(api)
}

Expand All @@ -142,17 +143,13 @@ class App extends Component {
this.performSanityChecks()
}

if (this.props.coreApiRunning) {
logger.debug('Sanity check: Core API endpoint is running!')
} else {
if (!this.props.coreApiRunning) {
// TODO connect to future notification system here
// alert('Sanity check: Error! Core API is NOT running!')
logger.error('Sanity check: Error! Core API is NOT running!')
}

if (this.props.coreApiPasswordValid) {
logger.debug('Sanity check: Core API password is valid!')
} else {
if (!this.props.coreApiPasswordValid) {
logger.error('Sanity check: Error! Core API password is wrong!')
}
this.setState({
Expand All @@ -172,7 +169,6 @@ class App extends Component {
}

performSanityChecks() {
logger.trace('performSanityChecks')
this.props.isCoreRunning(this.props.corePingUrl)
this.props.isCoreApiPasswordValid(this.props.walletPaymentAddressUrl,
this.props.coreAPIPassword)
Expand Down
13 changes: 10 additions & 3 deletions app/js/UpdateStatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import InputGroup from './components/InputGroup'
import { AccountActions } from './account/store/account'
import { IdentityActions } from './profiles/store/identity'
import { decrypt } from './utils'
import { CURRENT_VERSION, updateState } from './store/reducers'
import { CURRENT_VERSION, updateState, migrateAPIEndpoints } from './store/reducers'
import { BLOCKSTACK_STATE_VERSION_KEY } from './App'
import { isWebAppBuild } from './utils/window-utils'
import { hasLegacyCoreStateVersion, migrateLegacyCoreEndpoints } from './utils/api-utils'
import log4js from 'log4js'

const logger = log4js.getLogger('UpdateStatePage.js')
Expand All @@ -28,7 +29,7 @@ function mapStateToProps(state) {

function mapDispatchToProps(dispatch) {
return bindActionCreators(Object.assign({},
AccountActions, IdentityActions, { updateState }), dispatch)
AccountActions, IdentityActions, { updateState, migrateAPIEndpoints }), dispatch)
}

class UpdateStatePage extends Component {
Expand All @@ -43,7 +44,8 @@ class UpdateStatePage extends Component {
identityAddresses: PropTypes.array,
createNewIdentityWithOwnerAddress: PropTypes.func.isRequired,
setDefaultIdentity: PropTypes.func.isRequired,
updateState: PropTypes.func.isRequired
updateState: PropTypes.func.isRequired,
migrateAPIEndpoints: PropTypes.func.isRequired
}

constructor(props) {
Expand Down Expand Up @@ -137,6 +139,11 @@ class UpdateStatePage extends Component {
defaultIdentity: this.props.defaultIdentity,
numberOfIdentities
})
if (hasLegacyCoreStateVersion()) {
const migratedApi = migrateLegacyCoreEndpoints(this.props.api)
this.props.migrateAPIEndpoints(migratedApi)
}

this.props.updateState()
})
.catch((error) => {
Expand Down
45 changes: 40 additions & 5 deletions app/js/account/store/account/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
getInsightUrl
} from '../../../utils'
import { isCoreEndpointDisabled } from '../../../utils/window-utils'
import { transactions, config, network } from 'blockstack'

import roundTo from 'round-to'
import * as types from './types'
import log4js from 'log4js'
Expand Down Expand Up @@ -204,7 +206,7 @@ function storageIsConnected() {

function refreshCoreWalletBalance(addressBalanceUrl, coreAPIPassword) {
return dispatch => {
if (isCoreEndpointDisabled()) {
if (isCoreEndpointDisabled(addressBalanceUrl)) {
logger.debug('Mocking core wallet balance in webapp build')
dispatch(updateCoreWalletBalance(0))
return
Expand All @@ -229,9 +231,8 @@ function refreshCoreWalletBalance(addressBalanceUrl, coreAPIPassword) {

function getCoreWalletAddress(walletPaymentAddressUrl, coreAPIPassword) {
return dispatch => {
if (isCoreEndpointDisabled()) {
logger.debug('Mocking core wallet address in webapp build')
dispatch(updateCoreWalletAddress('Not supported in simple webapp.'))
if (isCoreEndpointDisabled(walletPaymentAddressUrl)) {
logger.error('Cannot use core wallet if core is disable')
return
}

Expand All @@ -255,6 +256,39 @@ function resetCoreWithdrawal() {
}
}

function withdrawBitcoinClientSide(
regTestMode,
paymentKey,
recipientAddress,
amountBTC
) {
return dispatch => {
if (regTestMode) {
logger.trace('Using regtest network')
config.network = network.defaults.LOCAL_REGTEST
// browser regtest environment uses 6270
config.network.blockstackAPIUrl = 'http://localhost:6270'
recipientAddress = config.network.coerceAddress(recipientAddress)
}
dispatch(withdrawingCoreBalance(recipientAddress, amountBTC))

const amountSatoshis = Math.floor(amountBTC * 1e8)

transactions.makeBitcoinSpend(
recipientAddress, paymentKey, amountSatoshis)
.then((transactionHex) => {
const myNet = config.network
logger.trace(`Broadcast btc spend with tx hex: ${transactionHex}`)
return myNet.broadcastTransaction(transactionHex)
})
.then(() => dispatch(withdrawCoreBalanceSuccess()))
.catch((error) => {
logger.error('withdrawBitcoinClientSide: error generating and broadcasting', error)
return dispatch(withdrawCoreBalanceError(error))
})
}
}

function withdrawBitcoinFromCoreWallet(
coreWalletWithdrawUrl,
recipientAddress,
Expand All @@ -263,7 +297,7 @@ function withdrawBitcoinFromCoreWallet(
paymentKey = null
) {
return dispatch => {
if (isCoreEndpointDisabled()) {
if (isCoreEndpointDisabled(coreWalletWithdrawUrl)) {
dispatch(
withdrawCoreBalanceError(
'Core wallet withdrawls not allowed in the simple webapp build'
Expand Down Expand Up @@ -440,6 +474,7 @@ const AccountActions = {
getCoreWalletAddress,
refreshCoreWalletBalance,
resetCoreWithdrawal,
withdrawBitcoinClientSide,
withdrawBitcoinFromCoreWallet,
emailNotifications,
skipEmailBackup,
Expand Down
2 changes: 1 addition & 1 deletion app/js/account/store/settings/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function resetApi(api) {
}

if (coreAPIPassword === undefined) {
coreAPIPassword = null
coreAPIPassword = DEFAULT_API.coreAPIPassword
}
return dispatch => {
dispatch(
Expand Down
12 changes: 5 additions & 7 deletions app/js/account/store/settings/default.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { BLOCKSTACK_INC } from '../../../account/utils/index'
import { isCoreEndpointDisabled } from '../../../utils/window-utils'

export const REGTEST_CORE_API_PASSWORD = 'blockstack_integration_test_api_password'
export const DEFAULT_CORE_PHONY_PASSWORD = 'PretendPasswordAPI'
export const REGTEST_CORE_INSIGHT_API_URL = 'http://localhost:6270/insight-api/addr/{address}'

// DEFAULT_API values are only used if
// the user's settings.api state doesn't
// already have an existing key.
// To change a value, use a new key.

let DEFAULT_CORE_API_ENDPOINT = 'http://localhost:6270'
if (isCoreEndpointDisabled()) {
DEFAULT_CORE_API_ENDPOINT = 'https://core.blockstack.org'
}
export const DEFAULT_CORE_API_ENDPOINT = 'https://core.blockstack.org'
export const REGTEST_CORE_API_ENDPOINT = 'http://localhost:6270'

const DEFAULT_API = {
apiCustomizationEnabled: true,
Expand All @@ -31,7 +29,7 @@ const DEFAULT_API = {
bitcoinAddressUrl: 'https://explorer.blockstack.org/address/{identifier}',
ethereumAddressUrl: 'https://tradeblock.com/ethereum/account/{identifier}',
pgpKeyUrl: 'https://pgp.mit.edu/pks/lookup?search={identifier}&op=vindex&fingerprint=on',
btcPriceUrl: 'https://www.bitstamp.net/api/v2/ticker/btcusd/',
btcPriceUrl: 'https://www.bitstamp.net/api/v2/ticker/btcusd/?cors=1',
corePingUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/node/ping`,
zoneFileUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/names/{name}/zonefile`,
nameTransferUrl: `${DEFAULT_CORE_API_ENDPOINT}/v1/names/{name}/owner`,
Expand All @@ -44,7 +42,7 @@ const DEFAULT_API = {
hostedDataLocation: BLOCKSTACK_INC,
coreHost: 'localhost',
corePort: 6270,
coreAPIPassword: null,
coreAPIPassword: DEFAULT_CORE_PHONY_PASSWORD,
logServerPort: '',
regTestMode: false,
storageConnected: false,
Expand Down
Loading

0 comments on commit 4621f74

Please sign in to comment.