download-bar.js 751 Bytes
'use strict';

module.exports = () => {
    return (req, res, next) => {
        if (req.query.nodownload) {
            res.cookie('nodownload', 'true', {
                domain: 'm.yohobuy.com',
                expires: new Date(Date.now() + 24 * 3600 * 1000)
            });
        }

        if (req.query.nogoback) {
            res.cookie('nogoback', 'true', {
                domain: 'm.yohobuy.com',
                expires: new Date(Date.now() + 24 * 3600 * 1000)
            });
        }

        if (req.query.nodownload || req.cookies.nodownload) {
            res.locals.nodownload = true;
        }

        if (req.query.nogoback || req.cookies.nogoback) {
            res.locals.nogoback = true;
        }

        next();
    };
};