hide porn

fix missing imports
log better
This commit is contained in:
Niko Storni 2019-08-06 22:52:50 +02:00
parent 79f81d4267
commit 3e2e6afbc7
2 changed files with 37 additions and 30 deletions

View file

@ -13,6 +13,7 @@ import apiPage from "~view/api";
import fetchMetadata from "~helper/fetch-metadata"; import fetchMetadata from "~helper/fetch-metadata";
import { generateGitHubFeed } from "~helper/github"; import { generateGitHubFeed } from "~helper/github";
import messageSlack from "~helper/slack"; import messageSlack from "~helper/slack";
import { URL } from "url";
const githubAppId = process.env.GITHUB_APP_ID; const githubAppId = process.env.GITHUB_APP_ID;
const githubAppSecret = process.env.GITHUB_APP_SECRET; const githubAppSecret = process.env.GITHUB_APP_SECRET;
@ -125,6 +126,7 @@ function generateContent(exampleNumber, displayTrendingContent) {
const trendingContentData = response.data; const trendingContentData = response.data;
for (const data of trendingContentData) { for (const data of trendingContentData) {
console.log(data);
rawContentCollection.push(fetchMetadata({ rawContentCollection.push(fetchMetadata({
claim: data.url, claim: data.url,
example: exampleNumber, example: exampleNumber,
@ -132,8 +134,12 @@ function generateContent(exampleNumber, displayTrendingContent) {
})); }));
} }
Promise.all(rawContentCollection).then(collection => { Promise.all(rawContentCollection)
.then(collection => {
for (const part of collection) { for (const part of collection) {
console.log(part.value.tags);
if (part.value.tags.includes("mature"))
continue;
try { try {
renderedContentCollection.push(` renderedContentCollection.push(`
<section class="playground-content__trend"> <section class="playground-content__trend">
@ -154,6 +160,7 @@ function generateContent(exampleNumber, displayTrendingContent) {
</section> </section>
`); `);
} catch(err) { } catch(err) {
console.error(err);
return; // TODO: Return nice error message return; // TODO: Return nice error message
} }
} }

View file

@ -11,12 +11,12 @@
"author": "LBRY Team", "author": "LBRY Team",
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.4.4", "@babel/polyfill": "^7.4.4",
"@inc/fastify-ws": "^1.1.0", "@inc/fastify-ws": "^2019.7.23",
"@octokit/rest": "^16.28.3", "@octokit/rest": "^16.28.7",
"@slack/client": "^5.0.1", "@slack/client": "^5.0.2",
"async": "^3.1.0", "async": "^3.1.0",
"async-es": "^3.1.0", "async-es": "^3.1.0",
"choo": "^6.13.3", "choo": "6.13.3",
"choo-async": "^0.1.1", "choo-async": "^0.1.1",
"choo-devtools": "^3.0.0", "choo-devtools": "^3.0.0",
"choo-ssr": "^0.2.1", "choo-ssr": "^0.2.1",
@ -28,19 +28,19 @@
"decamelize": "^3.2.0", "decamelize": "^3.2.0",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"dotenv": "^8.0.0", "dotenv": "^8.0.0",
"fastify": "~2.6.0", "fastify": "~2.7.1",
"fastify-compress": "^0.10.0", "fastify-compress": "^0.10.0",
"fastify-helmet": "^3.0.1", "fastify-helmet": "^3.0.1",
"fastify-static": "^2.5.0", "fastify-static": "^2.5.0",
"front-matter": "^3.0.2", "front-matter": "^3.0.2",
"fs-exists-sync": "^0.1.0", "fs-exists-sync": "^0.1.0",
"got": "^9.6.0", "got": "^9.6.0",
"graceful-fs": "^4.2.0", "graceful-fs": "^4.2.1",
"link-module-alias": "^1.2.0", "link-module-alias": "^1.2.0",
"make-promises-safe": "^5.0.0", "make-promises-safe": "^5.0.0",
"markdown-it": "^9.0.0", "markdown-it": "^9.0.1",
"markdown-it-anchor": "^5.2.4", "markdown-it-anchor": "^5.2.4",
"prismjs": "^1.15.0", "prismjs": "^1.17.1",
"redis": "^2.8.0", "redis": "^2.8.0",
"slack-node": "^0.1.8", "slack-node": "^0.1.8",
"socket.io": "^2.2.0", "socket.io": "^2.2.0",
@ -48,10 +48,10 @@
}, },
"description": "Documentation for the LBRY protocol and associated projects", "description": "Documentation for the LBRY protocol and associated projects",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.5.0", "@babel/cli": "^7.5.5",
"@babel/core": "^7.5.4", "@babel/core": "^7.5.5",
"@babel/plugin-external-helpers": "7.2.0", "@babel/plugin-external-helpers": "7.2.0",
"@babel/plugin-proposal-class-properties": "7.5.0", "@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/plugin-proposal-decorators": "7.4.4", "@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-export-namespace-from": "7.5.2", "@babel/plugin-proposal-export-namespace-from": "7.5.2",
"@babel/plugin-proposal-function-sent": "7.5.0", "@babel/plugin-proposal-function-sent": "7.5.0",
@ -60,22 +60,22 @@
"@babel/plugin-proposal-throw-expressions": "7.2.0", "@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0", "@babel/plugin-syntax-import-meta": "7.2.0",
"@babel/preset-env": "^7.5.4", "@babel/preset-env": "^7.5.5",
"@babel/register": "^7.4.4", "@babel/register": "^7.5.5",
"@inc/eslint-config": "^2019.7.11", "@inc/eslint-config": "^2019.7.23",
"@inc/sasslint-config": "^2019.6.22", "@inc/sasslint-config": "^2019.7.23",
"@lbry/color": "^1.1.1", "@lbry/color": "^1.1.1",
"@lbry/components": "^2.7.4", "@lbry/components": "^2019.6.22",
"eslint": "^6.0.1", "eslint": "^6.1.0",
"husky": "^3.0.0", "husky": "^3.0.2",
"nodemon": "^1.19.1", "nodemon": "^1.19.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"pino-pretty": "^3.2.0", "pino-pretty": "^3.2.0",
"sass": "^1.22.3", "sass": "^1.22.9",
"sass-lint": "^1.13.1", "sass-lint": "^1.13.1",
"snazzy": "^8.0.0", "snazzy": "^8.0.0",
"standardx": "^4.0.0", "standardx": "^4.0.0",
"updates": "^8.2.1" "updates": "^8.5.1"
}, },
"engines": { "engines": {
"node": "10.2.x" "node": "10.2.x"