- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation
🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import utils from '../utils.js';
|
|
import platform from '../platform/index.js';
|
|
|
|
export default platform.hasStandardBrowserEnv
|
|
? // Standard browser envs support document.cookie
|
|
{
|
|
write(name, value, expires, path, domain, secure, sameSite) {
|
|
if (typeof document === 'undefined') return;
|
|
|
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
|
|
if (utils.isNumber(expires)) {
|
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
}
|
|
if (utils.isString(path)) {
|
|
cookie.push(`path=${path}`);
|
|
}
|
|
if (utils.isString(domain)) {
|
|
cookie.push(`domain=${domain}`);
|
|
}
|
|
if (secure === true) {
|
|
cookie.push('secure');
|
|
}
|
|
if (utils.isString(sameSite)) {
|
|
cookie.push(`SameSite=${sameSite}`);
|
|
}
|
|
|
|
document.cookie = cookie.join('; ');
|
|
},
|
|
|
|
read(name) {
|
|
if (typeof document === 'undefined') return null;
|
|
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
return match ? decodeURIComponent(match[1]) : null;
|
|
},
|
|
|
|
remove(name) {
|
|
this.write(name, '', Date.now() - 86400000, '/');
|
|
},
|
|
}
|
|
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
{
|
|
write() {},
|
|
read() {
|
|
return null;
|
|
},
|
|
remove() {},
|
|
};
|