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 { generateGitHubFeed } from "~helper/github";
import messageSlack from "~helper/slack";
import { URL } from "url";
const githubAppId = process.env.GITHUB_APP_ID;
const githubAppSecret = process.env.GITHUB_APP_SECRET;
@ -125,6 +126,7 @@ function generateContent(exampleNumber, displayTrendingContent) {
const trendingContentData = response.data;
for (const data of trendingContentData) {
console.log(data);
rawContentCollection.push(fetchMetadata({
claim: data.url,
example: exampleNumber,
@ -132,10 +134,14 @@ function generateContent(exampleNumber, displayTrendingContent) {
}));
}
Promise.all(rawContentCollection).then(collection => {
for (const part of collection) {
try {
renderedContentCollection.push(`
Promise.all(rawContentCollection)
.then(collection => {
for (const part of collection) {
console.log(part.value.tags);
if (part.value.tags.includes("mature"))
continue;
try {
renderedContentCollection.push(`
<section class="playground-content__trend">
<figure
class="media__thumb"
@ -153,19 +159,20 @@ function generateContent(exampleNumber, displayTrendingContent) {
</div>
</section>
`);
} catch(err) {
return; // TODO: Return nice error message
} catch(err) {
console.error(err);
return; // TODO: Return nice error message
}
}
}
renderedContentCollection.push(`
renderedContentCollection.push(`
<script>
document.getElementById("playground-example-description").innerHTML = document.querySelector("[data-action='playground, example 1']").dataset.description
</script>
`);
displayTrendingContent(renderedContentCollection.join(""));
});
displayTrendingContent(renderedContentCollection.join(""));
});
});
}

View file

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