diff --git a/app/images/app-icon-amgiving-256x256.png b/app/images/app-icon-amgiving-256x256.png new file mode 100644 index 000000000..618848622 Binary files /dev/null and b/app/images/app-icon-amgiving-256x256.png differ diff --git a/app/images/app-icon-amgiving-512x512.png b/app/images/app-icon-amgiving-512x512.png new file mode 100644 index 000000000..685833dd4 Binary files /dev/null and b/app/images/app-icon-amgiving-512x512.png differ diff --git a/app/images/app-icon-arenaplay-256x256.png b/app/images/app-icon-arenaplay-256x256.png new file mode 100644 index 000000000..f96209f78 Binary files /dev/null and b/app/images/app-icon-arenaplay-256x256.png differ diff --git a/app/images/app-icon-arenaplay-512x512.png b/app/images/app-icon-arenaplay-512x512.png new file mode 100644 index 000000000..b697f7364 Binary files /dev/null and b/app/images/app-icon-arenaplay-512x512.png differ diff --git a/app/images/app-icon-eder-256x256.png b/app/images/app-icon-eder-256x256.png new file mode 100644 index 000000000..87fbeda62 Binary files /dev/null and b/app/images/app-icon-eder-256x256.png differ diff --git a/app/images/app-icon-eder-512x512.png b/app/images/app-icon-eder-512x512.png new file mode 100644 index 000000000..0fd010735 Binary files /dev/null and b/app/images/app-icon-eder-512x512.png differ diff --git a/app/images/app-icon-portfolio-bounty-256x256.png b/app/images/app-icon-portfolio-bounty-256x256.png new file mode 100644 index 000000000..0be4da812 Binary files /dev/null and b/app/images/app-icon-portfolio-bounty-256x256.png differ diff --git a/app/images/app-icon-portfolio-bounty-512x512.png b/app/images/app-icon-portfolio-bounty-512x512.png new file mode 100644 index 000000000..a3b0f2aec Binary files /dev/null and b/app/images/app-icon-portfolio-bounty-512x512.png differ diff --git a/app/images/app-icon-postly-256x256.png b/app/images/app-icon-postly-256x256.png new file mode 100644 index 000000000..666f97455 Binary files /dev/null and b/app/images/app-icon-postly-256x256.png differ diff --git a/app/images/app-icon-postly-512x512.png b/app/images/app-icon-postly-512x512.png new file mode 100644 index 000000000..7bcdce0ea Binary files /dev/null and b/app/images/app-icon-postly-512x512.png differ diff --git a/app/images/app-icon-souq-256x256.png b/app/images/app-icon-souq-256x256.png new file mode 100644 index 000000000..8ff03cc87 Binary files /dev/null and b/app/images/app-icon-souq-256x256.png differ diff --git a/app/images/app-icon-souq-512x512.png b/app/images/app-icon-souq-512x512.png new file mode 100644 index 000000000..ec5508dfa Binary files /dev/null and b/app/images/app-icon-souq-512x512.png differ diff --git a/app/images/app-icon-symmitree-256x256.png b/app/images/app-icon-symmitree-256x256.png new file mode 100644 index 000000000..7ba4cdad8 Binary files /dev/null and b/app/images/app-icon-symmitree-256x256.png differ diff --git a/app/images/app-icon-symmitree-512x512.png b/app/images/app-icon-symmitree-512x512.png new file mode 100644 index 000000000..e5ea3bcc2 Binary files /dev/null and b/app/images/app-icon-symmitree-512x512.png differ diff --git a/app/js/App.js b/app/js/App.js index 9b875ff23..6bd49206d 100644 --- a/app/js/App.js +++ b/app/js/App.js @@ -11,6 +11,7 @@ import { getCoreAPIPasswordFromURL, getLogServerPortFromURL } from './utils/api- import SupportButton from './components/SupportButton' import { SanityActions } from './store/sanity' import { CURRENT_VERSION } from './store/reducers' +import { isCoreEndpointDisabled } from './utils/window-utils' import { openInNewTab } from './utils' import log4js from 'log4js' @@ -102,9 +103,15 @@ class App extends Component { const coreAPIPassword = getCoreAPIPasswordFromURL() const logServerPort = getLogServerPortFromURL() let api = this.props.api + + if (coreAPIPassword !== null) { api = Object.assign({}, api, { coreAPIPassword }) this.props.updateApi(api) + } else if (isCoreEndpointDisabled()) { + logger.debug('Core-less build. Pretending to have a valid core connection.') + api = Object.assign({}, api, { coreAPIPassword: 'PretendPasswordAPI' }) + this.props.updateApi(api) } if (logServerPort !== null) { diff --git a/app/js/HomeScreenPage.js b/app/js/HomeScreenPage.js index b482b2bfa..5d3efe054 100644 --- a/app/js/HomeScreenPage.js +++ b/app/js/HomeScreenPage.js @@ -4,6 +4,7 @@ import { connect } from 'react-redux' import Navbar from './components/Navbar' import { AppsActions } from './store/apps' import appList from './data/apps' +import { isWebAppBuild } from './utils/window-utils' function mapStateToProps(state) { return { @@ -38,6 +39,21 @@ const AppIcon = (props) => ( ) +const disclaimerWeb = `The Blockstack Tokens are a crypto asset that is currently being + developed by Blockstack Token LLC, a Delaware limited liability + company, whose website can be found at www.blockstack.com. The + website you are currently visiting (browser.blockstack.org) is + sponsored by Blockstack PBC, an affiliate of Blockstack Token LLC, + and should not be viewed as an offer or sale of securities.` + +const disclaimerApp = `The Blockstack Tokens are a crypto asset that is currently being + developed by Blockstack Token LLC, a Delaware limited liability + company, whose website can be found at www.blockstack.com. The + application you are currently using (The Blockstack Browser) is + sponsored by Blockstack PBC, an affiliate of Blockstack Token LLC, + and should not be viewed as an offer or sale of securities.` + + AppIcon.propTypes = { launchLink: PropTypes.string.isRequired, iconImage: PropTypes.string.isRequired, @@ -121,6 +137,12 @@ class HomeScreenPage extends Component { +
+

+ {isWebAppBuild() ? disclaimerWeb : disclaimerApp} +

+
+ diff --git a/app/js/UpdateStatePage.js b/app/js/UpdateStatePage.js index 3795c3437..bde535f42 100644 --- a/app/js/UpdateStatePage.js +++ b/app/js/UpdateStatePage.js @@ -9,6 +9,7 @@ import { IdentityActions } from './profiles/store/identity' import { decrypt } from './utils' import { CURRENT_VERSION, updateState } from './store/reducers' import { BLOCKSTACK_STATE_VERSION_KEY } from './App' +import { isWebAppBuild } from './utils/window-utils' import log4js from 'log4js' const logger = log4js.getLogger('UpdateStatePage.js') @@ -146,6 +147,7 @@ class UpdateStatePage extends Component { render() { const alert = this.state.alert + const isWebApp = isWebAppBuild() return ( Finish updating Blockstack -

Enter your password to finish updating Blockstack.

+
+ {isWebApp ? +
+

We updated the Blockstack Browser

+

Please enter your password to complete the update process.

+
+ : +
+

Finish updating Blockstack

+

Enter your password to finish updating Blockstack.

+
+ } +
{ - logger.debug(`emailNotifications: registered ${email} for notifications`) - }, (error) => { - logger.error('emailNotifications: error', error) - }).catch(error => { - logger.error('emailNotifications: error', error) - }) - } else { - logger.debug('emailNotifications: user opted-out') - return Promise.resolve() + logger.debug('emailNotifications: user opted-in to mailing list') + url = `${emailNotificationsUrl}true` } + return fetch(url, options) + .then(() => { + logger.debug(`emailNotifications: registered ${email} for notifications`) + }, (error) => { + logger.error('emailNotifications: error', error) + }).catch(error => { + logger.error('emailNotifications: error', error) + }) } } @@ -195,6 +195,12 @@ function storageIsConnected() { function refreshCoreWalletBalance(addressBalanceUrl, coreAPIPassword) { return dispatch => { + if (isCoreEndpointDisabled()) { + logger.debug('Mocking core wallet balance in webapp build') + dispatch(updateCoreWalletBalance(0)) + return + } + logger.trace('refreshCoreWalletBalance: Beginning refresh...') logger.debug(`refreshCoreWalletBalance: addressBalanceUrl: ${addressBalanceUrl}`) const headers = { Authorization: authorizationHeaderValue(coreAPIPassword) } @@ -216,6 +222,12 @@ 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.')) + return + } + const headers = { Authorization: authorizationHeaderValue(coreAPIPassword) } fetch(walletPaymentAddressUrl, { headers }) .then((response) => response.text()) @@ -241,6 +253,13 @@ function resetCoreWithdrawal() { function withdrawBitcoinFromCoreWallet(coreWalletWithdrawUrl, recipientAddress, coreAPIPassword, amount = null, paymentKey = null) { return dispatch => { + if (isCoreEndpointDisabled()) { + dispatch(withdrawCoreBalanceError('Core wallet withdrawls not allowed in' + + ' the simple webapp build')) + return + } + + const requestBody = { address: recipientAddress, min_confs: 0 diff --git a/app/js/account/store/settings/default.js b/app/js/account/store/settings/default.js index 359947259..2999b83a5 100644 --- a/app/js/account/store/settings/default.js +++ b/app/js/account/store/settings/default.js @@ -1,4 +1,5 @@ import { DROPBOX } from '../../../account/utils/index' +import { isCoreEndpointDisabled } from '../../../utils/window-utils' export const REGTEST_CORE_API_PASSWORD = 'blockstack_integration_test_api_password' export const REGTEST_CORE_INSIGHT_API_URL = @@ -8,27 +9,33 @@ export const REGTEST_CORE_INSIGHT_API_URL = // 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' +} + const DEFAULT_API = { apiCustomizationEnabled: true, - nameLookupUrl: 'http://localhost:6270/v1/names/{name}', + nameLookupUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/names/{name}', searchServiceUrl: 'https://core.blockstack.org/v1/search?query={query}', - registerUrl: 'http://localhost:6270/v1/names', - bitcoinAddressLookupUrl: 'http://localhost:6270/v1/addresses/bitcoin/{address}', - zeroConfBalanceUrl: 'http://localhost:6270/v1/wallet/balance/0', + registerUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/names', + bitcoinAddressLookupUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/addresses/bitcoin/{address}', + zeroConfBalanceUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/wallet/balance/0', insightUrl: 'https://utxo.blockstack.org/insight-api/addr/{address}', broadcastUrl: 'https://utxo.blockstack.org/insight-api/tx/send', - priceUrl: 'http://localhost:6270/v1/prices/names/{name}', + priceUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/prices/names/{name}', networkFeeUrl: 'https://bitcoinfees.21.co/api/v1/fees/recommended', - walletPaymentAddressUrl: 'http://localhost:6270/v1/wallet/payment_address', - pendingQueuesUrl: 'http://localhost:6270/v1/blockchains/bitcoin/pending', - coreWalletWithdrawUrl: 'http://localhost:6270/v1/wallet/balance', + walletPaymentAddressUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/wallet/payment_address', + pendingQueuesUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/blockchains/bitcoin/pending', + coreWalletWithdrawUrl: DEFAULT_CORE_API_ENDPOINT + '/v1/wallet/balance', 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/', - corePingUrl: 'http://localhost:6270/v1/node/ping', - zoneFileUrl: 'http://localhost:6270/v1/names/{name}/zonefile', - nameTransferUrl: 'http://localhost:6270/v1/names/{name}/owner', + 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', subdomains: { 'foo.id': { registerUrl: 'http://localhost:7103/register' diff --git a/app/js/account/utils/blockstack-inc.js b/app/js/account/utils/blockstack-inc.js index 30bc8c735..849805e13 100644 --- a/app/js/account/utils/blockstack-inc.js +++ b/app/js/account/utils/blockstack-inc.js @@ -74,5 +74,6 @@ export function connectToGaiaHub(gaiaHubUrl: string, challengeSignerHex: string) export function redirectToConnectToGaiaHub() { logger.trace('redirectToConnectToGaiaHub') const port = location.port === '' ? 80 : location.port - window.top.location.href = `http://localhost:${port}/account/storage#gaiahub` + const host = location.hostname + window.top.location.href = `http://${host}:${port}/account/storage#gaiahub` } diff --git a/app/js/auth/components/AuthModal.js b/app/js/auth/components/AuthModal.js index b9df7f78a..ecde190ac 100644 --- a/app/js/auth/components/AuthModal.js +++ b/app/js/auth/components/AuthModal.js @@ -11,6 +11,7 @@ import { import Image from '../../components/Image' import { AppsNode } from '../../utils/account-utils' import { setCoreStorageConfig } from '../../utils/api-utils' +import { isCoreEndpointDisabled } from '../../utils/window-utils' import { getTokenFileUrlFromZoneFile } from '../../utils/zone-utils' import { HDNode } from 'bitcoinjs-lib' import { validateScopes } from '../utils' @@ -345,6 +346,40 @@ class AuthModal extends Component { const appManifestLoading = this.props.appManifestLoading const processing = this.state.processing const invalidScopes = this.state.invalidScopes + const decodedToken = this.state.decodedToken + const noStorage = (decodedToken + && decodedToken.payload.scopes + && !decodedToken.payload.scopes.includes('store_write')) + + const coreShortCircuit = (!appManifestLoading + && appManifest !== null + && !invalidScopes + && !noStorage + && isCoreEndpointDisabled()) + if (coreShortCircuit) { + return ( +
+ +

Sign In Request

+
+

+ This application requires using Gaia storage, which is not supported yet + in our webapp. Feature coming soon! +

+
+
+
+ ) + } + const requestingEmail = this.state.requestingEmail return (
diff --git a/app/js/data/apps.js b/app/js/data/apps.js index 035880dd2..b2cbdb501 100644 --- a/app/js/data/apps.js +++ b/app/js/data/apps.js @@ -118,6 +118,97 @@ const apps = { launchLink: 'https://dotpodcast.co/', developer: 'DotPodcast', status: 'in_progress' + }, { + name: 'Postly', + displayName: 'Postly', + description: 'The best way to share and discover content with friends.', + version: '1.0.0', + appIcon: { + small: 'app-icon-postly-256x256.png', + large: 'app-icon-postly-512x512.png' + }, + website: 'https://www.postly.co/blockstack', + launchLink: 'https://www.postly.co/blockstack', + developer: 'Postly', + status: 'in_progress' + }, { + name: 'Arenaplay', + displayName: 'Arenaplay', + description: 'Games where players time is valued.', + version: '1.0.0', + appIcon: { + small: 'app-icon-arenaplay-256x256.png', + large: 'app-icon-arenaplay-512x512.png' + }, + website: 'https://arenaplay.io/start', + launchLink: 'https://arenaplay.io/start', + developer: 'Arenaplay', + status: 'in_progress' + }, { + name: 'AMGiving', + displayName: 'AMGiving', + description: 'Creating transparency in charitable giving.', + version: '1.0.0', + appIcon: { + small: 'app-icon-amgiving-256x256.png', + large: 'app-icon-amgiving-512x512.png' + }, + website: 'http://amgiving.io', + launchLink: 'http://amgiving.io', + developer: 'AMGiving', + status: 'in_progress' + }, { + name: 'Symmitree', + displayName: 'Symmitree', + description: 'Providing free connectivity to the displaced and deprived.', + version: '1.0.0', + appIcon: { + small: 'app-icon-symmitree-256x256.png', + large: 'app-icon-symmitree-512x512.png' + }, + website: 'http://symmitree.com', + launchLink: 'http://symmitree.com', + developer: 'Symmitree', + status: 'in_progress' + }, { + name: 'Eder', + displayName: 'Eder', + description: 'A decentralized stash for your personal data.', + version: '1.0.0', + appIcon: { + small: 'app-icon-eder-256x256.png', + large: 'app-icon-eder-512x512.png' + }, + website: 'http://eder.io', + launchLink: 'http://eder.io', + developer: 'Eder', + status: 'in_progress' + }, { + name: 'Portfolio Bounty', + displayName: 'Portfolio Bounty', + description: 'https://tokenportfolio.eventbrite.com.', + version: '1.0.0', + appIcon: { + small: 'app-icon-portfolio-bounty-256x256.png', + large: 'app-icon-portfolio-bounty-512x512.png' + }, + website: 'https://tokenportfolio.eventbrite.com', + launchLink: 'https://tokenportfolio.eventbrite.com', + developer: 'Portfolio Bounty', + status: 'in_progress' + }, { + name: 'Souq', + displayName: 'Souq', + description: 'Project Management Platform.', + version: '1.0.0', + appIcon: { + small: 'app-icon-souq-256x256.png', + large: 'app-icon-souq-512x512.png' + }, + website: 'http://beta.cryptocracy.io', + launchLink: 'http://beta.cryptocracy.io', + developer: 'Souq', + status: 'in_progress' } ] } diff --git a/app/js/profiles/AllProfilesPage.js b/app/js/profiles/AllProfilesPage.js index a812daac2..178e300bc 100644 --- a/app/js/profiles/AllProfilesPage.js +++ b/app/js/profiles/AllProfilesPage.js @@ -9,6 +9,7 @@ import IdentityItem from './components/IdentityItem' import InputGroup from '../components/InputGroup' import { IdentityActions } from './store/identity' import { AccountActions } from '../account/store/account' +import { isCoreEndpointDisabled } from '../utils/window-utils' import log4js from 'log4js' @@ -219,6 +220,7 @@ class AllProfilesPage extends Component { canAddUsername={identity.canAddUsername} isDefault={index === this.props.defaultIdentity} router={this.props.router} + coreDisabled={isCoreEndpointDisabled()} profileUrl={`${profileUrlBase}/${index}/profile.json`} /> ) diff --git a/app/js/profiles/DefaultProfilePage.js b/app/js/profiles/DefaultProfilePage.js index 43b697263..31723f2fd 100644 --- a/app/js/profiles/DefaultProfilePage.js +++ b/app/js/profiles/DefaultProfilePage.js @@ -24,6 +24,8 @@ import { } from '../utils' import { VERIFICATION_TWEET_LINK_URL_BASE } from './components/VerificationInfo' +import { isCoreEndpointDisabled } from '../utils/window-utils' + import log4js from 'log4js' const logger = log4js.getLogger('profiles/DefaultProfilePage.js') @@ -526,6 +528,7 @@ class DefaultProfilePage extends Component { const identityIndex = this.props.defaultIdentity const identity = this.state.localIdentities[identityIndex] const person = new Person(identity.profile) + const coreDisabled = isCoreEndpointDisabled() if (identity.username) { identity.canAddUsername = false @@ -734,6 +737,14 @@ class DefaultProfilePage extends Component {
Increase your trust level by verifying your social accounts.
+ +
+
+ You cannot purchase usernames in the webapp + right now. Feature coming soon! +
+
+
{!(isMobile() && @@ -798,14 +809,26 @@ class DefaultProfilePage extends Component { />
+
{identity.canAddUsername ? - - Add a username - +
+ {coreDisabled ? + + Add a username + + : + + Add a username + + } +
:
{identity.username} diff --git a/app/js/profiles/components/IdentityItem.js b/app/js/profiles/components/IdentityItem.js index 636129e6d..40bf63189 100644 --- a/app/js/profiles/components/IdentityItem.js +++ b/app/js/profiles/components/IdentityItem.js @@ -18,6 +18,7 @@ class IdentityItem extends Component { onClick: PropTypes.func.isRequired, router: PropTypes.object.isRequired, index: PropTypes.number.isRequired, + coreDisabled: PropTypes.bool, profileUrl: PropTypes.string.isRequired } @@ -55,6 +56,14 @@ class IdentityItem extends Component {
This is your identity address.
+ +
+
+ You cannot purchase usernames in the webapp right now. + Feature coming soon! +
+
+

{this.props.canAddUsername ? - { - event.preventDefault() - event.stopPropagation() - this.props.router.push(`/profiles/i/add-username/${this.props.index}/search`) - }} - > - Add username - - : +

+ : {this.props.username} {this.props.pending ? diff --git a/app/js/profiles/store/identity/actions.js b/app/js/profiles/store/identity/actions.js index 26ab9bdfe..052860516 100644 --- a/app/js/profiles/store/identity/actions.js +++ b/app/js/profiles/store/identity/actions.js @@ -15,6 +15,7 @@ import { DEFAULT_PROFILE, getProfileFromTokens } from '../../../utils/profile-utils' import { calculateTrustLevel } from '../../../utils/account-utils' import { AccountActions } from '../../../account/store/account' +import { isWebAppBuild } from '../../../utils/window-utils' import type { Dispatch } from 'redux' @@ -23,6 +24,23 @@ import log4js from 'log4js' const logger = log4js.getLogger('profiles/store/identity/actions.js') + +function validateProofsService(profile: Object, address: string, username : ?string = null) { + if (!isWebAppBuild()) { + return validateProofs(profile, address, username) + } + + const args: {profile : Object, address: string, username?: string } = { profile, address } + if (username !== null && username !== undefined) { + args.username = username + } + return fetch('https://proofs.blockstack.org/validate/', + { method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(args) }) + .then(resp => resp.json()) +} + function updatePublicIdentity(username: string, ownerAddress: ?string = null, zoneFile: ?string = null, profile: ?{} = Object.assign({}, DEFAULT_PROFILE), verifications: Array<*> = [], trustLevel: ?number = 0) { @@ -232,7 +250,7 @@ function refreshIdentities(api: {bitcoinAddressLookupUrl: string, let verifications = [] let trustLevel = 0 logger.debug(`refreshIdentities: validating address proofs for ${address}`) - return validateProofs(profile, address).then((proofs) => { + return validateProofsService(profile, address).then((proofs) => { verifications = proofs trustLevel = calculateTrustLevel(verifications) dispatch(updateSocialProofVerifications(index, verifications, trustLevel)) @@ -275,7 +293,7 @@ function refreshIdentities(api: {bitcoinAddressLookupUrl: string, dispatch(updateProfile(index, profile, zoneFile)) let verifications = [] let trustLevel = 0 - return validateProofs(profile, ownerAddress, nameOwned).then((proofs) => { + return validateProofsService(profile, ownerAddress, nameOwned).then((proofs) => { verifications = proofs trustLevel = calculateTrustLevel(verifications) dispatch(updateSocialProofVerifications(index, verifications, trustLevel)) @@ -319,7 +337,7 @@ function refreshSocialProofVerifications(identityIndex: number, return (dispatch: Dispatch<*>): Promise<*> => new Promise((resolve) => { let verifications = [] let trustLevel = 0 - validateProofs(profile, ownerAddress, username).then((proofs) => { + validateProofsService(profile, ownerAddress, username).then((proofs) => { verifications = proofs trustLevel = calculateTrustLevel(verifications) dispatch(updateSocialProofVerifications(identityIndex, verifications, trustLevel)) @@ -356,7 +374,7 @@ function fetchPublicIdentity(lookupUrl: string, username: string) { dispatch(updatePublicIdentity(username, ownerAddress, zoneFile, profile, verifications, trustLevel)) if (profile) { - return validateProofs(profile, ownerAddress, username).then((proofs) => { + return validateProofsService(profile, ownerAddress, username).then((proofs) => { verifications = proofs trustLevel = calculateTrustLevel(verifications) dispatch(updatePublicIdentity(username, ownerAddress, zoneFile, profile, diff --git a/app/js/utils/api-utils.js b/app/js/utils/api-utils.js index 693908463..7e0640a89 100644 --- a/app/js/utils/api-utils.js +++ b/app/js/utils/api-utils.js @@ -7,6 +7,8 @@ const logger = log4js.getLogger('utils/api-utils.js') import { uploadProfile, DROPBOX, BLOCKSTACK_INC } from '../account/utils' import { signProfileForUpload } from './index' +import { isCoreEndpointDisabled } from './window-utils' + export function getNamesOwned(address, bitcoinAddressLookupUrl, callback) { const url = bitcoinAddressLookupUrl.replace('{address}', address) fetch(url) @@ -44,7 +46,14 @@ export function getLogServerPortFromURL() { } export function isCoreApiRunning(corePingUrl) { + if (isCoreEndpointDisabled()) { + return new Promise((resolve) => { + resolve(true) + }) + } + logger.debug(`isCoreApiRunning: ${corePingUrl}`) + return new Promise((resolve) => { fetch(corePingUrl, { cache: 'no-store' }) .then((response) => response.text()) @@ -66,6 +75,12 @@ export function isCoreApiRunning(corePingUrl) { } export function isApiPasswordValid(corePasswordProtectedReadUrl, coreApiPassword) { + if (isCoreEndpointDisabled()) { + return new Promise((resolve) => { + resolve(true) + }) + } + logger.debug(`isApiPasswordValid: ${corePasswordProtectedReadUrl}`) const requestHeaders = { @@ -142,9 +157,17 @@ function profileInsertStorageRoutingInfo(profile, driverName, indexUrl) { export function setCoreStorageConfig(api, identityIndex = null, identityAddress = null, profile = null, profileSigningKeypair = null, firstDropboxUpload = false) { + + if (isCoreEndpointDisabled()) { + return new Promise((resolve, reject) => { + resolve('OK') + }) + } + logger.debug(`setCoreStorageConfig: ${identityIndex}, ${identityAddress}`) logger.debug(`setCoreStorageConfig: profile passed? ${!!profile}`) logger.debug(`setCoreStorageConfig: profileSigningKeypair passed? ${!!profileSigningKeypair}`) + const coreAPIPassword = api.coreAPIPassword return new Promise((resolve, reject) => { diff --git a/app/js/utils/window-utils.js b/app/js/utils/window-utils.js index 6912b123f..39b9458e9 100644 --- a/app/js/utils/window-utils.js +++ b/app/js/utils/window-utils.js @@ -3,6 +3,20 @@ export function openInNewTab(url) { win.focus() } +export function isWindowsBuild() { + const isWindowsBuildCompileFlag = false + return isWindowsBuildCompileFlag === true +} + +export function isCoreEndpointDisabled() { + return isWindowsBuild() || isWebAppBuild() +} + +export function isWebAppBuild() { + const isWebAppBuildCompileFlag = false + return isWebAppBuildCompileFlag === true +} + const mobileWindowWidth = 768 export function isMobile() { @@ -11,4 +25,4 @@ export function isMobile() { } else { return false } -} \ No newline at end of file +} diff --git a/app/js/utils/zone-utils.js b/app/js/utils/zone-utils.js index ee635e5ef..2fe8d9b18 100644 --- a/app/js/utils/zone-utils.js +++ b/app/js/utils/zone-utils.js @@ -61,7 +61,11 @@ export function resolveZoneFileToProfile(zoneFile, publicKeyOrAddress) { } if (tokenFileUrl) { - proxyFetch(tokenFileUrl) + fetch(tokenFileUrl) + .catch((error) => { + logger.error(`resolveZoneFileToProfile: error fetching token file without CORS proxy`, error) + return proxyFetch(tokenFileUrl) + }) .then((response) => response.text()) .then((responseText) => JSON.parse(responseText)) .then((responseJson) => { diff --git a/app/js/wallet/ReceivePage.js b/app/js/wallet/ReceivePage.js index 0b41c7eff..4e8023c67 100644 --- a/app/js/wallet/ReceivePage.js +++ b/app/js/wallet/ReceivePage.js @@ -6,6 +6,8 @@ import { QRCode } from 'react-qr-svg' import { AccountActions } from '../account/store/account' import Balance from './components/Balance' +import { isCoreEndpointDisabled } from '../utils/window-utils' + function mapStateToProps(state) { return { addresses: state.account.bitcoinAccount.addresses, @@ -34,6 +36,18 @@ class ReceivePage extends Component { render() { const address = this.props.addresses[0] + if (isCoreEndpointDisabled()) { + return ( +
+ +
+ The Bitcoin wallet is not yet supported in our webapp, + but the feature is coming soon! +
+
+ ) + } + return (
diff --git a/app/js/wallet/SendPage.js b/app/js/wallet/SendPage.js index 6fab7034a..3a5ca4d8b 100644 --- a/app/js/wallet/SendPage.js +++ b/app/js/wallet/SendPage.js @@ -6,6 +6,7 @@ import { getBitcoinPrivateKeychain, getBitcoinAddressNode } from '../utils' +import { isCoreEndpointDisabled } from '../utils/window-utils' import { AccountActions } from '../account/store/account' import Alert from '../components/Alert' @@ -140,6 +141,18 @@ class SendPage extends Component { render() { const disabled = this.state.disabled + if (isCoreEndpointDisabled()) { + return ( +
+ +
+ The Bitcoin wallet is not yet supported in our webapp, + but the feature is coming soon! +
+
+ ) + } + return (
{this.state.alerts.map((alert, index) => diff --git a/app/js/welcome/WelcomeModal.js b/app/js/welcome/WelcomeModal.js index 31b8b63ec..60f01c1dc 100644 --- a/app/js/welcome/WelcomeModal.js +++ b/app/js/welcome/WelcomeModal.js @@ -9,7 +9,7 @@ import { IdentityActions } from '../profiles/store/identity' import { SettingsActions } from '../account/store/settings' import { redirectToConnectToDropbox } from '../account/utils/dropbox' import { redirectToConnectToGaiaHub } from '../account/utils/blockstack-inc' - +import { isWebAppBuild } from '../utils/window-utils' import { PairBrowserView, LandingView, NewInternetView, RestoreView, DataControlView, EnterPasswordView, @@ -372,6 +372,7 @@ class WelcomeModal extends Component { : null}
@@ -432,6 +433,7 @@ class WelcomeModal extends Component { identityKeyPhrase={this.state.identityKeyPhrase} showNextView={this.showNextView} showPreviousView={this.showPreviousView} + webAppBuild={isWebAppBuild()} /> : null diff --git a/app/js/welcome/components/EnterEmailView.js b/app/js/welcome/components/EnterEmailView.js index 352014963..9a6f25f85 100644 --- a/app/js/welcome/components/EnterEmailView.js +++ b/app/js/welcome/components/EnterEmailView.js @@ -90,9 +90,6 @@ class EnterEmailView extends Component { > Continue -

- Skip -

diff --git a/app/js/welcome/components/LandingView.js b/app/js/welcome/components/LandingView.js index c0fe934ca..be0c0bc08 100644 --- a/app/js/welcome/components/LandingView.js +++ b/app/js/welcome/components/LandingView.js @@ -15,9 +15,23 @@ const LandingPage = (props) => marginTop: '10px' }} /> -

Join the new internet.
- Use apps that put you in control. -

+ {props.webAppBuild ? +
+

Welcome to the Blockstack Browser. +

+ +

+ Join the new Internet and
+ use apps that put you in control. +

+
+ : +
+

Join the new internet.
+ Use apps that put you in control. +

+
+ }