Old partial attempt at "public mode"

This commit is contained in:
Wingy 2020-10-29 11:24:13 -04:00
parent f872785e64
commit 8f6b030ca8
6 changed files with 37 additions and 18 deletions

View file

@ -1,4 +1,5 @@
const verifyAuth = require('../middlewares/verifyAuth');
const public = require('../middlewares/public');
const express = require('express');
const path = require('path');
@ -16,7 +17,7 @@ module.exports = ({ db, config }) => {
next();
}
},
verifyAuth(),
public(),
(req, res) => {
res.redirect('/wishlist');
}

View file

@ -1,4 +1,5 @@
const verifyAuth = require('../../middlewares/verifyAuth');
const public = require('../../middlewares/public');
const getProductName = require('get-product-name');
const express = require('express');
const config = require('../../config');
@ -29,7 +30,7 @@ const ValidURL = (string) => { // Ty SO
module.exports = (db) => {
const router = express.Router();
router.get('/', verifyAuth(), async (req, res) => {
router.get('/', public(), async (req, res) => {
const docs = await db.allDocs({ include_docs: true })
if (process.env.SINGLE_LIST === 'true') {
for (row of docs.rows) {
@ -39,7 +40,7 @@ module.exports = (db) => {
res.render('wishlists', { title: 'Wishlists', users: docs.rows, totals})
});
router.get('/:user', verifyAuth(), async (req, res) => {
router.get('/:user', public(), async (req, res) => {
try {
const dbUser = await db.get(req.params.user);
if (process.env.SINGLE_LIST === 'true') {