| 123456789101112131415161718192021222324 |
- 'use strict';
- // 采集 Cookie 会话(淘宝闪购后台)
- const { sendJson, readBody } = require('../util.js');
- function register(app, ctx) {
- app.get('/api/session', async ({ res }) => {
- sendJson(res, 200, {
- cookieConfigured: !!ctx.session.cookie,
- ksidConfigured: !!ctx.session.getKsid(),
- });
- });
- app.post('/api/session', async ({ req, res }) => {
- const body = await readBody(req);
- ctx.session.cookie = String((body && body.cookie) || '');
- ctx.session.saveSession();
- ctx.logs.pushSystemLog('采集 Cookie 已更新', 'success');
- sendJson(res, 200, { ok: true });
- });
- }
- module.exports = { register };
|