@
Koma #4 有解决方案了吗,我搜了下不用重启,切换配置里面的网络选项也可以,简单写了个 js 脚本放定时任务里面每天自动调用一次,你可以参考下
```javascript
const url = "http://<qb 的 ip>:<qb 的端口>/";
const username = "<qb 用户名>";
const password = "<qb 密码>"
const headers = {
"accept": "application/json, text/plain, */*",
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en-GB;q=0.7,en;q=0.6,fr;q=0.5,de;q=0.4,ja;q=0.3,pl;q=0.2",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded",
"Referer": url,
"Referrer-Policy": "strict-origin-when-cross-origin"
}
fetch(`${url}api/v2/auth/login`, {
"headers": headers,
"body": `username=${username}&password=${password}`,
"method": "POST"
}).then(async response => {
const cookie = response.headers.get('set-cookie')
await fetch(`${url}api/v2/app/setPreferences`, {
"headers": {
"cookie": cookie,
...headers
},
"body": `json=${encodeURI(JSON.stringify({ current_interface_address: '' })) }`,
"method": "POST"
}).then(response => {
if (response.ok) {
console.log('成功设置为所有 ip');
}
});
await new Promise(resolve => setTimeout(resolve, 3000));
await fetch(`${url}api/v2/app/setPreferences`, {
"headers": {
"cookie": cookie,
...headers
},
"body": `json=${encodeURI(JSON.stringify({ current_interface_address: '::' })) }`,
"method": "POST"
}).then(response => {
if (response.ok) {
console.log('成功设置为 ipv6');
}
});
}).catch(error => {
console.log('运行失败:', error);
process.exit(1);
});
```