Skip to content

Commit

Permalink
Merge pull request #2361 from botpress/patch/12-1-4
Browse files Browse the repository at this point in the history
Patch 12.1.4
  • Loading branch information
slvnperron committed Sep 19, 2019
2 parents 50bcc37 + 2633910 commit ebed393
Show file tree
Hide file tree
Showing 384 changed files with 11,127 additions and 2,872 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/code/validate-docs/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
events {
}

http {

include mime.types;

server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
}
}
}
38 changes: 38 additions & 0 deletions .github/workflows/code/validate-docs/spider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import scrapy


class BrokenLinksSpider(scrapy.Spider):
"""
Finds broken links on your website
Source: https://gist.github.com/mdamien/7b71ef06f49de1189fb75f8fed91ae82
"""
name = 'brokenlink-checker'


def __init__(self, site, *args, **kwargs):
super().__init__(*args, **kwargs)
self.start_urls = [site]
self.DOMAIN = site.split('//')[1]


def parse(self, response):
if response.status in (404, 500):
item = {}
item['url'] = response.url
item['prev_page'] = response.meta['prev_url']
item['prev_link_url'] = response.meta['prev_href']
item['prev_link_text'] = response.meta['prev_link_text']
item['status'] = response.status

yield item

if self.DOMAIN in response.url:
for link in response.css('a'):
href = link.xpath('@href').extract()
text = link.xpath('text()').extract()
if href:
yield response.follow(link, self.parse, meta={
'prev_link_text': text,
'prev_href': href,
'prev_url': response.url,
})
15 changes: 15 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Codestyle
on: [push]
jobs:
run_prettier:
name: Run Prettier on codebase
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Install Dependencies
run: |
yarn
- name: Run Prettier
run: |
./node_modules/prettier/bin-prettier.js --check '{src,modules}/**/*.ts' '!**/*.d.ts'
41 changes: 41 additions & 0 deletions .github/workflows/validate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Validate documentation
on: [push]
jobs:
check_404s:
name: Check for 404 errors in docs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Install NGINX
run: |
sudo apt-get update
sudo apt-get install nginx
mkdir -p /etc/nginx
sudo cp .github/workflows/code/validate-docs/nginx.conf /etc/nginx/
- name: Build docs
working-directory: docs/guide/website
run: |
yarn
yarn build
sudo cp -a build/botpress-docs/. /usr/share/nginx/html/
- name: Start NGINX
run: |
sudo service nginx restart
- name: Install python3
uses: actions/setup-python@v1
with:
python-version: '3.x'
architecture: 'x64'
- name: Scrape docs for 404s
run: |
pip install scrapy
scrapy runspider -o errors.csv -a site="http://localhost" .github/workflows/code/validate-docs/spider.py -s HTTPERROR_ALLOW_ALL=True -s LOG_LEVEL=INFO
- name: Check scrape results
run: |
ERRORS_COUNT=$(cat errors.csv | wc -l)
echo "Found $ERRORS_COUNT errors"
cat errors.csv
if [ "$ERRORS_COUNT" != "0" ]; then
exit 1
fi
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
## [12.1.4](https://github.com/botpress/botpress/compare/v12.1.3...v12.1.4) (2019-09-19)


### Bug Fixes

* **bpfs:** fixed issues caused by legacy logic ([fa89276](https://github.com/botpress/botpress/commit/fa89276))
* **bpfs:** various fixes due to legacy logic ([4108970](https://github.com/botpress/botpress/commit/4108970))
* **channel-web:** re-added google analytics ([0fe8fce](https://github.com/botpress/botpress/commit/0fe8fce))
* **channel-web:** re-added google analytics ([17e7eab](https://github.com/botpress/botpress/commit/17e7eab))
* **cluster:** broadcasting reboot to all nodes ([decd505](https://github.com/botpress/botpress/commit/decd505))
* **cluster:** broadcasting reboot to all nodes ([473735f](https://github.com/botpress/botpress/commit/473735f))
* **config:** clear hash on first start & ignore dynamic props ([5b351cb](https://github.com/botpress/botpress/commit/5b351cb))
* **config:** clear hash on first start & ignore dynamic props ([7d8d5b7](https://github.com/botpress/botpress/commit/7d8d5b7))
* **core:** added multi-thread support for heavy tasks ([d2b30e4](https://github.com/botpress/botpress/commit/d2b30e4))
* **debugger:** a bit more compact nlu debugger ([33b30c0](https://github.com/botpress/botpress/commit/33b30c0))
* **debugger:** minor ajustment ([2957057](https://github.com/botpress/botpress/commit/2957057))
* **debugger:** minor ajustment ([adf139d](https://github.com/botpress/botpress/commit/adf139d))
* **dialog:** timeout handling ([077f33c](https://github.com/botpress/botpress/commit/077f33c))
* **dialog:** timeout handling ([1b2fa60](https://github.com/botpress/botpress/commit/1b2fa60))
* **inspector:** ambuigity more visible ([61cfe2f](https://github.com/botpress/botpress/commit/61cfe2f))
* **lock:** allowing upsert to bypass locked status ([3489516](https://github.com/botpress/botpress/commit/3489516))
* **lock:** allowing upsert to bypass locked status ([5964178](https://github.com/botpress/botpress/commit/5964178))
* **logs:** fixed log emitter ([1d6f191](https://github.com/botpress/botpress/commit/1d6f191))
* **logs:** fixed log emitter ([63b7343](https://github.com/botpress/botpress/commit/63b7343))
* **nlu:** fix progress issue with auto train ([2734994](https://github.com/botpress/botpress/commit/2734994))
* **nlu:** fix progress issue with auto train ([e11cb38](https://github.com/botpress/botpress/commit/e11cb38))
* **nlu:** prevent training on not supported languages ([15cd631](https://github.com/botpress/botpress/commit/15cd631))
* **nlu:** removed jap tokenizer ([f940d14](https://github.com/botpress/botpress/commit/f940d14))
* **nlu:** using multiple threads for training ([69822fe](https://github.com/botpress/botpress/commit/69822fe))
* **qna:** source categories from nlu contexts ([cb261eb](https://github.com/botpress/botpress/commit/cb261eb))
* **qna:** updated tests and minor tweak ([59aff43](https://github.com/botpress/botpress/commit/59aff43))
* **qna:** updated tests and minor tweak ([dff8ae3](https://github.com/botpress/botpress/commit/dff8ae3))
* **rbac:** content editor access to nlu/qna ([58291b0](https://github.com/botpress/botpress/commit/58291b0))
* **redis:** prevent server spamming on startup ([ba9dba1](https://github.com/botpress/botpress/commit/ba9dba1))
* **redis:** prevent server spamming on startup ([70d29d3](https://github.com/botpress/botpress/commit/70d29d3))
* **studio:** dm title in emulator ([87cc95b](https://github.com/botpress/botpress/commit/87cc95b))
* **studio:** fix logs panel ([97209a5](https://github.com/botpress/botpress/commit/97209a5))
* **studio:** minor sidebar icons styling fix ([dfdc479](https://github.com/botpress/botpress/commit/dfdc479))
* **webchat:** escape unsafe html ([40bf2d7](https://github.com/botpress/botpress/commit/40bf2d7))


### Features

* **auth:** added oauth2 strategy ([dc7e690](https://github.com/botpress/botpress/commit/dc7e690))
* **bpfs:** workaround to fix bpfs issues ([abd4bd0](https://github.com/botpress/botpress/commit/abd4bd0))
* **bpfs:** workaround to fix bpfs issues ([f316327](https://github.com/botpress/botpress/commit/f316327))
* **config:** prompt server reboot when configuration is updated ([dedaf3d](https://github.com/botpress/botpress/commit/dedaf3d))
* **core:** added config to add extra languages ([43cc081](https://github.com/botpress/botpress/commit/43cc081))
* **core:** prompt server reboot when main config has changed ([1950602](https://github.com/botpress/botpress/commit/1950602))
* **debugger:** added language section ([9f5e253](https://github.com/botpress/botpress/commit/9f5e253))
* **inspector:** copy path to clipboard ([be8cdd1](https://github.com/botpress/botpress/commit/be8cdd1))
* **qna:** added support for content elements ([e32df0a](https://github.com/botpress/botpress/commit/e32df0a))
* **qna:** Added support for elements from the CMS ([7a27aba](https://github.com/botpress/botpress/commit/7a27aba))
* **studio:** added util components & change to cms ([0433724](https://github.com/botpress/botpress/commit/0433724))
* **studio:** added util components & change to cms ([0b7b059](https://github.com/botpress/botpress/commit/0b7b059))



## [12.1.3](https://github.com/botpress/botpress/compare/v12.1.1...v12.1.3) (2019-09-04)


Expand Down
7 changes: 7 additions & 0 deletions api.rest
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ text=hello how are you today
&reftime={{$datetime "xx"}}
&tz=America/Toronto


### Reboot server
POST {{baseUrl}}/api/v1/admin/server/rebootServer
Authorization: Bearer {{authToken}}
X-BP-Workspace: default


### Test Lang Server
GET https://lang-01.botpress.io/info

Expand Down
83 changes: 83 additions & 0 deletions batch-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env TS_NODE_COMPILER_OPTIONS={"downlevelIteration":true} ts-node

import chalk from 'chalk'
import * as cp from 'child_process'
import * as fs from 'fs'
import * as fse from 'fs-extra'
import * as glob from 'glob'
import * as path from 'path'

const IS_DRY_RUN = !process.argv.includes('--apply')
const files = glob.sync('**/package.json', { ignore: ['**/node_modules/**', 'examples/**'] })

function* amendFiles(yarnInstall: boolean) {
let count = 0
for (const file of files) {
const content = fse.readJsonSync(file)
if (content && content.author && content.author.toLowerCase().includes('botpress')) {
let save = false
const saveFn = () => (save = true)
yield [content, file, saveFn]
if (!save) {
console.log(chalk.grey(`Skipping ${file} (no changes)`))
continue
}

count++

if (IS_DRY_RUN) {
console.log(chalk.bold(`==> File ${chalk.bold(file)} has changes (DRY RUN)`))
} else {
console.log(chalk.bold(`==> Applying changes to ${chalk.bold(file)}`))
fse.writeJsonSync(file, content, { spaces: 2 })
}

if (!IS_DRY_RUN && yarnInstall) {
console.log(chalk.grey(`==> yarn install --force`))
try {
cp.execSync('yarn install --force', {
env: process.env,
cwd: path.dirname(file),
stdio: [
0, // Use parent's stdin for child.
'ignore', // Pipe child's stdout to parent.
fs.openSync('err.out', 'w') // Direct child's stderr to a file.
]
})
console.log(chalk.green(` success`))
} catch (err) {
console.error(chalk.red(`==> ERROR running yarn install (see err.out)`))
}
}
}
}

console.log(chalk.bold(`Done processing ${files.length} files`))

if (count > 0) {
console.log(chalk.green(`Changed ${chalk.bold(count.toString())} files successfully`))
if (IS_DRY_RUN) {
console.log(chalk.red.bold(`THIS WAS A DRY RUN, SO NO FILE WAS ACTUALLY CHANGED`))
console.log(chalk.red(`Run this again with ${chalk.bold('--apply')} to execute the changes`))
}
} else {
console.log(chalk.green('There are no changes'))
}
}

/**
* Content : package.json content
* file: file name
* save: function to be called if you want to apply changes
*
* Amend the content to of the package.json as you please and call save if necessary
*/
for (const [content, file, save] of amendFiles(true)) {
// fstream vulnerability CVE-2019-13173
if (!content.resolutions || !content.resolutions.fstream) {
content.resolutions = Object.assign({}, content.resolutions, {
fstream: '>=1.0.12'
})
save()
}
}
3 changes: 3 additions & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
},
"dependencies": {
"artillery": "^1.6.0-25"
},
"resolutions": {
"fstream": ">=1.0.12"
}
}

0 comments on commit ebed393

Please sign in to comment.