From 238ebcbf34759f517d23e7b0164ded8f49237ebb Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Fri, 27 Mar 2020 17:37:13 +0100 Subject: [PATCH] Moved SFW mode to server, added HTTP header trigger. --- assets/index.ejs | 23 ++++++++++++++++++++ assets/js/main.js | 4 ++++ assets/js/router.js | 3 --- config/default.js | 2 ++ package-lock.json | 5 +++++ package.json | 1 + seeds/04_media.js | 12 +++++----- src/app.js | 53 --------------------------------------------- src/web/server.js | 8 ++++++- 9 files changed, 48 insertions(+), 63 deletions(-) create mode 100644 assets/index.ejs diff --git a/assets/index.ejs b/assets/index.ejs new file mode 100644 index 00000000..acb13ff8 --- /dev/null +++ b/assets/index.ejs @@ -0,0 +1,23 @@ + + + + + + + + traxxx + + + + + + + + + + +
+ + + + diff --git a/assets/js/main.js b/assets/js/main.js index 03868b7e..0f34be82 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -13,6 +13,10 @@ import Icon from '../components/icon/icon.vue'; function init() { const store = initStore(router); + if (window.env.sfw) { + store.dispatch('setSfw', true); + } + Vue.mixin({ components: { Icon, diff --git a/assets/js/router.js b/assets/js/router.js index 08391020..15bb66d8 100644 --- a/assets/js/router.js +++ b/assets/js/router.js @@ -84,9 +84,6 @@ const routes = [ const router = new VueRouter({ mode: 'history', routes, - afterEach(to, from) { - console.log(to, from); - }, }); export default router; diff --git a/config/default.js b/config/default.js index 7165b2b1..226528c8 100644 --- a/config/default.js +++ b/config/default.js @@ -8,6 +8,8 @@ module.exports = { web: { host: '0.0.0.0', port: 5000, + sfwHost: '0.0.0.0', + sfwPort: 5001, }, // include: [], // exclude: [], diff --git a/package-lock.json b/package-lock.json index 206458f6..0a399e6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3445,6 +3445,11 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "ejs": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.0.1.tgz", + "integrity": "sha512-cuIMtJwxvzumSAkqaaoGY/L6Fc/t6YvoP9/VIaK0V/CyqKLEQ8sqODmYfy/cjXEdZ9+OOL8TecbJu+1RsofGDw==" + }, "electron-to-chromium": { "version": "1.3.360", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.360.tgz", diff --git a/package.json b/package.json index 566d8834..f0abf7e2 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "config": "^3.2.5", "csv-stringify": "^5.3.6", "dayjs": "^1.8.21", + "ejs": "^3.0.1", "express": "^4.17.1", "express-promise-router": "^3.0.3", "express-react-views": "^0.11.0", diff --git a/seeds/04_media.js b/seeds/04_media.js index 6d89baec..b8d52992 100644 --- a/seeds/04_media.js +++ b/seeds/04_media.js @@ -13,7 +13,7 @@ const tagPosters = [ ['blowbang', 'poster', 'Marsha May in "Feeding Frenzy 12" for Jules Jordan'], ['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'], ['brunette', 0, 'Nicole Black in GIO971 for LegalPorno'], - ['bukkake', 'poster'], + ['bukkake', 'poster', 'Mia Malkova in "Facialized 2" for HardX'], ['caucasian', 0, 'Remy Lacroix for HardX'], ['creampie', 'poster'], ['da-tp', 0, 'Natasha Teen in LegalPorno SZ2164'], @@ -28,15 +28,15 @@ const tagPosters = [ ['facial', 0, 'Brooklyn Gray in "All About Ass 4" for Evil Angel'], ['gangbang', 'poster', 'Kristen Scott in "Interracial Gangbang!" for Jules Jordan'], ['gaping', 1, 'Vina Sky in "Vina Sky Does Anal" for HardX'], - ['interracial', 'poster'], + ['interracial', 'poster', 'Khloe Kapri and Jax Slayher in "First Interracial Anal" for Hussie Pass'], ['latina', 'poster', 'Alexis Love for Penthouse'], ['lesbian', 0, 'Reena Sky and Sarah Banks for Brazzers'], ['maid', 0, 'Whitney Wright in "Dredd Up Your Ass 2" for Jules Jordan'], ['milf', 0, 'Olivia Austin in "Dredd 3" for Jules Jordan'], - ['mff', 0, 'Madison Ivy and Adriana Chechik in "Day With A Pornstar" for Brazzers'], - ['mfm', 5, 'Vina Sky in "Slut Puppies 15" for Jules Jordan'], + ['mff', 0, 'Madison Ivy, Adriana Chechik and Keiran Lee in "Day With A Pornstar" for Brazzers'], + ['mfm', 5, 'Vina Sky, Jules Jordan and Steve Holmes in "Slut Puppies 15" for Jules Jordan'], ['cum-in-mouth', 1, 'Keisha Grey in Brazzers House'], - ['orgy', 1, 'Jessa Rhodes, Melissa moore, Kimmy Granger, Megan Rain and Morgan Lee in "Orgy Masters 8" for Jules Jordan'], + ['orgy', 1, 'Megan Rain (DP), Morgan Lee (anal), Jessa Rhodes, Melissa Moore, Kimmy Granger, Mick Blue and Markus Dupree in "Orgy Masters 8" for Jules Jordan'], ['pussy-eating', 0, 'Elena Kosha and Ivy Wolfe in "Bare" for Jules Jordan'], ['redhead', 0, 'Penny Pax in "The Submission of Emma Marx: Boundaries" for New Sensations'], ['schoolgirl', 1, 'Eliza Ibarra for Brazzers'], @@ -95,7 +95,7 @@ const tagPhotos = [ ['gaping', 2, 'Alex Grey in "DP Masters 5" for Jules Jordan'], // ['mfm', 0, 'Vina Sky in "Jules Jordan\'s Three Ways" for Jules Jordan'], ['mfm', 1, 'Jynx Maze in "Don\'t Make Me Beg 4" for Evil Angel'], - ['orgy', 'poster', 'Frida Sante, Jillian Janson, Zoey Monroe, Katerina Kay and Natasha Starr in "Orgy Masters 6" for Jules Jordan'], + ['orgy', 'poster', 'Zoey Mornoe (DP), Jillian Janson (sex), Frida Sante, Katerina Kay, Natasha Starr, Mick Blue and Ramon Nomar in "Orgy Masters 6" for Jules Jordan'], ['trainbang', 0, 'Nicole Black in GIO971 for LegalPorno'], ['triple-anal', 1, 'Natasha Teen in SZ2098 for LegalPorno'], ['triple-anal', 2, 'Kira Thorn in GIO1018 for LegalPorno'], diff --git a/src/app.js b/src/app.js index e9fc1171..0edcfad4 100644 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,5 @@ 'use strict'; -// const knex = require('./knex'); const argv = require('./argv'); const initServer = require('./web/server'); @@ -9,7 +8,6 @@ const fetchUpdates = require('./updates'); const { fetchScenes, fetchMovies } = require('./deep'); const { storeReleases } = require('./store-releases'); const { updateReleasesSearch } = require('./releases'); -// const { storeReleaseActors } = require('./actors'); async function init() { if (argv.server) { @@ -41,55 +39,4 @@ async function init() { knex.destroy(); } -/* -const scrapeSites = require('./scrape-sites'); -const { scrapeScenes, scrapeMovies, deepFetchReleases } = require('./scrape-releases'); -const { storeReleases, updateReleasesSearch } = require('./releases'); -const { scrapeActors, scrapeBasicActors } = require('./actors'); - -if (process.env.NODE_ENV === 'development') { - require('longjohn'); // eslint-disable-line global-require -} - -async function init() { - if (argv.scene) { - await scrapeScenes(argv.scene); - - - if (argv.movie) { - await scrapeMovies(argv.movie); - } - - if (argv.scrape || argv.networks || argv.sites) { - await scrapeSites(); - } - - if (argv.actors && argv.actors.length > 0) { - const actors = await scrapeActors(); - - if (argv.withReleases) { - const baseReleases = actors.map(actor => actor?.releases || []).flat(); - const releases = await deepFetchReleases(baseReleases, null); - - await storeReleases(releases); - } - } - - if (argv.actors && argv.actors.length === 0) { - await scrapeBasicActors(); - } - - if (argv.updateSearch) { - await updateReleasesSearch(); - } - - if (argv.server) { - await initServer(); - return; - } - - knex.destroy(); -} -*/ - module.exports = init; diff --git a/src/web/server.js b/src/web/server.js index f7db980d..7f765160 100644 --- a/src/web/server.js +++ b/src/web/server.js @@ -63,6 +63,8 @@ function initServer() { }, )); + app.set('view engine', 'ejs'); + router.use('/media', express.static(config.media.path)); router.use(express.static('public')); @@ -93,7 +95,11 @@ function initServer() { router.get('/api/tags/:tagId/releases', fetchTagReleases); router.get('*', (req, res) => { - res.sendFile(path.join(__dirname, '../../public/index.html')); + res.render(path.join(__dirname, '../../assets/index.ejs'), { + env: JSON.stringify({ + sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'), + }), + }); }); app.use(router);