Moved SFW mode to server, added HTTP header trigger.

This commit is contained in:
ThePendulum 2020-03-27 17:37:13 +01:00
parent fb59bf552a
commit 238ebcbf34
9 changed files with 48 additions and 63 deletions

23
assets/index.ejs Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="theme-color" content="#ff6c88">
<title>traxxx</title>
<link rel="stylesheet" href="/css/style.css">
<link rel="icon" href="/img/favicon/favicon-16x16.ico" sizes="16x16">
<link rel="icon" href="/img/favicon/favicon-32x32.ico" sizes="32x32">
<link rel="icon" href="/img/favicon/favicon-62x62.ico" sizes="64x64">
<script src="/js/bundle.js" defer></script>
</head>
<body>
<div id="container"></div>
<script>window.env = <%- env %>;</script>
</body>
</html>

View File

@ -13,6 +13,10 @@ import Icon from '../components/icon/icon.vue';
function init() { function init() {
const store = initStore(router); const store = initStore(router);
if (window.env.sfw) {
store.dispatch('setSfw', true);
}
Vue.mixin({ Vue.mixin({
components: { components: {
Icon, Icon,

View File

@ -84,9 +84,6 @@ const routes = [
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
routes, routes,
afterEach(to, from) {
console.log(to, from);
},
}); });
export default router; export default router;

View File

@ -8,6 +8,8 @@ module.exports = {
web: { web: {
host: '0.0.0.0', host: '0.0.0.0',
port: 5000, port: 5000,
sfwHost: '0.0.0.0',
sfwPort: 5001,
}, },
// include: [], // include: [],
// exclude: [], // exclude: [],

5
package-lock.json generated
View File

@ -3445,6 +3445,11 @@
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" "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": { "electron-to-chromium": {
"version": "1.3.360", "version": "1.3.360",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.360.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.360.tgz",

View File

@ -81,6 +81,7 @@
"config": "^3.2.5", "config": "^3.2.5",
"csv-stringify": "^5.3.6", "csv-stringify": "^5.3.6",
"dayjs": "^1.8.21", "dayjs": "^1.8.21",
"ejs": "^3.0.1",
"express": "^4.17.1", "express": "^4.17.1",
"express-promise-router": "^3.0.3", "express-promise-router": "^3.0.3",
"express-react-views": "^0.11.0", "express-react-views": "^0.11.0",

View File

@ -13,7 +13,7 @@ const tagPosters = [
['blowbang', 'poster', 'Marsha May in "Feeding Frenzy 12" for Jules Jordan'], ['blowbang', 'poster', 'Marsha May in "Feeding Frenzy 12" for Jules Jordan'],
['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'], ['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'],
['brunette', 0, 'Nicole Black in GIO971 for LegalPorno'], ['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'], ['caucasian', 0, 'Remy Lacroix for HardX'],
['creampie', 'poster'], ['creampie', 'poster'],
['da-tp', 0, 'Natasha Teen in LegalPorno SZ2164'], ['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'], ['facial', 0, 'Brooklyn Gray in "All About Ass 4" for Evil Angel'],
['gangbang', 'poster', 'Kristen Scott in "Interracial Gangbang!" for Jules Jordan'], ['gangbang', 'poster', 'Kristen Scott in "Interracial Gangbang!" for Jules Jordan'],
['gaping', 1, 'Vina Sky in "Vina Sky Does Anal" for HardX'], ['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'], ['latina', 'poster', 'Alexis Love for Penthouse'],
['lesbian', 0, 'Reena Sky and Sarah Banks for Brazzers'], ['lesbian', 0, 'Reena Sky and Sarah Banks for Brazzers'],
['maid', 0, 'Whitney Wright in "Dredd Up Your Ass 2" for Jules Jordan'], ['maid', 0, 'Whitney Wright in "Dredd Up Your Ass 2" for Jules Jordan'],
['milf', 0, 'Olivia Austin in "Dredd 3" 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'], ['mff', 0, 'Madison Ivy, Adriana Chechik and Keiran Lee in "Day With A Pornstar" for Brazzers'],
['mfm', 5, 'Vina Sky in "Slut Puppies 15" for Jules Jordan'], ['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'], ['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'], ['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'], ['redhead', 0, 'Penny Pax in "The Submission of Emma Marx: Boundaries" for New Sensations'],
['schoolgirl', 1, 'Eliza Ibarra for Brazzers'], ['schoolgirl', 1, 'Eliza Ibarra for Brazzers'],
@ -95,7 +95,7 @@ const tagPhotos = [
['gaping', 2, 'Alex Grey in "DP Masters 5" for Jules Jordan'], ['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', 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'], ['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'], ['trainbang', 0, 'Nicole Black in GIO971 for LegalPorno'],
['triple-anal', 1, 'Natasha Teen in SZ2098 for LegalPorno'], ['triple-anal', 1, 'Natasha Teen in SZ2098 for LegalPorno'],
['triple-anal', 2, 'Kira Thorn in GIO1018 for LegalPorno'], ['triple-anal', 2, 'Kira Thorn in GIO1018 for LegalPorno'],

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
// const knex = require('./knex');
const argv = require('./argv'); const argv = require('./argv');
const initServer = require('./web/server'); const initServer = require('./web/server');
@ -9,7 +8,6 @@ const fetchUpdates = require('./updates');
const { fetchScenes, fetchMovies } = require('./deep'); const { fetchScenes, fetchMovies } = require('./deep');
const { storeReleases } = require('./store-releases'); const { storeReleases } = require('./store-releases');
const { updateReleasesSearch } = require('./releases'); const { updateReleasesSearch } = require('./releases');
// const { storeReleaseActors } = require('./actors');
async function init() { async function init() {
if (argv.server) { if (argv.server) {
@ -41,55 +39,4 @@ async function init() {
knex.destroy(); 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; module.exports = init;

View File

@ -63,6 +63,8 @@ function initServer() {
}, },
)); ));
app.set('view engine', 'ejs');
router.use('/media', express.static(config.media.path)); router.use('/media', express.static(config.media.path));
router.use(express.static('public')); router.use(express.static('public'));
@ -93,7 +95,11 @@ function initServer() {
router.get('/api/tags/:tagId/releases', fetchTagReleases); router.get('/api/tags/:tagId/releases', fetchTagReleases);
router.get('*', (req, res) => { 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); app.use(router);