import fs from 'node:fs' const url = process.argv[2] const first = await fetch(url, { redirect: 'manual' }) const setCookie = first.headers.getSetCookie ? first.headers.getSetCookie() : [first.headers.get('set-cookie')].filter(Boolean) const cookie = setCookie.map(c => c.split(';')[0]).join('; ') const base = new URL(url) const state = JSON.parse(fs.readFileSync('C:/Users/qyh15/.dsh-test-b/sansheng/state.json', 'utf8')) const pid = Object.keys(state.projects)[0] const res = await fetch(base.origin + '/api/sansheng', { method: 'POST', headers: { 'content-type': 'application/json', cookie }, body: JSON.stringify({ endpoint: 'enable', payload: { projectId: pid } }) }) const text = await res.text() console.log('status', res.status, text.slice(0, 500))