Unverified Commit ffd08186 authored by roadscape's avatar roadscape Committed by GitHub
Browse files

Merge pull request #96 from steemit/im-68-debug-custom-json-broadcast

Im 68 debug custom json broadcast
parents cb1deecb 4122dabc
{ {
"name": "steemit.com", "name": "steemit.com",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/steemit/steemit.com.git" "url": "https://github.com/steemit/steemit.com.git"
}, },
"version": "1.0.0", "version": "1.0.0",
"description": "steemit.com is the koa web server & middleware and react.js in-browser code for the world's first blockchain content + social media monetization platform!", "description": "steemit.com is the koa web server & middleware and react.js in-browser code for the world's first blockchain content + social media monetization platform!",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "NODE_ENV=production webpack --config ./webpack/prod.config.js && rm -rf ./lib && babel src --out-dir lib -Dq", "build": "NODE_ENV=production webpack --config ./webpack/prod.config.js && rm -rf ./lib && babel src --out-dir lib -Dq",
"test": "jest", "test": "jest",
"eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi", "eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi",
"fmt": "prettier --config .prettierrc --write 'src/**/*.js*'", "fmt": "prettier --config .prettierrc --write 'src/**/*.js*'",
"precommit": "lint-staged", "precommit": "lint-staged",
"production": "NODE_ENV=production node lib/server/index.js", "production": "NODE_ENV=production node lib/server/index.js",
"start": "NODE_ENV=development babel-node ./webpack/dev-server.js", "start": "NODE_ENV=development babel-node ./webpack/dev-server.js",
"debug": "NODE_ENV=development webpack --config ./webpack/debug.config.js && rm -rf ./lib && babel src --source-maps --out-dir lib -D && node --inspect-brk lib/server/index.js", "debug": "NODE_ENV=development webpack --config ./webpack/debug.config.js && rm -rf ./lib && babel src --source-maps --out-dir lib -D && node --inspect-brk lib/server/index.js",
"checktranslations": "node scripts/check_translations.js", "checktranslations": "node scripts/check_translations.js",
"storybook": "start-storybook -p 9001 -c .storybook", "storybook": "start-storybook -p 9001 -c .storybook",
"storybook-build": "build-storybook -c .storybook -o docs" "storybook-build": "build-storybook -c .storybook -o docs"
}, },
"author": "Steemit, Inc.", "author": "Steemit, Inc.",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@steem/crypto-session": "git+https://github.com/steemit/crypto-session.git#83a90b319ce5bc6a70362d52a15a815de7e729bb", "@steem/crypto-session": "git+https://github.com/steemit/crypto-session.git#83a90b319ce5bc6a70362d52a15a815de7e729bb",
"@steemit/steem-js": "^0.7.6", "@steemit/steem-js": "^0.7.6",
"assert": "1.4.1", "assert": "1.4.1",
"autoprefixer-loader": "3.2.0", "autoprefixer-loader": "3.2.0",
"babel-cli": "6.26.0", "babel-cli": "6.26.0",
"babel-core": "6.26.0", "babel-core": "6.26.0",
"babel-eslint": "6.1.2", "babel-eslint": "6.1.2",
"babel-loader": "7.1.2", "babel-loader": "7.1.2",
"babel-plugin-react-intl": "2.3.1", "babel-plugin-react-intl": "2.3.1",
"babel-plugin-transform-decorators-legacy": "1.3.4", "babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-inline-environment-variables": "0.2.0", "babel-plugin-transform-inline-environment-variables": "0.2.0",
"babel-plugin-transform-runtime": "6.23.0", "babel-plugin-transform-runtime": "6.23.0",
"babel-preset-es2015": "6.24.1", "babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1", "babel-preset-react": "6.24.1",
"babel-preset-stage-0": "6.24.1", "babel-preset-stage-0": "6.24.1",
"bigi": "1.4.2", "bigi": "1.4.2",
"blocked": "1.2.1", "blocked": "1.2.1",
"blueimp-file-upload": "9.22.1", "blueimp-file-upload": "9.22.1",
"bs58": "3.1.0", "bs58": "3.1.0",
"bytebuffer": "5.0.1", "bytebuffer": "5.0.1",
"bytes": "2.5.0", "bytes": "2.5.0",
"classnames": "2.2.5", "classnames": "2.2.5",
"cluster": "0.7.7", "cluster": "0.7.7",
"co-body": "5.1.1", "co-body": "5.1.1",
"config": "1.26.2", "config": "1.26.2",
"counterpart": "0.17.9", "counterpart": "0.17.9",
"cpu-stat": "2.0.1", "cpu-stat": "2.0.1",
"css-loader": "^2.1.1", "css-loader": "^2.1.1",
"currency-symbol-map": "3.1.0", "currency-symbol-map": "3.1.0",
"diff-match-patch": "1.0.0", "diff-match-patch": "1.0.0",
"disk-stat": "1.0.4", "disk-stat": "1.0.4",
"ecurve": "1.0.5", "dsteem": "^0.11.3",
"estraverse-fb": "1.3.2", "ecurve": "1.0.5",
"file-loader": "0.11.2", "estraverse-fb": "1.3.2",
"foundation-sites": "git+https://github.com/steemit/foundation-sites.git#e8e32c715bbc4c822b80b555345f61337269ca78", "file-loader": "0.11.2",
"git-rev-sync": "1.9.1", "foundation-sites": "git+https://github.com/steemit/foundation-sites.git#e8e32c715bbc4c822b80b555345f61337269ca78",
"highcharts": "4.2.7", "git-rev-sync": "1.9.1",
"humanize-number": "0.0.2", "highcharts": "4.2.7",
"imports-loader": "0.7.1", "humanize-number": "0.0.2",
"intl": "1.2.5", "imports-loader": "0.7.1",
"iso": "5.2.0", "intl": "1.2.5",
"json-loader": "0.5.7", "iso": "5.2.0",
"koa": "1.4.1", "json-loader": "0.5.7",
"koa-body": "1.6.0", "koa": "1.4.1",
"koa-compressor": "1.0.3", "koa-body": "1.6.0",
"koa-conditional-get": "1.0.4", "koa-compressor": "1.0.3",
"koa-csrf": "2.5.0", "koa-conditional-get": "1.0.4",
"koa-etag": "2.1.2", "koa-csrf": "2.5.0",
"koa-favicon": "1.2.1", "koa-etag": "2.1.2",
"koa-helmet": "1.2.0", "koa-favicon": "1.2.1",
"koa-isbot": "0.1.1", "koa-helmet": "1.2.0",
"koa-locale": "1.3.0", "koa-isbot": "0.1.1",
"koa-logger": "1.3.1", "koa-locale": "1.3.0",
"koa-mount": "1.3.0", "koa-logger": "1.3.1",
"koa-proxy": "0.5.0", "koa-mount": "1.3.0",
"koa-route": "2.4.2", "koa-proxy": "0.5.0",
"koa-router": "5.4.2", "koa-route": "2.4.2",
"koa-session": "3.4.0", "koa-router": "5.4.2",
"koa-static-cache": "4.1.1", "koa-session": "3.4.0",
"lodash.debounce": "4.0.8", "koa-static-cache": "4.1.1",
"mem-stat": "1.0.5", "lodash.debounce": "4.0.8",
"minimist": "1.2.0", "mem-stat": "1.0.5",
"mixpanel": "0.5.0", "minimist": "1.2.0",
"moment": "^2.24.0", "mixpanel": "0.5.0",
"mysql": "2.15.0", "moment": "^2.24.0",
"net": "1.0.2", "mysql": "2.15.0",
"node-sass": "4.9.0", "net": "1.0.2",
"number-abbreviate": "^2.0.0", "node-sass": "4.9.0",
"os": "0.1.1", "number-abbreviate": "^2.0.0",
"picturefill": "3.0.2", "os": "0.1.1",
"raw-loader": "0.5.1", "picturefill": "3.0.2",
"react": "15.6.2", "raw-loader": "0.5.1",
"react-ab-test": "1.7.0", "react": "15.6.2",
"react-addons-pure-render-mixin": "15.4.2", "react-ab-test": "1.7.0",
"react-autocomplete": "1.7.2", "react-addons-pure-render-mixin": "15.4.2",
"react-copy-to-clipboard": "4.3.1", "react-autocomplete": "1.7.2",
"react-dom": "15.6.2", "react-copy-to-clipboard": "4.3.1",
"react-dropzone": "3.13.4", "react-dom": "15.6.2",
"react-highcharts": "8.4.2", "react-dropzone": "3.13.4",
"react-intl": "2.4.0", "react-highcharts": "8.4.2",
"react-medium-editor": "1.8.1", "react-intl": "2.4.0",
"react-notification": "5.0.7", "react-medium-editor": "1.8.1",
"react-overlays": "0.7.2", "react-notification": "5.0.7",
"react-portal": "2.2.1", "react-overlays": "0.7.2",
"react-prop-types": "0.3.2", "react-portal": "2.2.1",
"react-qr": "0.0.2", "react-prop-types": "0.3.2",
"react-rangeslider": "2.2.0", "react-qr": "0.0.2",
"react-redux": "5.0.6", "react-rangeslider": "2.2.0",
"react-router": "3.2.0", "react-redux": "5.0.6",
"react-router-redux": "4.0.8", "react-router": "3.2.0",
"react-router-scroll": "0.4.4", "react-router-redux": "4.0.8",
"react-rte-image": "0.3.1", "react-router-scroll": "0.4.4",
"react-timeago": "3.4.3", "react-rte-image": "0.3.1",
"redux": "3.7.2", "react-timeago": "3.4.3",
"redux-form": "5.3.4", "redux": "3.7.2",
"redux-saga": "0.16.0", "redux-form": "5.3.4",
"remarkable": "1.7.1", "redux-saga": "0.16.0",
"sanitize-html": "1.14.1", "remarkable": "1.7.1",
"sass-loader": "6.0.6", "sanitize-html": "1.14.1",
"secure-random": "1.1.1", "sass-loader": "6.0.6",
"sendgrid": "4.10.0", "secure-random": "1.1.1",
"sequelize": "3.33.0", "sendgrid": "4.10.0",
"sequelize-cli": "3.2.0", "sequelize": "3.33.0",
"speakingurl": "9.0.0", "sequelize-cli": "3.2.0",
"sqlite3": "4.0.9", "speakingurl": "9.0.0",
"statsd-client": "0.4.2", "sqlite3": "4.0.9",
"steemscript": "1.1.0", "statsd-client": "0.4.2",
"store": "1.3.20", "steemscript": "1.1.0",
"style-loader": "0.18.2", "store": "1.3.20",
"svg-inline-loader": "0.8.0", "style-loader": "0.18.2",
"svg-inline-react": "1.0.3", "svg-inline-loader": "0.8.0",
"svgo-loader": "1.2.1", "svg-inline-react": "1.0.3",
"twilio": "3.17.0", "svgo-loader": "1.2.1",
"uncontrollable": "3.3.1", "twilio": "3.17.0",
"underscore.string": "3.3.5", "uncontrollable": "3.3.1",
"url-loader": "0.6.2", "underscore.string": "3.3.5",
"web-push": "3.2.3", "url-loader": "0.6.2",
"webpack": "3.7.1", "web-push": "3.2.3",
"webpack-dev-middleware": "1.12.0", "webpack": "3.7.1",
"webpack-isomorphic-tools": "3.0.5", "webpack-dev-middleware": "1.12.0",
"websocket": "1.0.24", "webpack-isomorphic-tools": "3.0.5",
"whatwg-fetch": "0.11.1", "websocket": "1.0.24",
"xmldom": "0.1.27" "whatwg-fetch": "0.11.1",
}, "xmldom": "0.1.27"
"devDependencies": { },
"babel-jest": "22.0.6", "devDependencies": {
"babel-plugin-transform-decorators-legacy": "1.3.4", "babel-jest": "22.0.6",
"co-supertest": "0.0.10", "babel-plugin-transform-decorators-legacy": "1.3.4",
"dev-ip": "1.0.1", "co-supertest": "0.0.10",
"enzyme": "3.3.0", "dev-ip": "1.0.1",
"enzyme-adapter-react-15": "1.0.5", "enzyme": "3.3.0",
"escope": "3.6.0", "enzyme-adapter-react-15": "1.0.5",
"eslint": "4.18.2", "escope": "3.6.0",
"eslint-config-airbnb": "15.1.0", "eslint": "4.18.2",
"eslint-plugin-babel": "4.1.2", "eslint-config-airbnb": "15.1.0",
"eslint-plugin-import": "2.7.0", "eslint-plugin-babel": "4.1.2",
"eslint-plugin-jsx-a11y": "6.0.2", "eslint-plugin-import": "2.7.0",
"eslint-plugin-react": "7.4.0", "eslint-plugin-jsx-a11y": "6.0.2",
"extract-text-webpack-plugin": "3.0.1", "eslint-plugin-react": "7.4.0",
"husky": "0.14.3", "extract-text-webpack-plugin": "3.0.1",
"jest": "22.0.6", "husky": "0.14.3",
"jsdom": "9.12.0", "jest": "22.0.6",
"koa-webpack-dev-middleware": "1.4.6", "jsdom": "9.12.0",
"koa-webpack-hot-middleware": "1.0.3", "koa-webpack-dev-middleware": "1.4.6",
"lint-staged": "6.0.0", "koa-webpack-hot-middleware": "1.0.3",
"mock-local-storage": "1.0.5", "lint-staged": "6.0.0",
"node-watch": "0.5.5", "mock-local-storage": "1.0.5",
"prettier": "1.13.4", "node-watch": "0.5.5",
"react-addons-perf": "15.4.2", "prettier": "1.13.4",
"react-addons-test-utils": "15.4.2", "react-addons-perf": "15.4.2",
"react-test-renderer": "15.6.2", "react-addons-test-utils": "15.4.2",
"react-transform-catch-errors": "1.0.2", "react-test-renderer": "15.6.2",
"react-transform-hmr": "1.0.4", "react-transform-catch-errors": "1.0.2",
"redux-devtools-extension": "2.13.5", "react-transform-hmr": "1.0.4",
"redux-mock-store": "1.5.1", "redux-devtools-extension": "2.13.5",
"regenerator-runtime": "0.11.1", "redux-mock-store": "1.5.1",
"sinon": "1.17.7", "regenerator-runtime": "0.11.1",
"supertest": "1.2.0", "sinon": "1.17.7",
"webpack-bundle-analyzer": "2.9.0" "supertest": "1.2.0",
}, "webpack-bundle-analyzer": "2.9.0"
"engines": { },
"node": ">=8.7.0", "engines": {
"npm": ">=5.4.2" "node": ">=8.7.0",
}, "npm": ">=5.4.2"
"lint-staged": { },
"src/**/*.js*": [ "lint-staged": {
"prettier --write", "src/**/*.js*": [
"git add" "prettier --write",
] "git add"
}, ]
"jest": { },
"testURL": "http://localhost/", "jest": {
"rootDir": "src", "testURL": "http://localhost/",
"modulePaths": [ "rootDir": "src",
"<rootDir>/" "modulePaths": [
], "<rootDir>/"
"moduleNameMapper": { ],
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js" "moduleNameMapper": {
} "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js"
} }
}
} }
...@@ -2,7 +2,7 @@ import GDPRUserList from './utils/GDPRUserList'; ...@@ -2,7 +2,7 @@ import GDPRUserList from './utils/GDPRUserList';
export const routeRegex = { export const routeRegex = {
UserProfile1: /^\/(@[\w\.\d-]+)\/?$/, UserProfile1: /^\/(@[\w\.\d-]+)\/?$/,
UserProfile2: /^\/(@[\w\.\d-]+)\/(transfers|curation-rewards|author-rewards|permissions|password|settings)\/?$/, UserProfile2: /^\/(@[\w\.\d-]+)\/(transfers|curation-rewards|author-rewards|permissions|communities|password|settings)\/?$/,
}; };
export default function resolveRoute(path) { export default function resolveRoute(path) {
......
...@@ -7,7 +7,7 @@ describe('routeRegex', () => { ...@@ -7,7 +7,7 @@ describe('routeRegex', () => {
['UserProfile1', /^\/(@[\w\.\d-]+)\/?$/], ['UserProfile1', /^\/(@[\w\.\d-]+)\/?$/],
[ [
'UserProfile2', 'UserProfile2',
/^\/(@[\w\.\d-]+)\/(transfers|curation-rewards|author-rewards|permissions|password|settings)\/?$/, /^\/(@[\w\.\d-]+)\/(transfers|curation-rewards|author-rewards|permissions|communities|password|settings)\/?$/,
], ],
]; ];
......
import React from 'react';
import { APP_NAME } from 'app/client_config';
import { connect } from 'react-redux';
import * as communityActions from 'app/redux/CommunityReducer';
import tt from 'counterpart';
import { key_utils } from '@steemit/steem-js/lib/auth/ecc';
class CreateCommunity extends React.Component {
constructor() {
super();
this.state = {
accountError: false,
broadcastOpsError: false,
accountCreated: false,
};
}
componentDidMount() {}
render() {
const {
accountName,
communityCreateError,
communityCreatePending,
communityCreateSuccess,
createCommunity,
communityDescription,
communityNSFW,
communityOwnerWifPassword,
communityOwnerName,
communityTitle,
updateCommunityTitle,
updateCommunityDescription,
updateCommunityNSFW,
updateCommunityOwnerAccountName,
updateCommunityOwnerWifPassword,
broadcastOps,
} = this.props;
const handleAccountCreateError = () => {
this.setState({ accountError: true });
};
const handleAccountCreateSuccess = () => {
this.setState({ accountCreated: true });
};
const handleBroadcastOpsError = () => {
this.setState({ broadcastOpsError: false });
};
const handleCommunityTitleInput = e => {
if (e.target.value.length > 32) {
return;
}
updateCommunityTitle(e.target.value);
};
const handleCommunityDescriptionInput = e => {
if (e.target.value.length > 120) {
return;
}
updateCommunityDescription(e.target.value);
};
const handleCommunityNSFWInput = e => {
updateCommunityNSFW(e.target.checked);
};
const handleCommunitySubmit = e => {
e.preventDefault();
const createCommunityPayload = {
accountName,
communityTitle,
communityDescription,
communityNSFW,
communityOwnerName,
communityOwnerWifPassword,
createAccountSuccessCB: handleAccountCreateSuccess,
createAccountErrorCB: handleAccountCreateError,
broadcastOpsErrorCB: handleBroadcastOpsError,
};
if (!this.state.accountCreated) {
createCommunity(createCommunityPayload);
} else {
broadcastOps(createCommunityPayload);
}
};
const generateCommunityOwnerName = () => {
return `hive-${Math.floor(Math.random() * 100000) + 100000}`;
};
const generateCreatorWifPassword = () => {
return 'P' + key_utils.get_random_key().toWif();
};
const generateWif = () => {
const wif = generateCreatorWifPassword();
updateCommunityOwnerWifPassword(wif);
};
const generateUsername = () => {
const ownerUsername = generateCommunityOwnerName();
updateCommunityOwnerAccountName(ownerUsername);
};
const generateCommunityCredentials = () => {
generateWif();
generateUsername();
};
const generateCommunityCredentialsButton = (
<button
type="button"
className="button hollow"
onClick={generateCommunityCredentials}
>
{tt('g.click_to_generate_password')}
</button>
);
const rememberCredentialsPrompt = (
<div>
<div>{`${tt(
'g.community_owner_name_is'
)}: ${communityOwnerName}`}</div>
<div>{`${tt(
'g.community_password_is'
)}: ${communityOwnerWifPassword}`}</div>
</div>
);
const rememberCredentialsCheckbox1 = (
<label htmlFor="box1">
<input type="checkbox" name="box1" required />