forked from steemit/condenser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Calfee
committed
Jul 28, 2016
0 parents
commit 06c90aa
Showing
343 changed files
with
33,668 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"presets": ["es2015", "stage-0", "react"], | ||
"plugins": "transform-runtime", | ||
"env": { | ||
"browser": { | ||
"plugins": [["react-transform", { | ||
"transforms": [ | ||
{ | ||
"transform": "react-transform-catch-errors", | ||
"imports": [ | ||
"react", | ||
"redbox-react" | ||
] | ||
}] | ||
}]] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
.idea | ||
coverage | ||
node_modules | ||
*.log | ||
vendor | ||
config | ||
#tmp | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
# Airbnb is putting everything on error which makes it hard to spot JavaScript errors: https://github.com/airbnb/javascript/issues/853 | ||
# Work-around, move everything from error to warn: | ||
find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i 's/\[2,/\[1,/' | ||
find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/" | ||
*/ | ||
{ | ||
"extends": "airbnb", | ||
"parser": "babel-eslint", | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"ecmaFeatures": { | ||
"blockBindings": true, | ||
"forOf": true, | ||
"jsx": true | ||
}, | ||
"rules": { | ||
"max-len": 0, /*[1, 160, 4],*/ | ||
"comma-dangle": 0, | ||
"semi": [0], | ||
"curly": [0], | ||
"one-var": [0], | ||
"eqeqeq": 0, | ||
"no-cond-assign": 0, | ||
"react/wrap-multilines": [0], | ||
"one-var-declaration-per-line": [0], | ||
"no-param-reassign": [0], | ||
"no-nested-ternary": [0], | ||
"no-undef": 2, | ||
"camelcase": [0], | ||
"no-console": [0], | ||
"object-curly-spacing": [0], | ||
"react/jsx-indent-props": [1,4], | ||
"react/jsx-closing-bracket-location": [0], | ||
"no-use-before-define": [0, {"functions": false, "classes": false}], | ||
"spaced-comment": [0], | ||
"prefer-template": [0], | ||
"new-cap": [0], | ||
"arrow-body-style": [0], | ||
"func-names": [0], | ||
"no-return-assign": 0, | ||
"no-redeclare": 1, | ||
"eol-last": 0, | ||
"no-loop-func": 0, | ||
"no-unneeded-ternary": 0, // false trigger const b = b ? b : a | ||
|
||
/* Nice to haves */ | ||
/*"quotes": [1, "single", "avoid-escape"],*/ "quotes": 0, | ||
/*"indent", [1,4], */ "indent": 0, | ||
"brace-style": 0, | ||
"space-infix-ops": 0, | ||
"keyword-spacing": 0, | ||
"no-confusing-arrow": 0, | ||
"space-in-parens": 0, | ||
"no-throw-literal": 0, | ||
"react/sort-comp": [1, { "order": [ 'lifecycle' ] }], | ||
"react/prefer-stateless-function": 0, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.DS_Store | ||
.idea | ||
server/webpack-stats.json | ||
coverage | ||
node_modules | ||
*.log | ||
dist | ||
vendor/* | ||
tmp/* | ||
config/steem.json | ||
config/steem-dev.json | ||
config/process.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2016 Steemit, Inc., and contributors. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
Steemit | ||
======== | ||
|
||
## Installation | ||
|
||
#### Install dependencies | ||
|
||
```bash | ||
npm install | ||
npm install -g babel-cli | ||
``` | ||
|
||
#### Create config file | ||
|
||
```bash | ||
cd config | ||
cp steem-example.json steem-dev.json | ||
``` | ||
|
||
(note: it's steem.json in production) | ||
|
||
|
||
#### Install steemd | ||
|
||
See https://github.com/steemit/steem for instructions. | ||
|
||
Launch steemd with `--rpc-endpoint 127.0.0.1:8090` flag | ||
|
||
The first launch will generate a `config.ini` file in your data-dir. Ensure you enable the following: | ||
``` | ||
enable-plugin = witness account_history tags follow market_history | ||
public-api = database_api login_api network_broadcast_api follow_api market_history_api | ||
``` | ||
|
||
#### Install mysql server | ||
|
||
OS X : | ||
|
||
```bash | ||
brew update | ||
brew doctor | ||
brew upgrade | ||
brew install mysql | ||
mysql.server restart | ||
``` | ||
|
||
Debian based Linux: | ||
|
||
```bash | ||
sudo apt-get update | ||
sudo apt-get install mysql-server | ||
``` | ||
|
||
Now launch mysql client and create steemit_dev database: | ||
```bash | ||
mysql -u root | ||
> create database steemit_dev; | ||
``` | ||
|
||
Install `sequelize-cli` globally: | ||
|
||
```bash | ||
npm install -g sequelize-cli pm2 | ||
``` | ||
|
||
Run `sequelize db:migrate` in `db/` directory. | ||
|
||
|
||
### Development | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
||
#### Style Guides | ||
|
||
##### File naming and location | ||
|
||
- Prefer CamelCase js and jsx file names | ||
- Prefer lower case one word directory names | ||
- Keep stylesheet files close to components | ||
- Component's stylesheet file name should match component name | ||
|
||
##### Js & Jsx | ||
We are using _Airbnb JavaScript Style Guide_ with some modifications (see .eslintrc). | ||
Please run _eslint_ in the working directory before committing your changes and make sure you didn't introduce any new styling issues. | ||
|
||
##### CSS & SCSS | ||
If component requires a css rule, please use its uppercase name for the class, e.g. "Header" class for the header's root div. | ||
We adhere to BEM methodology with exception for Foundation classes, here is an example for the Header component: | ||
|
||
```html | ||
<!-- Block --> | ||
<ul class="Header"> | ||
... | ||
<!-- Element --> | ||
<li class="Header__menu-item">Menu Item 1</li> | ||
<!-- Element with modifier --> | ||
<li class="Header__menu-item--selected">Element with modifier</li> | ||
</ul> | ||
``` | ||
|
||
### Production | ||
|
||
If you want to test it locally in production mode, just run the following commands: | ||
|
||
```bash | ||
npm run build | ||
npm run prod | ||
``` | ||
|
||
or via pm2: | ||
|
||
```bash | ||
npm run build | ||
npm -i -g pm2 # one time | ||
pm2 start config/process.json | ||
``` | ||
|
||
|
||
## Issues | ||
|
||
To report a non-critical issue, please file an issue on this GitHub project. | ||
|
||
If you find a security issue please report details to: secure[at]steemit[dot]com | ||
|
||
We will evaluate the risk and make a patch available before filing the issue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require('./assets/stylesheets/app.scss'); | ||
require('whatwg-fetch'); | ||
import Iso from 'iso'; | ||
import universalRender from 'shared/UniversalRender'; | ||
import ConsoleExports from './utils/ConsoleExports'; | ||
import {serverApiRecordEvent} from 'app/utils/ServerApiClient'; | ||
|
||
window.onerror = error => { | ||
serverApiRecordEvent('client_error', error); | ||
}; | ||
|
||
Iso.bootstrap(initial_state => { | ||
console.log('Initial state', initial_state); | ||
window.$STM_Config = initial_state.offchain.config; | ||
if (initial_state.offchain.serverBusy) { | ||
window.$STM_ServerBusy = true; | ||
} | ||
if (initial_state.offchain.csrf) { | ||
window.$STM_csrf = initial_state.offchain.csrf; | ||
delete initial_state.offchain.csrf; | ||
} | ||
const location = `${window.location.pathname}${window.location.search}${window.location.hash}`; | ||
universalRender({history, location, initial_state}) | ||
.catch(error => { | ||
console.error(error); | ||
serverApiRecordEvent('client_error', error); | ||
}); | ||
}); | ||
|
||
try { | ||
// Adds some object refs to the global window object | ||
ConsoleExports.init(window) | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
|
||
// redux-form performance work-around https://github.com/erikras/redux-form/issues/529 | ||
// window.reduxFormPerformFix = fields => { | ||
// Object.keys(fields).forEach(el => {fields[el].onChange = e => {fields[el].value = e.target.value}}) | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
export default function resolveRoute(path) | ||
{ | ||
if (path === '/') { | ||
return {page: 'PostsIndex', params: ['trending']}; | ||
} | ||
if (path === '/about.html') { | ||
return {page: 'About'}; | ||
} | ||
if (path === '/login.html') { | ||
return {page: 'Login'}; | ||
} | ||
if (path === '/privacy.html') { | ||
return {page: 'Privacy'}; | ||
} | ||
if (path === '/support.html') { | ||
return {page: 'Support'}; | ||
} | ||
if (path === '/search.html') { | ||
return {page: 'Search'}; | ||
} | ||
if (path === '/xss/test' && process.env.NODE_ENV === 'development') { | ||
return {page: 'XSSTest'}; | ||
} | ||
if (path.match(/^\/tags\.html/)) { | ||
return {page: 'Tags'}; | ||
} | ||
if (path === '/tos.html') { | ||
return {page: 'Tos'}; | ||
} | ||
if (path === '/change_password') { | ||
return {page: 'ChangePassword'}; | ||
} | ||
if (path === '/create_account') { | ||
return {page: 'CreateAccount'}; | ||
} | ||
if (path === '/recover_account_step_1') { | ||
return {page: 'RecoverAccountStep1'}; | ||
} | ||
if (path === '/recover_account_step_2') { | ||
return {page: 'RecoverAccountStep2'}; | ||
} | ||
if (path === '/waiting_list.html') { | ||
return {page: 'WaitingList'}; | ||
} | ||
if (path === '/market') { | ||
return {page: 'Market'}; | ||
} | ||
if (path === '/~witnesses') { | ||
return {page: 'Witnesses'}; | ||
} | ||
if (path === '/submit.html') { | ||
return {page: 'SubmitPost'}; | ||
} | ||
let match = path.match(/^\/(@[\w\.\d-]+)\/?$/) || | ||
path.match(/^\/(@[\w\.\d-]+)\/(blog|posts|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|password)\/?$/); | ||
if (match) { | ||
return {page: 'UserProfile', params: match.slice(1)}; | ||
} | ||
match = path.match(/^\/(\@[\w\d-]+)\/([\w\d-]+)\/?$/) || | ||
path.match(/^\/([\w\d\-\/]+)\/(\@[\w\d\.-]+)\/([\w\d-]+)\/?$/) || | ||
path.match(/^\/([\w\d\-\/]+)\/(\@[\w\d\.-]+)\/([\w\d-]+)\/?\?sort=(\w+)$/); | ||
if (match) { | ||
return {page: 'Post', params: match.slice(1)}; | ||
} | ||
match = path.match(/^\/(best|updated|hot|votes|responses|trending|cashout|created|recent|active)\/?$/) | ||
|| path.match(/^\/(best|trending|hot|updated|votes|responses|cashout|created|recent|active)\/([\w\d-]+)\/?$/); | ||
if (match) { | ||
return {page: 'PostsIndex', params: match.slice(1)}; | ||
} | ||
return {page: 'NotFound'}; | ||
} |
Oops, something went wrong.