download-bar.js 837 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;
        }
        if (req.yoho.isMarsApp) {
            res.locals.nodownload = true;
        }

        next();
    };
};