diff --git a/assets/js/networks/actions.js b/assets/js/networks/actions.js index 8e42949e..c2887059 100644 --- a/assets/js/networks/actions.js +++ b/assets/js/networks/actions.js @@ -1,5 +1,6 @@ import { graphql } from '../api'; -import { sitesFragment, releaseFields } from '../fragments'; +// import { sitesFragment, releaseFields } from '../fragments'; +import { releaseFields } from '../fragments'; import { curateNetwork } from '../curate'; import getDateRange from '../get-date-range'; @@ -24,45 +25,19 @@ function initNetworksActions(store, _router) { $orderBy: [ReleasesOrderBy!] $exclude: [String!] ) { - network: networkBySlug(slug: $networkSlug) { + network: entityBySlugAndType(slug: $networkSlug, type: 1) { id name slug url - networks: childNetworks( - orderBy: NAME_ASC, - ) { - id - name - slug - url - } - sites( + sites: childEntities( orderBy: [PRIORITY_DESC, NAME_ASC], - filter: { - show: { - equalTo: true, - }, - }, ) { id name slug url - independent priority - network { - id - name - slug - url - } - } - studios { - id - name - slug - url } parent { id @@ -137,12 +112,18 @@ function initNetworksActions(store, _router) { async function fetchNetworks({ _commit }) { const { networks } = await graphql(` query Networks { - networks(orderBy: NAME_ASC) { + networks: entities( + orderBy: NAME_ASC + filter: { + type: { + equalTo: 1 + } + } + ) { id name slug url - ${sitesFragment} } } `); diff --git a/migrations/20190325001339_releases.js b/migrations/20190325001339_releases.js index 174dccd8..affae9a6 100644 --- a/migrations/20190325001339_releases.js +++ b/migrations/20190325001339_releases.js @@ -148,6 +148,7 @@ exports.up = knex => Promise.resolve() { type: 'network' }, { type: 'channel' }, { type: 'studio' }, + { type: 'info' }, ])) .then(() => knex.schema.createTable('entities', (table) => { table.increments('id', 12); @@ -156,14 +157,16 @@ exports.up = knex => Promise.resolve() .references('id') .inTable('entities'); + table.text('name'); + table.text('slug', 32); + table.integer('type', 4) .references('id') .inTable('entities_types') .defaultTo(2); - table.text('name'); - table.text('slug', 32) - .unique(); + table.unique(['slug', 'type']); + table.text('alias'); table.text('url'); diff --git a/public/img/logos/21sextury/misc/lusty-busty-chix_header.png b/public/img/logos/21sextury/misc/lusty-busty-chix_header.png new file mode 100644 index 00000000..5556c7b9 Binary files /dev/null and b/public/img/logos/21sextury/misc/lusty-busty-chix_header.png differ diff --git a/public/img/logos/porncom/misc/network.svg b/public/img/logos/porncom/misc/network.svg new file mode 100644 index 00000000..b9b758cb --- /dev/null +++ b/public/img/logos/porncom/misc/network.svg @@ -0,0 +1 @@ + diff --git a/public/img/logos/porncom/network.png b/public/img/logos/porncom/network.png new file mode 100644 index 00000000..a9808f82 Binary files /dev/null and b/public/img/logos/porncom/network.png differ diff --git a/public/img/logos/pornpros/deepthroatlove.png b/public/img/logos/pornpros/deepthroatlove.png index 1278a651..0a5c6238 100644 Binary files a/public/img/logos/pornpros/deepthroatlove.png and b/public/img/logos/pornpros/deepthroatlove.png differ diff --git a/public/img/logos/pornpros/misc/deep-throat-love.png b/public/img/logos/pornpros/misc/deep-throat-love.png new file mode 100644 index 00000000..4a2ed3cd Binary files /dev/null and b/public/img/logos/pornpros/misc/deep-throat-love.png differ diff --git a/public/img/logos/teencoreclub/analcheckups.png b/public/img/logos/teencoreclub/analcheckups.png new file mode 100644 index 00000000..abd3944e Binary files /dev/null and b/public/img/logos/teencoreclub/analcheckups.png differ diff --git a/public/img/logos/teencoreclub/analyzedgirls.png b/public/img/logos/teencoreclub/analyzedgirls.png new file mode 100644 index 00000000..da60e7e0 Binary files /dev/null and b/public/img/logos/teencoreclub/analyzedgirls.png differ diff --git a/public/img/logos/teencoreclub/assteenmouth.png b/public/img/logos/teencoreclub/assteenmouth.png new file mode 100644 index 00000000..63e5600e Binary files /dev/null and b/public/img/logos/teencoreclub/assteenmouth.png differ diff --git a/public/img/logos/teencoreclub/bangteenpussy.png b/public/img/logos/teencoreclub/bangteenpussy.png new file mode 100644 index 00000000..15387f87 Binary files /dev/null and b/public/img/logos/teencoreclub/bangteenpussy.png differ diff --git a/public/img/logos/teencoreclub/brutalinvasion.png b/public/img/logos/teencoreclub/brutalinvasion.png new file mode 100644 index 00000000..0c959cad Binary files /dev/null and b/public/img/logos/teencoreclub/brutalinvasion.png differ diff --git a/public/img/logos/teencoreclub/cumaholicteens.png b/public/img/logos/teencoreclub/cumaholicteens.png new file mode 100644 index 00000000..e5700d33 Binary files /dev/null and b/public/img/logos/teencoreclub/cumaholicteens.png differ diff --git a/public/img/logos/teencoreclub/defiled18.png b/public/img/logos/teencoreclub/defiled18.png new file mode 100644 index 00000000..65e1a4ae Binary files /dev/null and b/public/img/logos/teencoreclub/defiled18.png differ diff --git a/public/img/logos/teencoreclub/doubleteamedteens.png b/public/img/logos/teencoreclub/doubleteamedteens.png new file mode 100644 index 00000000..33f0a47e Binary files /dev/null and b/public/img/logos/teencoreclub/doubleteamedteens.png differ diff --git a/public/img/logos/teencoreclub/dreamshd.png b/public/img/logos/teencoreclub/dreamshd.png new file mode 100644 index 00000000..48856633 Binary files /dev/null and b/public/img/logos/teencoreclub/dreamshd.png differ diff --git a/public/img/logos/teencoreclub/drilledchicks.png b/public/img/logos/teencoreclub/drilledchicks.png new file mode 100644 index 00000000..fc3e20f7 Binary files /dev/null and b/public/img/logos/teencoreclub/drilledchicks.png differ diff --git a/public/img/logos/teencoreclub/fabsluts.png b/public/img/logos/teencoreclub/fabsluts.png new file mode 100644 index 00000000..4b33948d Binary files /dev/null and b/public/img/logos/teencoreclub/fabsluts.png differ diff --git a/public/img/logos/teencoreclub/girlsgotcream.png b/public/img/logos/teencoreclub/girlsgotcream.png new file mode 100644 index 00000000..7ac7e55e Binary files /dev/null and b/public/img/logos/teencoreclub/girlsgotcream.png differ diff --git a/public/img/logos/teencoreclub/hardcoreyouth.png b/public/img/logos/teencoreclub/hardcoreyouth.png new file mode 100644 index 00000000..d70f742b Binary files /dev/null and b/public/img/logos/teencoreclub/hardcoreyouth.png differ diff --git a/public/img/logos/teencoreclub/jerkoffpass.png b/public/img/logos/teencoreclub/jerkoffpass.png new file mode 100644 index 00000000..a960037a Binary files /dev/null and b/public/img/logos/teencoreclub/jerkoffpass.png differ diff --git a/public/img/logos/teencoreclub/lazy/analcheckup.png b/public/img/logos/teencoreclub/lazy/analcheckup.png new file mode 100644 index 00000000..3c55ad13 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/analcheckup.png differ diff --git a/public/img/logos/teencoreclub/lazy/analcheckups.png b/public/img/logos/teencoreclub/lazy/analcheckups.png new file mode 100644 index 00000000..0d51dc36 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/analcheckups.png differ diff --git a/public/img/logos/teencoreclub/lazy/analyzedgirls.png b/public/img/logos/teencoreclub/lazy/analyzedgirls.png new file mode 100644 index 00000000..8ad99371 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/analyzedgirls.png differ diff --git a/public/img/logos/teencoreclub/lazy/assteenmouth.png b/public/img/logos/teencoreclub/lazy/assteenmouth.png new file mode 100644 index 00000000..b79c235a Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/assteenmouth.png differ diff --git a/public/img/logos/teencoreclub/lazy/bangteenpussy.png b/public/img/logos/teencoreclub/lazy/bangteenpussy.png new file mode 100644 index 00000000..1a31fb3e Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/bangteenpussy.png differ diff --git a/public/img/logos/teencoreclub/lazy/brutalinvasion.png b/public/img/logos/teencoreclub/lazy/brutalinvasion.png new file mode 100644 index 00000000..901d1a09 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/brutalinvasion.png differ diff --git a/public/img/logos/teencoreclub/lazy/cumaholicteens.png b/public/img/logos/teencoreclub/lazy/cumaholicteens.png new file mode 100644 index 00000000..9bc2d1ea Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/cumaholicteens.png differ diff --git a/public/img/logos/teencoreclub/lazy/defiled18.png b/public/img/logos/teencoreclub/lazy/defiled18.png new file mode 100644 index 00000000..95df21dc Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/defiled18.png differ diff --git a/public/img/logos/teencoreclub/lazy/doubleteamedteens.png b/public/img/logos/teencoreclub/lazy/doubleteamedteens.png new file mode 100644 index 00000000..56c5be53 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/doubleteamedteens.png differ diff --git a/public/img/logos/teencoreclub/lazy/dreamshd.png b/public/img/logos/teencoreclub/lazy/dreamshd.png new file mode 100644 index 00000000..55421bcf Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/dreamshd.png differ diff --git a/public/img/logos/teencoreclub/lazy/drilledchicks.png b/public/img/logos/teencoreclub/lazy/drilledchicks.png new file mode 100644 index 00000000..c980d928 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/drilledchicks.png differ diff --git a/public/img/logos/teencoreclub/lazy/fabsluts.png b/public/img/logos/teencoreclub/lazy/fabsluts.png new file mode 100644 index 00000000..157a18e4 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/fabsluts.png differ diff --git a/public/img/logos/teencoreclub/lazy/girlsgotcream.png b/public/img/logos/teencoreclub/lazy/girlsgotcream.png new file mode 100644 index 00000000..1f95aac7 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/girlsgotcream.png differ diff --git a/public/img/logos/teencoreclub/lazy/hardcoreyouth.png b/public/img/logos/teencoreclub/lazy/hardcoreyouth.png new file mode 100644 index 00000000..674fc07f Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/hardcoreyouth.png differ diff --git a/public/img/logos/teencoreclub/lazy/jerkoffpass.png b/public/img/logos/teencoreclub/lazy/jerkoffpass.png new file mode 100644 index 00000000..978bcd6b Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/jerkoffpass.png differ diff --git a/public/img/logos/teencoreclub/lazy/letsgodirty.png b/public/img/logos/teencoreclub/lazy/letsgodirty.png new file mode 100644 index 00000000..466de442 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/letsgodirty.png differ diff --git a/public/img/logos/teencoreclub/lazy/littlehellcat.png b/public/img/logos/teencoreclub/lazy/littlehellcat.png new file mode 100644 index 00000000..7c866f68 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/littlehellcat.png differ diff --git a/public/img/logos/teencoreclub/lazy/logo_color.png b/public/img/logos/teencoreclub/lazy/logo_color.png new file mode 100644 index 00000000..62ae6038 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/logo_color.png differ diff --git a/public/img/logos/teencoreclub/lazy/maketeengape.png b/public/img/logos/teencoreclub/lazy/maketeengape.png new file mode 100644 index 00000000..5078c996 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/maketeengape.png differ diff --git a/public/img/logos/teencoreclub/lazy/network.png b/public/img/logos/teencoreclub/lazy/network.png new file mode 100644 index 00000000..028c32fc Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/network.png differ diff --git a/public/img/logos/teencoreclub/lazy/nightclub.png b/public/img/logos/teencoreclub/lazy/nightclub.png new file mode 100644 index 00000000..6629c99d Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/nightclub.png differ diff --git a/public/img/logos/teencoreclub/lazy/nightclublive.png b/public/img/logos/teencoreclub/lazy/nightclublive.png new file mode 100644 index 00000000..a378bb2f Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/nightclublive.png differ diff --git a/public/img/logos/teencoreclub/lazy/nylonspunkjunkies.png b/public/img/logos/teencoreclub/lazy/nylonspunkjunkies.png new file mode 100644 index 00000000..ace457c1 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/nylonspunkjunkies.png differ diff --git a/public/img/logos/teencoreclub/lazy/nylonsweeties.png b/public/img/logos/teencoreclub/lazy/nylonsweeties.png new file mode 100644 index 00000000..f8b1ef7c Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/nylonsweeties.png differ diff --git a/public/img/logos/teencoreclub/lazy/seductive18.png b/public/img/logos/teencoreclub/lazy/seductive18.png new file mode 100644 index 00000000..c21bc0c0 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/seductive18.png differ diff --git a/public/img/logos/teencoreclub/lazy/shegotsix.png b/public/img/logos/teencoreclub/lazy/shegotsix.png new file mode 100644 index 00000000..28e457b4 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/shegotsix.png differ diff --git a/public/img/logos/teencoreclub/lazy/spearteenlpussy.png b/public/img/logos/teencoreclub/lazy/spearteenlpussy.png new file mode 100644 index 00000000..b46a1e19 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/spearteenlpussy.png differ diff --git a/public/img/logos/teencoreclub/lazy/spearteenpussy.png b/public/img/logos/teencoreclub/lazy/spearteenpussy.png new file mode 100644 index 00000000..451b0a0e Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/spearteenpussy.png differ diff --git a/public/img/logos/teencoreclub/lazy/spermantino.png b/public/img/logos/teencoreclub/lazy/spermantino.png new file mode 100644 index 00000000..b627f6a1 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/spermantino.png differ diff --git a/public/img/logos/teencoreclub/lazy/spermatino.png b/public/img/logos/teencoreclub/lazy/spermatino.png new file mode 100644 index 00000000..26cfa291 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/spermatino.png differ diff --git a/public/img/logos/teencoreclub/lazy/teachmyass.png b/public/img/logos/teencoreclub/lazy/teachmyass.png new file mode 100644 index 00000000..10d980d0 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teachmyass.png differ diff --git a/public/img/logos/teencoreclub/lazy/teenanalcasting.png b/public/img/logos/teencoreclub/lazy/teenanalcasting.png new file mode 100644 index 00000000..7ccea37c Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teenanalcasting.png differ diff --git a/public/img/logos/teencoreclub/lazy/teencoreclub.png b/public/img/logos/teencoreclub/lazy/teencoreclub.png new file mode 100644 index 00000000..84902b9c Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teencoreclub.png differ diff --git a/public/img/logos/teencoreclub/lazy/teencorezine.png b/public/img/logos/teencoreclub/lazy/teencorezine.png new file mode 100644 index 00000000..b5126b90 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teencorezine.png differ diff --git a/public/img/logos/teencoreclub/lazy/teendrillers.png b/public/img/logos/teencoreclub/lazy/teendrillers.png new file mode 100644 index 00000000..58d2f1a0 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teendrillers.png differ diff --git a/public/img/logos/teencoreclub/lazy/teensgoporn.png b/public/img/logos/teencoreclub/lazy/teensgoporn.png new file mode 100644 index 00000000..b971f81b Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teensgoporn.png differ diff --git a/public/img/logos/teencoreclub/lazy/teensnaturalway.png b/public/img/logos/teencoreclub/lazy/teensnaturalway.png new file mode 100644 index 00000000..1b78f8a4 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teensnaturalway.png differ diff --git a/public/img/logos/teencoreclub/lazy/teenstryblacks.png b/public/img/logos/teencoreclub/lazy/teenstryblacks.png new file mode 100644 index 00000000..fceac897 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/teenstryblacks.png differ diff --git a/public/img/logos/teencoreclub/lazy/weneednewtalents.png b/public/img/logos/teencoreclub/lazy/weneednewtalents.png new file mode 100644 index 00000000..6bb9370d Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/weneednewtalents.png differ diff --git a/public/img/logos/teencoreclub/lazy/xcoreclub.png b/public/img/logos/teencoreclub/lazy/xcoreclub.png new file mode 100644 index 00000000..dcf4eaf0 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/xcoreclub.png differ diff --git a/public/img/logos/teencoreclub/lazy/youngthroats.png b/public/img/logos/teencoreclub/lazy/youngthroats.png new file mode 100644 index 00000000..8c0015e5 Binary files /dev/null and b/public/img/logos/teencoreclub/lazy/youngthroats.png differ diff --git a/public/img/logos/teencoreclub/letsgodirty.png b/public/img/logos/teencoreclub/letsgodirty.png new file mode 100644 index 00000000..4fe782f2 Binary files /dev/null and b/public/img/logos/teencoreclub/letsgodirty.png differ diff --git a/public/img/logos/teencoreclub/littlehellcat.png b/public/img/logos/teencoreclub/littlehellcat.png new file mode 100644 index 00000000..e661c27b Binary files /dev/null and b/public/img/logos/teencoreclub/littlehellcat.png differ diff --git a/public/img/logos/teencoreclub/logo_color.png b/public/img/logos/teencoreclub/logo_color.png new file mode 100644 index 00000000..0f3dae06 Binary files /dev/null and b/public/img/logos/teencoreclub/logo_color.png differ diff --git a/public/img/logos/teencoreclub/maketeengape.png b/public/img/logos/teencoreclub/maketeengape.png new file mode 100644 index 00000000..0ce4ffd0 Binary files /dev/null and b/public/img/logos/teencoreclub/maketeengape.png differ diff --git a/public/img/logos/teencoreclub/network.png b/public/img/logos/teencoreclub/network.png new file mode 100644 index 00000000..81e9d9cf Binary files /dev/null and b/public/img/logos/teencoreclub/network.png differ diff --git a/public/img/logos/teencoreclub/nightclub.png b/public/img/logos/teencoreclub/nightclub.png new file mode 100644 index 00000000..f5c85adf Binary files /dev/null and b/public/img/logos/teencoreclub/nightclub.png differ diff --git a/public/img/logos/teencoreclub/nightclublive.png b/public/img/logos/teencoreclub/nightclublive.png new file mode 100644 index 00000000..6a1433ce Binary files /dev/null and b/public/img/logos/teencoreclub/nightclublive.png differ diff --git a/public/img/logos/teencoreclub/nylonspunkjunkies.png b/public/img/logos/teencoreclub/nylonspunkjunkies.png new file mode 100644 index 00000000..cf58fdb3 Binary files /dev/null and b/public/img/logos/teencoreclub/nylonspunkjunkies.png differ diff --git a/public/img/logos/teencoreclub/nylonsweeties.png b/public/img/logos/teencoreclub/nylonsweeties.png new file mode 100644 index 00000000..7f27af0f Binary files /dev/null and b/public/img/logos/teencoreclub/nylonsweeties.png differ diff --git a/public/img/logos/teencoreclub/seductive18.png b/public/img/logos/teencoreclub/seductive18.png new file mode 100644 index 00000000..d1ba2229 Binary files /dev/null and b/public/img/logos/teencoreclub/seductive18.png differ diff --git a/public/img/logos/teencoreclub/shegotsix.png b/public/img/logos/teencoreclub/shegotsix.png new file mode 100644 index 00000000..82399827 Binary files /dev/null and b/public/img/logos/teencoreclub/shegotsix.png differ diff --git a/public/img/logos/teencoreclub/spearteenpussy.png b/public/img/logos/teencoreclub/spearteenpussy.png new file mode 100644 index 00000000..6f0d2697 Binary files /dev/null and b/public/img/logos/teencoreclub/spearteenpussy.png differ diff --git a/public/img/logos/teencoreclub/spermantino.png b/public/img/logos/teencoreclub/spermantino.png new file mode 100644 index 00000000..937ae59e Binary files /dev/null and b/public/img/logos/teencoreclub/spermantino.png differ diff --git a/public/img/logos/teencoreclub/teachmyass.png b/public/img/logos/teencoreclub/teachmyass.png new file mode 100644 index 00000000..366b25b4 Binary files /dev/null and b/public/img/logos/teencoreclub/teachmyass.png differ diff --git a/public/img/logos/teencoreclub/teenanalcasting.png b/public/img/logos/teencoreclub/teenanalcasting.png new file mode 100644 index 00000000..62301ca0 Binary files /dev/null and b/public/img/logos/teencoreclub/teenanalcasting.png differ diff --git a/public/img/logos/teencoreclub/teencoreclub.png b/public/img/logos/teencoreclub/teencoreclub.png new file mode 100644 index 00000000..81e9d9cf Binary files /dev/null and b/public/img/logos/teencoreclub/teencoreclub.png differ diff --git a/public/img/logos/teencoreclub/teencorezine.png b/public/img/logos/teencoreclub/teencorezine.png new file mode 100644 index 00000000..7d21454c Binary files /dev/null and b/public/img/logos/teencoreclub/teencorezine.png differ diff --git a/public/img/logos/teencoreclub/teendrillers.png b/public/img/logos/teencoreclub/teendrillers.png new file mode 100644 index 00000000..a39cbf9d Binary files /dev/null and b/public/img/logos/teencoreclub/teendrillers.png differ diff --git a/public/img/logos/teencoreclub/teensgoporn.png b/public/img/logos/teencoreclub/teensgoporn.png new file mode 100644 index 00000000..8b00823b Binary files /dev/null and b/public/img/logos/teencoreclub/teensgoporn.png differ diff --git a/public/img/logos/teencoreclub/teensnaturalway.png b/public/img/logos/teencoreclub/teensnaturalway.png new file mode 100644 index 00000000..24eaef30 Binary files /dev/null and b/public/img/logos/teencoreclub/teensnaturalway.png differ diff --git a/public/img/logos/teencoreclub/teenstryblacks.png b/public/img/logos/teencoreclub/teenstryblacks.png new file mode 100644 index 00000000..822fd500 Binary files /dev/null and b/public/img/logos/teencoreclub/teenstryblacks.png differ diff --git a/public/img/logos/teencoreclub/thumbs/analcheckup.png b/public/img/logos/teencoreclub/thumbs/analcheckup.png new file mode 100644 index 00000000..b2b1d859 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/analcheckup.png differ diff --git a/public/img/logos/teencoreclub/thumbs/analcheckups.png b/public/img/logos/teencoreclub/thumbs/analcheckups.png new file mode 100644 index 00000000..1dd32fed Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/analcheckups.png differ diff --git a/public/img/logos/teencoreclub/thumbs/analyzedgirls.png b/public/img/logos/teencoreclub/thumbs/analyzedgirls.png new file mode 100644 index 00000000..1750889a Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/analyzedgirls.png differ diff --git a/public/img/logos/teencoreclub/thumbs/assteenmouth.png b/public/img/logos/teencoreclub/thumbs/assteenmouth.png new file mode 100644 index 00000000..07c8313f Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/assteenmouth.png differ diff --git a/public/img/logos/teencoreclub/thumbs/bangteenpussy.png b/public/img/logos/teencoreclub/thumbs/bangteenpussy.png new file mode 100644 index 00000000..e37b2e50 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/bangteenpussy.png differ diff --git a/public/img/logos/teencoreclub/thumbs/brutalinvasion.png b/public/img/logos/teencoreclub/thumbs/brutalinvasion.png new file mode 100644 index 00000000..0d49a327 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/brutalinvasion.png differ diff --git a/public/img/logos/teencoreclub/thumbs/cumaholicteens.png b/public/img/logos/teencoreclub/thumbs/cumaholicteens.png new file mode 100644 index 00000000..3547d005 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/cumaholicteens.png differ diff --git a/public/img/logos/teencoreclub/thumbs/cumaholicteens.png~ b/public/img/logos/teencoreclub/thumbs/cumaholicteens.png~ new file mode 100644 index 00000000..2f87bc8e Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/cumaholicteens.png~ differ diff --git a/public/img/logos/teencoreclub/thumbs/defiled18.png b/public/img/logos/teencoreclub/thumbs/defiled18.png new file mode 100644 index 00000000..6045f97e Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/defiled18.png differ diff --git a/public/img/logos/teencoreclub/thumbs/doubleteamedteens.png b/public/img/logos/teencoreclub/thumbs/doubleteamedteens.png new file mode 100644 index 00000000..18480dc4 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/doubleteamedteens.png differ diff --git a/public/img/logos/teencoreclub/thumbs/dreamshd.png b/public/img/logos/teencoreclub/thumbs/dreamshd.png new file mode 100644 index 00000000..f0db56b0 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/dreamshd.png differ diff --git a/public/img/logos/teencoreclub/thumbs/drilledchicks.png b/public/img/logos/teencoreclub/thumbs/drilledchicks.png new file mode 100644 index 00000000..c7dda1e4 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/drilledchicks.png differ diff --git a/public/img/logos/teencoreclub/thumbs/fabsluts.png b/public/img/logos/teencoreclub/thumbs/fabsluts.png new file mode 100644 index 00000000..8d4c4034 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/fabsluts.png differ diff --git a/public/img/logos/teencoreclub/thumbs/girlsgotcream.png b/public/img/logos/teencoreclub/thumbs/girlsgotcream.png new file mode 100644 index 00000000..72d986ee Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/girlsgotcream.png differ diff --git a/public/img/logos/teencoreclub/thumbs/hardcoreyouth.png b/public/img/logos/teencoreclub/thumbs/hardcoreyouth.png new file mode 100644 index 00000000..a91c28eb Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/hardcoreyouth.png differ diff --git a/public/img/logos/teencoreclub/thumbs/jerkoffpass.png b/public/img/logos/teencoreclub/thumbs/jerkoffpass.png new file mode 100644 index 00000000..720d4ae2 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/jerkoffpass.png differ diff --git a/public/img/logos/teencoreclub/thumbs/letsgodirty.png b/public/img/logos/teencoreclub/thumbs/letsgodirty.png new file mode 100644 index 00000000..d95ed0cd Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/letsgodirty.png differ diff --git a/public/img/logos/teencoreclub/thumbs/littlehellcat.png b/public/img/logos/teencoreclub/thumbs/littlehellcat.png new file mode 100644 index 00000000..d4d516f2 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/littlehellcat.png differ diff --git a/public/img/logos/teencoreclub/thumbs/logo_color.png b/public/img/logos/teencoreclub/thumbs/logo_color.png new file mode 100644 index 00000000..f42363b1 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/logo_color.png differ diff --git a/public/img/logos/teencoreclub/thumbs/maketeengape.png b/public/img/logos/teencoreclub/thumbs/maketeengape.png new file mode 100644 index 00000000..30ee01ab Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/maketeengape.png differ diff --git a/public/img/logos/teencoreclub/thumbs/network.png b/public/img/logos/teencoreclub/thumbs/network.png new file mode 100644 index 00000000..d8b02eaf Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/network.png differ diff --git a/public/img/logos/teencoreclub/thumbs/nightclub.png b/public/img/logos/teencoreclub/thumbs/nightclub.png new file mode 100644 index 00000000..3db3a7c2 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/nightclub.png differ diff --git a/public/img/logos/teencoreclub/thumbs/nightclublive.png b/public/img/logos/teencoreclub/thumbs/nightclublive.png new file mode 100644 index 00000000..428d0c4e Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/nightclublive.png differ diff --git a/public/img/logos/teencoreclub/thumbs/nylonspunkjunkies.png b/public/img/logos/teencoreclub/thumbs/nylonspunkjunkies.png new file mode 100644 index 00000000..efe50c83 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/nylonspunkjunkies.png differ diff --git a/public/img/logos/teencoreclub/thumbs/nylonsweeties.png b/public/img/logos/teencoreclub/thumbs/nylonsweeties.png new file mode 100644 index 00000000..b3fbfeb8 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/nylonsweeties.png differ diff --git a/public/img/logos/teencoreclub/thumbs/seductive18.png b/public/img/logos/teencoreclub/thumbs/seductive18.png new file mode 100644 index 00000000..a87ba561 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/seductive18.png differ diff --git a/public/img/logos/teencoreclub/thumbs/shegotsix.png b/public/img/logos/teencoreclub/thumbs/shegotsix.png new file mode 100644 index 00000000..f3617e29 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/shegotsix.png differ diff --git a/public/img/logos/teencoreclub/thumbs/spearteenlpussy.png b/public/img/logos/teencoreclub/thumbs/spearteenlpussy.png new file mode 100644 index 00000000..4cee64b7 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/spearteenlpussy.png differ diff --git a/public/img/logos/teencoreclub/thumbs/spearteenpussy.png b/public/img/logos/teencoreclub/thumbs/spearteenpussy.png new file mode 100644 index 00000000..fcc6c38b Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/spearteenpussy.png differ diff --git a/public/img/logos/teencoreclub/thumbs/spermantino.png b/public/img/logos/teencoreclub/thumbs/spermantino.png new file mode 100644 index 00000000..35fa3828 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/spermantino.png differ diff --git a/public/img/logos/teencoreclub/thumbs/spermatino.png b/public/img/logos/teencoreclub/thumbs/spermatino.png new file mode 100644 index 00000000..64a31acb Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/spermatino.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teachmyass.png b/public/img/logos/teencoreclub/thumbs/teachmyass.png new file mode 100644 index 00000000..75125709 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teachmyass.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teenanalcasting.png b/public/img/logos/teencoreclub/thumbs/teenanalcasting.png new file mode 100644 index 00000000..264b973a Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teenanalcasting.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teencoreclub.png b/public/img/logos/teencoreclub/thumbs/teencoreclub.png new file mode 100644 index 00000000..2b0a6715 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teencoreclub.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teencorezine.png b/public/img/logos/teencoreclub/thumbs/teencorezine.png new file mode 100644 index 00000000..aa0597ad Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teencorezine.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teendrillers.png b/public/img/logos/teencoreclub/thumbs/teendrillers.png new file mode 100644 index 00000000..b7abe787 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teendrillers.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teensgoporn.png b/public/img/logos/teencoreclub/thumbs/teensgoporn.png new file mode 100644 index 00000000..db1576e2 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teensgoporn.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teensnaturalway.png b/public/img/logos/teencoreclub/thumbs/teensnaturalway.png new file mode 100644 index 00000000..f79b1054 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teensnaturalway.png differ diff --git a/public/img/logos/teencoreclub/thumbs/teenstryblacks.png b/public/img/logos/teencoreclub/thumbs/teenstryblacks.png new file mode 100644 index 00000000..1dda3971 Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/teenstryblacks.png differ diff --git a/public/img/logos/teencoreclub/thumbs/weneednewtalents.png b/public/img/logos/teencoreclub/thumbs/weneednewtalents.png new file mode 100644 index 00000000..25f88e9b Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/weneednewtalents.png differ diff --git a/public/img/logos/teencoreclub/thumbs/xcoreclub.png b/public/img/logos/teencoreclub/thumbs/xcoreclub.png new file mode 100644 index 00000000..680c647f Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/xcoreclub.png differ diff --git a/public/img/logos/teencoreclub/thumbs/youngthroats.png b/public/img/logos/teencoreclub/thumbs/youngthroats.png new file mode 100644 index 00000000..7adcc1db Binary files /dev/null and b/public/img/logos/teencoreclub/thumbs/youngthroats.png differ diff --git a/public/img/logos/teencoreclub/weneednewtalents.png b/public/img/logos/teencoreclub/weneednewtalents.png new file mode 100644 index 00000000..cadb572d Binary files /dev/null and b/public/img/logos/teencoreclub/weneednewtalents.png differ diff --git a/public/img/logos/teencoreclub/xcoreclub.png b/public/img/logos/teencoreclub/xcoreclub.png new file mode 100644 index 00000000..f26f64b5 Binary files /dev/null and b/public/img/logos/teencoreclub/xcoreclub.png differ diff --git a/public/img/logos/teencoreclub/youngthroats.png b/public/img/logos/teencoreclub/youngthroats.png new file mode 100644 index 00000000..4a808a67 Binary files /dev/null and b/public/img/logos/teencoreclub/youngthroats.png differ diff --git a/public/img/tags/atm/6.jpeg b/public/img/tags/atm/6.jpeg new file mode 100644 index 00000000..b075b29d Binary files /dev/null and b/public/img/tags/atm/6.jpeg differ diff --git a/public/img/tags/atm/lazy/4.jpeg b/public/img/tags/atm/lazy/4.jpeg new file mode 100644 index 00000000..978b84c5 Binary files /dev/null and b/public/img/tags/atm/lazy/4.jpeg differ diff --git a/public/img/tags/atm/lazy/5.jpeg b/public/img/tags/atm/lazy/5.jpeg new file mode 100644 index 00000000..280c5a86 Binary files /dev/null and b/public/img/tags/atm/lazy/5.jpeg differ diff --git a/public/img/tags/atm/lazy/6.jpeg b/public/img/tags/atm/lazy/6.jpeg new file mode 100644 index 00000000..980df3de Binary files /dev/null and b/public/img/tags/atm/lazy/6.jpeg differ diff --git a/public/img/tags/atm/thumbs/4.jpeg b/public/img/tags/atm/thumbs/4.jpeg new file mode 100644 index 00000000..26da88fd Binary files /dev/null and b/public/img/tags/atm/thumbs/4.jpeg differ diff --git a/public/img/tags/atm/thumbs/5.jpeg b/public/img/tags/atm/thumbs/5.jpeg new file mode 100644 index 00000000..ce30fbcb Binary files /dev/null and b/public/img/tags/atm/thumbs/5.jpeg differ diff --git a/public/img/tags/atm/thumbs/6.jpeg b/public/img/tags/atm/thumbs/6.jpeg new file mode 100644 index 00000000..95ec9e87 Binary files /dev/null and b/public/img/tags/atm/thumbs/6.jpeg differ diff --git a/public/img/tags/double-vaginal/lazy/poster.jpeg b/public/img/tags/double-vaginal/lazy/poster.jpeg index 184fdf27..20ddd820 100644 Binary files a/public/img/tags/double-vaginal/lazy/poster.jpeg and b/public/img/tags/double-vaginal/lazy/poster.jpeg differ diff --git a/public/img/tags/double-vaginal/poster.jpeg b/public/img/tags/double-vaginal/poster.jpeg index 870b627d..9f06c539 100755 Binary files a/public/img/tags/double-vaginal/poster.jpeg and b/public/img/tags/double-vaginal/poster.jpeg differ diff --git a/public/img/tags/double-vaginal/thumbs/0.jpeg b/public/img/tags/double-vaginal/thumbs/0.jpeg index 7e806c10..03ba8a4a 100644 Binary files a/public/img/tags/double-vaginal/thumbs/0.jpeg and b/public/img/tags/double-vaginal/thumbs/0.jpeg differ diff --git a/public/img/tags/double-vaginal/thumbs/poster.jpeg b/public/img/tags/double-vaginal/thumbs/poster.jpeg index 69e7afda..d645d54c 100644 Binary files a/public/img/tags/double-vaginal/thumbs/poster.jpeg and b/public/img/tags/double-vaginal/thumbs/poster.jpeg differ diff --git a/seeds/01_networks.js b/seeds/01_networks.js index 0dfed30e..4cf393d1 100644 --- a/seeds/01_networks.js +++ b/seeds/01_networks.js @@ -120,6 +120,7 @@ const networks = [ slug: 'boobpedia', name: 'Boobpedia', url: 'https://www.boobpedia.com', + type: 4, }, { slug: 'burningangel', @@ -141,6 +142,7 @@ const networks = [ slug: 'freeones', name: 'FreeOnes', url: 'https://www.freeones.com', + type: 4, }, { slug: 'ddfnetwork', @@ -386,6 +388,11 @@ const networks = [ url: 'https://www.teamskeet.com', description: 'Welcome to teamskeet.com, the largest collection of exclusive teen porn sites and videos on the web. Check out our TeamSkeet porn sites now.', }, + { + slug: 'teencoreclub', + name: 'https://teencoreclub.com', + url: 'https://www.twistys.com', + }, { slug: 'twistys', name: 'Twistys', @@ -436,6 +443,7 @@ exports.seed = knex => Promise.resolve() const networksWithParent = networks.map(network => ({ slug: network.slug, name: network.name, + type: network.type || 1, alias: (network.alias || []).join(','), url: network.url, description: network.description, @@ -443,5 +451,5 @@ exports.seed = knex => Promise.resolve() parent_id: parentNetworksBySlug[network.parent] || null, })); - return upsert('entities', networksWithParent, 'slug', knex); + return upsert('entities', networksWithParent, ['slug', 'type'], knex); }); diff --git a/seeds/02_sites.js b/seeds/02_sites.js index 34bebca9..7ddd9bd2 100644 --- a/seeds/02_sites.js +++ b/seeds/02_sites.js @@ -5711,6 +5711,188 @@ const sites = [ tags: ['family'], network: 'teamskeet', }, + // TEEN CORE CLUB + { + name: 'AssTeenMouth', + slug: 'assteenmouth', + network: 'teencoreclub', + }, + { + name: 'Bang Teen Pussy', + slug: 'bangteenpussy', + network: 'teencoreclub', + }, + { + name: 'Analyzed Girls', + slug: 'analyzedgirls', + network: 'teencoreclub', + }, + { + name: 'Brutal Invasion', + slug: 'brutalinvasion', + network: 'teencoreclub', + }, + { + name: 'Cumaholic Teens', + alias: ['cumoholic teens', 'cumoholicteens'], + slug: 'cumaholicteens', + network: 'teencoreclub', + }, + { + name: 'Defiled 18', + slug: 'defiled18', + network: 'teencoreclub', + }, + { + name: 'Double Teamed Teens', + slug: 'doubleteamedteens', + network: 'teencoreclub', + }, + { + name: 'Dreams HD', + slug: 'dreamshd', + network: 'teencoreclub', + }, + { + name: 'Girls Got Cream', + slug: 'girlsgotcream', + network: 'teencoreclub', + }, + { + name: 'Hardcore Youth', + slug: 'hardcoreyouth', + network: 'teencoreclub', + }, + { + name: 'Little Hellcat', + slug: 'littlehellcat', + network: 'teencoreclub', + }, + { + name: 'Make Teen Gape', + slug: 'maketeengape', + network: 'teencoreclub', + }, + { + name: 'Nylon Sweeties', + slug: 'nylonsweeties', + network: 'teencoreclub', + }, + { + name: 'Seductive 18', + slug: 'seductive18', + network: 'teencoreclub', + }, + { + name: 'Teen Anal Casting', + slug: 'teenanalcasting', + network: 'teencoreclub', + }, + { + name: 'Teen Drillers', + slug: 'teendrillers', + network: 'teencoreclub', + }, + { + name: 'Teens Natural Way', + slug: 'teensnaturalway', + network: 'teencoreclub', + }, + { + name: 'Teens Try Blacks', + slug: 'teenstryblacks', + network: 'teencoreclub', + }, + { + name: 'Spermantino', + slug: 'spermantino', + network: 'teencoreclub', + }, + { + name: 'Teach My Ass', + slug: 'teachmyass', + network: 'teencoreclub', + }, + { + name: 'Nightclub', + slug: 'nightclub', + network: 'teencoreclub', + }, + { + name: 'Let\'s Go Dirty', + slug: 'letsgodirty', + network: 'teencoreclub', + }, + { + name: 'Nightclub Live', + slug: 'nightclublive', + network: 'teencoreclub', + }, + { + name: 'Drilled Chicks', + slug: 'drilledchicks', + network: 'teencoreclub', + }, + { + name: 'Anal Checkups', + slug: 'analcheckups', + network: 'teencoreclub', + }, + { + name: 'Fab Sluts', + slug: 'fabsluts', + network: 'teencoreclub', + }, + { + name: 'Jerk-Off Pass', + slug: 'jerkoffpass', + network: 'teencoreclub', + }, + { + name: 'Nylon Spunk Junkies', + slug: 'nylonspunkjunkies', + network: 'teencoreclub', + }, + { + name: 'She Got Six', + slug: 'shegotsix', + network: 'teencoreclub', + }, + { + name: 'Spear Teen Pussy', + slug: 'spearteenpussy', + network: 'teencoreclub', + }, + { + name: 'Teen Core Club', + slug: 'teencoreclub', + network: 'teencoreclub', + }, + { + name: 'Teen Core Zine', + slug: 'teencorezine', + network: 'teencoreclub', + }, + { + name: 'Teens Go Porn', + slug: 'teensgoporn', + network: 'teencoreclub', + }, + { + name: 'We Need New Talents', + slug: 'weneednewtalents', + network: 'teencoreclub', + }, + { + name: 'X Core Club', + slug: 'xcoreclub', + network: 'teencoreclub', + }, + { + name: 'Young Throats', + slug: 'youngthroats', + network: 'teencoreclub', + }, // TWISTYS { name: 'Twistys', @@ -6187,6 +6369,7 @@ exports.seed = knex => Promise.resolve() const sitesWithNetworks = sites.map(site => ({ slug: site.slug, name: site.name, + type: site.type || 2, alias: (site.alias || []).join(','), description: site.description, url: site.url, @@ -6196,7 +6379,7 @@ exports.seed = knex => Promise.resolve() active: site.show, })); - const { inserted, updated } = await upsert('entities', sitesWithNetworks, 'slug', knex); + const { inserted, updated } = await upsert('entities', sitesWithNetworks, ['slug', 'type'], knex); const sitesMap = [].concat(inserted, updated).reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {}); const tagAssociations = sites.map(site => (site.tags diff --git a/src/argv.js b/src/argv.js index 1705b364..a1851dfb 100644 --- a/src/argv.js +++ b/src/argv.js @@ -22,7 +22,12 @@ const { argv } = yargs .option('sites', { describe: 'Sites to scrape (overrides configuration)', type: 'array', - alias: 'entities', + alias: 'site', + }) + .option('entities', { + describe: 'Networks or sites to scrape (overrides configuration)', + type: 'array', + alias: 'entity', }) .option('actors', { describe: 'Scrape actors by name or slug', diff --git a/src/entities.js b/src/entities.js new file mode 100644 index 00000000..75fc04d1 --- /dev/null +++ b/src/entities.js @@ -0,0 +1,144 @@ +'use strict'; + +const config = require('config'); + +const logger = require('./logger')(__filename); +const argv = require('./argv'); +const knex = require('./knex'); +const whereOr = require('./utils/where-or'); + +function curateEntity(entity, includeParameters = false) { + const curatedEntity = { + id: entity.id, + name: entity.name, + url: entity.url, + description: entity.description, + slug: entity.slug, + independent: !!entity.parameters && entity.parameters.independent, + parameters: includeParameters ? entity.parameters : null, + network: { + id: entity.network_id, + name: entity.network_name, + description: entity.network_description, + slug: entity.network_slug, + url: entity.network_url, + parameters: includeParameters ? entity.network_parameters : null, + }, + }; + + return curatedEntity; +} + +async function curateEntities(entities, includeParameters) { + return Promise.all(entities.map(async entity => curateEntity(entity, includeParameters))); +} + +async function findSiteByUrl(url) { + const { origin, hostname, pathname } = new URL(url); + // const domain = hostname.replace(/www.|tour./, ''); + const dirUrl = `${origin}${pathname.split('/').slice(0, 2).join('/')}`; // allow for sites on URI directory + + const site = await knex('sites') + .leftJoin('networks', 'sites.network_id', 'networks.id') + .select( + 'sites.*', + 'networks.name as network_name', 'networks.slug as network_slug', 'networks.url as network_url', 'networks.description as network_description', 'networks.parameters as network_parameters', + ) + .where('sites.url', url) + .orWhere('sites.url', origin) + .orWhere('sites.url', origin.replace(/www\.|tour\./, '')) + .orWhere('sites.url', `https://www.${hostname}`) + .orWhere('sites.url', `http://www.${hostname}`) + .orWhere('sites.url', dirUrl) + // .orWhere('sites.url', 'like', `%${domain}`) + .first(); + + if (site) { + const curatedSite = curateSite(site, true, false); + + return curatedSite; + } + + return null; +} + +async function fetchEntitiesFromArgv() { + const rawEntities = await knex.raw(` + WITH RECURSIVE temp AS ( + SELECT id, parent_id, name, slug, type FROM entities WHERE slug IN (?) + UNION + SELECT entities.id, entities.parent_id, entities.name, entities.slug, entities.type FROM entities + INNER JOIN temp ON temp.id = entities.parent_id + ) SELECT * FROM temp; + `, argv.sites || argv.networks || argv.entities); + + console.log(rawEntities.rows); + + const curatedEntities = await curateEntities(rawEntities.rows, true); + logger.info(`Found ${curatedEntities.length} entities in database`); + + console.log(curatedEntities); + + return curatedEntities; +} + +async function fetchEntitiesFromConfig() { + const rawSites = await knex('entities') + .select('entities.*') + .leftJoin('entities as entities_parents', 'entities_parents.id', 'entities.id') + .where((builder) => { + if (config.include) { + builder.whereIn('entities.slug', config.include); + } + }) + .whereNot((builder) => { + builder.whereIn('entities.slug', config.exclude || []); + }); + + const curatedSites = await curateSites(rawSites, true); + logger.info(`Found ${curatedSites.length} sites in database`); + + return curatedSites; +} + +async function fetchIncludedEntities() { + if (argv.networks || argv.sites) { + return fetchEntitiesFromArgv(); + } + + return fetchEntitiesFromConfig(); +} + +async function fetchSites(queryObject) { + const sites = await knex('sites') + .where(builder => whereOr(queryObject, 'sites', builder)) + .select( + 'sites.*', + 'networks.name as network_name', 'networks.slug as network_slug', 'networks.url as network_url', 'networks.description as network_description', 'networks.parameters as network_parameters', + ) + .leftJoin('networks', 'sites.network_id', 'networks.id') + .limit(100); + + return curateSites(sites); +} + +async function fetchSitesFromReleases() { + const sites = await knex('releases') + .select('site_id', '') + .leftJoin('sites', 'sites.id', 'releases.site_id') + .groupBy('sites.id') + .limit(100); + + return curateSites(sites); +} + +module.exports = { + curateEntity, + curateEntities, + fetchIncludedEntities, + fetchSites, + fetchEntitiesFromConfig, + fetchEntitiesFromArgv, + fetchSitesFromReleases, + findSiteByUrl, +};