Compare commits
No commits in common. "a127dfb8af1d594330aca9789ef57da5a34a96f9" and "4a1faa0074f36763602b1251721fb21c300793be" have entirely different histories.
a127dfb8af
...
4a1faa0074
|
@ -45,7 +45,7 @@ function toggleSidebar(state) {
|
|||
async function setConsent(consent) {
|
||||
if (consent) {
|
||||
this.showWarning = false;
|
||||
localStorage.setItem('consent', window.env.sessionId);
|
||||
await this.$store.dispatch('setConsent', true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
showSidebar: false,
|
||||
showWarning: localStorage.getItem('consent') !== window.env.sessionId,
|
||||
showWarning: !window.env.consent,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { graphql } from '../api';
|
||||
import { graphql, post } from '../api';
|
||||
import { curateRelease, curateActor } from '../curate';
|
||||
|
||||
function initUiActions(_store, _router) {
|
||||
|
@ -26,6 +26,12 @@ function initUiActions(_store, _router) {
|
|||
localStorage.setItem('sfw', sfw);
|
||||
}
|
||||
|
||||
async function setConsent({ _commit }, consent) {
|
||||
const res = await post('/consent', consent);
|
||||
|
||||
return res.ok;
|
||||
}
|
||||
|
||||
async function search({ _commit }, { query, limit = 20 }) {
|
||||
const res = await graphql(`
|
||||
query SearchReleases(
|
||||
|
@ -188,6 +194,7 @@ function initUiActions(_store, _router) {
|
|||
setRange,
|
||||
setBatch,
|
||||
setSfw,
|
||||
setConsent,
|
||||
setTheme,
|
||||
fetchStats,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.148.1",
|
||||
"version": "1.148.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.148.1",
|
||||
"version": "1.148.0",
|
||||
"description": "All the latest porn releases in one place",
|
||||
"main": "src/app.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
function setConsent(req, res) {
|
||||
req.session.consent = !!req.body;
|
||||
res.status(204).send();
|
||||
}
|
||||
|
||||
module.exports = setConsent;
|
|
@ -8,7 +8,6 @@ const Router = require('express-promise-router');
|
|||
const bodyParser = require('body-parser');
|
||||
const session = require('express-session');
|
||||
const KnexSessionStore = require('connect-session-knex')(session);
|
||||
const nanoid = require('nanoid');
|
||||
|
||||
const PgConnectionFilterPlugin = require('postgraphile-plugin-connection-filter');
|
||||
const PgSimplifyInflectorPlugin = require('@graphile-contrib/pg-simplify-inflector');
|
||||
|
@ -39,6 +38,8 @@ const {
|
|||
fetchTags,
|
||||
} = require('./tags');
|
||||
|
||||
const setConsent = require('./consent');
|
||||
|
||||
async function initServer() {
|
||||
const app = express();
|
||||
const router = Router();
|
||||
|
@ -84,12 +85,6 @@ async function initServer() {
|
|||
router.use(bodyParser.json({ strict: false }));
|
||||
router.use(session({ ...config.web.session, store }));
|
||||
|
||||
router.use((req, res, next) => {
|
||||
req.session.safeId = req.session.safeId || nanoid();
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
router.get('/api/scenes', fetchScenes);
|
||||
router.get('/api/scenes/:releaseId', fetchScene);
|
||||
router.get('/api/scenes/:releaseId/poster', fetchScenePoster);
|
||||
|
@ -115,11 +110,13 @@ async function initServer() {
|
|||
router.get('/api/tags', fetchTags);
|
||||
router.get('/api/tags/:tagId', fetchTag);
|
||||
|
||||
router.post('/api/consent', setConsent);
|
||||
|
||||
router.get('*', (req, res) => {
|
||||
res.render(path.join(__dirname, '../../assets/index.ejs'), {
|
||||
env: JSON.stringify({
|
||||
sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'),
|
||||
sessionId: req.session.safeId,
|
||||
consent: !!req.session.consent,
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue