Commit 4f110611 authored by Jason Salyers's avatar Jason Salyers
Browse files

Merge branch 'develop' into 'jsalyers-update-lists'

# Conflicts:
#   src/app/utils/DMCAUserList.js
parents a93e3fcf 7a9bf433
......@@ -10,17 +10,18 @@ find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/"
"env": {
"browser": true,
"node": true,
"es6": true
"es6": true,
"jest": true
},
"rules": {
"max-len": 0,
/*[1, 160, 4],*/
"comma-dangle": 0,
"semi": [
0
2
],
"curly": [
0
1
],
"one-var": [
0
......@@ -39,7 +40,14 @@ find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/"
"no-nested-ternary": [
0
],
"prefer-destructuring": 0,
"react/no-unused-state": 1,
"no-unused-expressions": 1,
"react/no-string-refs": 1,
"no-restricted-syntax": 0,
"no-undef": 2,
"no-case-declarations": 0,
"no-underscore-dangle": 0,
"camelcase": [
0
],
......@@ -50,6 +58,14 @@ find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/"
"object-curly-spacing": [
0
],
"class-methods-use-this": 0,
"react/no-array-index-key": 1,
"react/no-find-dom-node": 1,
"react/jsx-props-no-spreading": 1,
"react/static-property-placement": 1,
"react/forbid-prop-types": 1,
"react/require-default-props": 1,
"react/destructuring-assignment": 0,
"react/jsx-indent": [
1,
4
......@@ -61,6 +77,11 @@ find node_modules/eslint-config-airbnb -name '*.js'|xargs sed -i "s/': 2/': 1/"
"react/jsx-closing-bracket-location": [
0
],
"jsx-a11y/no-noninteractive-element-interactions": 1,
"jsx-a11y/accessible-emoji": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/label-has-associated-control": 0,
"consistent-return": 1,
"no-use-before-define": [
0,
{
......
name: "CodeQL"
on:
push:
branches: [ master, develop, g-maintenance ]
schedule:
- cron: '45 7 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-18.04
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
......@@ -7,7 +7,6 @@ variables:
DOCKER_IMAGE: hiveio/condenser
APP_REVIEW_SUBDOMAIN: .condenser.engrave.dev
STAGING_DOMAIN: staging.condenser.engrave.dev
PRODUCTION_DOMAIN: hive.blog
CERTS: ~/.docker
################################# COMMON TEMPLATES #################################
......@@ -40,15 +39,6 @@ variables:
after_script:
- rm -fR $CERTS
.docker-remote-host-production: &docker-remote-host-production
before_script:
- mkdir -p $CERTS
- echo "$PRODUCTION_TLSCACERT" > $CERTS/ca.pem
- echo "$PRODUCTION_TLSCERT" > $CERTS/cert.pem
- echo "$PRODUCTION_TLSKEY" > $CERTS/key.pem
after_script:
- rm -fR $CERTS
################################# MERGE REQUESTS #################################
run-unit-tests:
......@@ -77,7 +67,6 @@ run-eslint:
- yarn install --frozen-lockfile --ignore-optional
script:
- yarn ci:eslint
allow_failure: true # will be changed to false when all linter errors removed
build-review-app:
<<: *docker-job
......@@ -176,19 +165,3 @@ deploy-staging:
environment:
name: staging
url: https://$STAGING_DOMAIN
deploy-production:
<<: *docker-job
<<: *docker-remote-host-production
stage: deploy
variables:
DOCKER_TAG: $DOCKER_IMAGE:$CI_COMMIT_SHORT_SHA
SERVICE_NAME: production_condenser
only:
- master
script:
- DOCKER_CERT_PATH=$CERTS docker -H $PRODUCTION_HOST --tlsverify pull $DOCKER_TAG
- DOCKER_CERT_PATH=$CERTS docker -H $PRODUCTION_HOST --tlsverify service update --image $DOCKER_TAG --update-failure-action rollback --update-order start-first $SERVICE_NAME
environment:
name: production
url: https://$PRODUCTION_DOMAIN
require('babel-register');
module.exports = require('../webpack/storybook.config.js');
\ No newline at end of file
require('@babel/register');
module.exports = require('../webpack/storybook.config.js');
FROM circleci/openjdk:jdk-node-browsers
WORKDIR /home/circleci
COPY package.json yarn.lock /home/circleci/
RUN yarn install --non-interactive --frozen-lockfile
RUN curl -s https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar > /home/circleci/selenium-server-standalone.jar
RUN curl -s https://chromedriver.storage.googleapis.com/2.36/chromedriver_linux64.zip | funzip > /home/circleci/chromedriver && chmod +x /home/circleci/chromedriver
COPY . /home/circleci/
CMD [ "yarn", "start" ]
module.exports = {
'Ensure homepage loads without strange errors': browser => {
browser
.url('http://localhost:8080')
.pause(300)
//.assert.containsText('h1.articles__h1', 'Trending: All tags')
.assert.containsText('a.Header__login-link', 'Login')
.getLog('browser', function(result) {
this.assert.ok(
reasonableErrorLog(result),
'error log is reasonable'
);
})
.end();
},
};
function reasonableErrorLog(logs) {
const logsMinusNetworkErrors = logs.filter(log => log.source !== 'network');
return logsMinusNetworkErrors.length === 0;
}
const http = require('http');
module.exports = {
'Ensure all of the standard routes return HTTP 200': (browser) => {
browser.end(); // Not needed.
[
'/',
'/trending',
'/created',
'/hot',
'/promoted',
'/about.html',
'/faq.html',
'/login.html',
'/privacy.html',
'/support.html',
'/tos.html',
'/change_password',
'/recover_account_step_1',
'/market',
'/submit.html',
].forEach(path => testHttpGet('localhost', 8080, path, browser));
},
};
const testHttpGet = (host, port, path, browser) => {
http
.request({
host,
port,
path,
method: 'GET'
}, function(res) {
browser.assert.equal(res.statusCode, 200, `Response for ${path} is 200`);
})
.setTimeout(30000, function() {
browser.assert.equal(true, false, `request for ${path} took more than 30 seconds`);
})
.on('error', function (err) {
browser.assert.equal(true, false, err);
})
.end();
};
{
"src_folders" : ["./nightwatch-tests"],
"output_folder" : "./nightwatch-reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "./selenium-server-standalone.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
{
"name": "condenser-blackboxtest",
"version": "1.0.0",
"main": false,
"scripts": {
"start": "nightwatch --config nightwatch.json"
},
"license": "MIT",
"dependencies": {
"nightwatch": "0.9.19",
"phantomjs-prebuilt": "2.1.16"
}
}
This diff is collapsed.
......@@ -11,13 +11,14 @@
"build": "NODE_ENV=production webpack --config ./webpack/prod.config.js && rm -rf ./lib && babel src --out-dir lib -D",
"test": "jest",
"eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi",
"eslint:fix": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint --fix $LIST; fi",
"ci:test": "jest --coverage",
"ci:eslint": "eslint src/",
"fmt": "prettier --config .prettierrc --write 'src/**/*.js*'",
"fmt": "prettier --config .prettierrc --write 'src/**/*.+(js|jsx)'",
"precommit": "lint-staged",
"production": "NODE_ENV=production node lib/server/index.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",
"production": "NODE_OPTIONS=\"--trace-warnings\" NODE_ENV=production node lib/server/index.js",
"start": "NODE_OPTIONS=\"--trace-warnings\" NODE_ENV=development babel-node ./webpack/dev-server.js",
"debug": "NODE_OPTIONS=\"--trace-warnings\" 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",
"storybook": "start-storybook -p 9001 -c .storybook",
"storybook-build": "build-storybook -c .storybook -o docs",
......@@ -26,28 +27,6 @@
"author": "HiveBlog",
"license": "MIT",
"dependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.12.1",
"@babel/runtime": "^7.12.5",
"@hiveio/hive-js": "^2.0.4",
"@hiveio/hivescript": "^1.2.0",
......@@ -55,10 +34,6 @@
"assert": "1.4.1",
"autoprefixer": "^9.6.1",
"axios": "^0.18.1",
"babel-eslint": "10.1.0",
"babel-loader": "8.1.0",
"babel-plugin-react-intl": "2.3.1",
"babel-plugin-transform-inline-environment-variables": "0.2.0",
"big.js": "^5.2.2",
"bigi": "1.4.2",
"blocked": "1.2.1",
......@@ -69,15 +44,20 @@
"bytes": "2.5.0",
"classnames": "2.2.5",
"cluster": "0.7.7",
"co-body": "^5.1.1",
"config": "1.26.2",
"core-js": "^3.6.5",
"counterpart": "0.17.9",
"cpu-stat": "2.0.1",
"date-names": "^0.1.13",
"diff-match-patch": "1.0.4",
"disk-stat": "1.0.4",
"extract-text-webpack-plugin": "^v4.0.0-beta.0",
"foundation-sites": "git+https://gitlab.syncad.com/hive/foundation-sites.git#544fb8a26efcf45e9ba9ccaa77b04d0ae35b9722",
"hive-uri": "^0.2.3",
"hivesigner": "3.2.7",
"humanize-number": "0.0.2",
"immutable": "^3.8.1",
"intl": "1.2.5",
"iso": "5.2.0",
"koa": "1.4.1",
......@@ -95,46 +75,55 @@
"koa-proxy": "0.5.0",
"koa-router": "5.4.2",
"koa-static-cache": "4.1.1",
"lodash": "^4.17.21",
"lodash.debounce": "4.0.8",
"mem-stat": "1.0.5",
"mini-css-extract-plugin": "^1.2.1",
"minimist": "1.2.0",
"minimist": "~1.2.3",
"mixpanel": "0.5.0",
"node-cache": "4.2.0",
"node-fetch": "^2.6.1",
"os": "0.1.1",
"pluralizers": "^0.1.7",
"postcss": "^8.1.6",
"postcss-loader": "^4.0.4",
"prop-types": "^15.7.2",
"qrious": "^4.0.2",
"react": "15.6.2",
"react": "16.8",
"react-addons-pure-render-mixin": "15.4.2",
"react-autocomplete": "1.8.1",
"react-copy-to-clipboard": "4.3.1",
"react-dom": "15.6.2",
"react-dom": "16.8",
"react-dropzone": "3.13.4",
"react-headroom": "2.2.7",
"react-intl": "2.4.0",
"react-notification": "5.0.7",
"react-overlays": "0.7.2",
"react-portal": "3.0.0",
"react-mde": "^11.0.6",
"react-notification": "6.8.5",
"react-overlays": "0.7.3",
"react-portal": "4.2.1",
"react-rangeslider": "2.2.0",
"react-redux": "5.0.6",
"react-router": "3.2.0",
"react-router-redux": "4.0.8",
"react-router-scroll": "0.4.4",
"react-rte": "^0.16.3",
"react-sparklines": "1.7.0",
"react-tabs": "^3.1.1",
"redux": "3.7.2",
"redux-form": "5.3.4",
"redux-saga": "0.16.0",
"remarkable": "1.7.1",
"regenerator-runtime": "^0.13.9",
"remarkable": "~1.7.2",
"remove-markdown": "^0.3.0",
"sanitize-html": "1.14.1",
"sanitize-html": "~2.5.0",
"sass": "^1.29.0",
"scroll-behavior": "^0.9.5",
"secure-random": "1.1.1",
"selection-position": "1.0.0",
"slate": "0.16.9",
"slate-drop-or-paste-images": "0.4.1",
"slate-insert-block-on-enter": "0.0.1",
"slate": "~0.43",
"slate-drop-or-paste-images": "0.9.1",
"slate-insert-block-on-enter": "0.4.0",
"slate-react": "~0.20.1",
"slate-trailing-block": "0.2.4",
"speakingurl": "9.0.0",
"squarify": "1.1.0",
......@@ -143,9 +132,9 @@
"striptags": "^3.1.1",
"universal-cookie": "^4.0.3",
"webpack-cli": "^4.2.0",
"webpack-isomorphic-tools": "3.0.5",
"webpack-isomorphic-tools": "^4.0.0",
"whatwg-fetch": "0.11.1",
"xmldom": "0.1.27"
"xmldom": "~0.5.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
......@@ -170,20 +159,19 @@
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@storybook/addon-knobs": "3.2.19",
"@storybook/react": "3.2.19",
"assert": "1.4.1",
"@babel/register": "^7.12.1",
"@storybook/addon-knobs": "^6.3.1",
"@storybook/react": "^6.3.8",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "^23.4.2",
"babel-loader": "8.1.0",
"babel-plugin-react-intl": "2.3.1",
"babel-plugin-transform-inline-environment-variables": "0.2.0",
"co-body": "5.1.1",
"css-loader": "5.0.1",
"dev-ip": "1.0.1",
"enzyme": "3.3.0",
"enzyme-adapter-react-15": "1.0.5",
"enzyme-adapter-react-16": "1.15.6",
"eslint": "6.8.0",
"eslint-config-airbnb": "18.1.0",
"eslint-plugin-babel": "5.3.0",
......@@ -192,7 +180,7 @@
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.19.0",
"file-loader": "6.2.0",
"git-rev-sync": "1.9.1",
"git-rev-sync": "^3.0.1",
"husky": "0.14.3",
"imports-loader": "1.2.0",
"jest": "23",
......@@ -200,15 +188,14 @@
"json-loader": "0.5.7",
"koa-webpack-dev-middleware": "1.4.6",
"koa-webpack-hot-middleware": "1.0.3",
"lint-staged": "6.0.0",
"lint-staged": "10.5.3",
"mock-local-storage": "1.0.5",
"node-sass": "4.13.1",
"node-watch": "0.5.5",
"picturefill": "3.0.2",
"prettier": "1.8.2",
"prettier": "2.2.1",
"raw-loader": "4.0.2",
"react-addons-perf": "15.4.2",
"react-test-renderer": "15.6.2",
"react-test-renderer": "16.8",
"redux-devtools-extension": "2.13.5",
"redux-mock-store": "1.5.1",
"sass-loader": "10.0.5",
......@@ -219,15 +206,18 @@
"url-loader": "4.1.1",
"webpack": "4.x.x",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-dev-middleware": "1.12.0",
"webpack-livereload-plugin": "1"
"webpack-dev-middleware": "^4.0.4",
"webpack-livereload-plugin": "^3.0.2"
},
"engines": {
"node": ">=8.7.0",
"npm": ">=5.4.2"
},
"lint-staged": {
"src/**/*.js*": [
"src/**/*.+(js|jsx)": [
"eslint"
],
"src/**/*.+(json|css|md)": [
"prettier --write",
"git add"
]
......
......@@ -44,18 +44,20 @@ function loadTranslationFiles(path) {
}
function processFile(used_keys, path) {
const lines = fs.readFileSync(path, 'utf8').split(/\r?\n/);
for (const l of lines) {
const tts = l.match(/(tt\(["'.\-_\w]+)/g) || l.match(/(FormattedHTMLMessage.+id=["'.\-_\w]+)/g);
if (tts) {
// if(tts.length > 1) console.log('-- tt -->', path, l, tts.length, JSON.stringify(tts, null, 4));
for (const t of tts) {
if (t !== 'tt(id') {
const m = t.match(/tt\(['"]([.\-_\w]+)/) || t.match(/id=['"]([.\-_\w]+)['"]/);
if (!m) throw new Error('Wrong format: "' + t + '" in "' + l + '"');
const key = m[1];
if (used_keys[key]) used_keys[key] += 1;
else used_keys[key] = 1;
if (path.indexOf('min.js') === -1) {
const lines = fs.readFileSync(path, 'utf8').split(/\r?\n/);
for (const l of lines) {
const tts = l.match(/(tt\(["'.\-_\w]+)/g) || l.match(/(FormattedHTMLMessage.+id=["'.\-_\w]+)/g);
if (tts) {
// if(tts.length > 1) console.log('-- tt -->', path, l, tts.length, JSON.stringify(tts, null, 4));
for (const t of tts) {
if (t !== 'tt(id') {
const m = t.match(/tt\(['"]([.\-_\w]+)/) || t.match(/id=['"]([.\-_\w]+)['"]/);
if (!m) throw new Error('Wrong format: "' + t + '" in "' + l + '"');
const key = m[1];
if (used_keys[key]) used_keys[key] += 1;
else used_keys[key] = 1;
}
}
}
}
......
......@@ -3,17 +3,16 @@ import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'whatwg-fetch';
import store from 'store';
import { VIEW_MODE_WHISTLE, PARAM_VIEW_MODE } from 'shared/constants';
import './assets/stylesheets/app.scss';
import plugins from 'app/utils/JsPlugins';
import Iso from 'iso';
import { clientRender } from 'shared/UniversalRender';
import ConsoleExports from './utils/ConsoleExports';
import { serverApiRecordEvent } from 'app/utils/ServerApiClient';
import * as steem from '@hiveio/hive-js';
import { determineViewMode } from 'app/utils/Links';
import frontendLogger from 'app/utils/FrontendLogger';
import Cookies from 'universal-cookie';
import ConsoleExports from './utils/ConsoleExports';
window.addEventListener('error', frontendLogger);
......@@ -38,11 +37,12 @@ function runApp(initial_state) {
enabled: false,
};
const buff = konami.code.split('');