Files
Clawd BotandClaude Opus 4.6 ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- Reset master to upstream/main (16,697 commits)
- Overlay 2,271 local-only files (skills, tools, workspace, configs, apps)
- Restore IDENTITY.md and USER.md templates
- Build verified, gateway running, Discord working

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-03 07:40:46 +01:00

17 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
const fs=require('fs');const https=require('https');const {homedir}=require('os');
function httpsRequest(url, options={}){return new Promise((res,rej)=>{const req=https.request(url,options,r=>{let d='';r.on('data',c=>d+=c);r.on('end',()=>{if(r.statusCode>=400)rej(new Error(`HTTP ${r.statusCode}: ${d}`));else try{res(JSON.parse(d))}catch(e){res(d)};});});req.on('error',rej);if(options.body)req.write(options.body);req.end();});}
(async()=>{
try{
const id=process.argv[2]; if(!id) throw new Error('Usage: mark_read_gmail.cjs <message-id>');
const credsPath=require('path').join(homedir(),'.openclaw/secrets/google-oauth.json');
const creds=JSON.parse(fs.readFileSync(credsPath,'utf8'));
const body=new URLSearchParams({client_id:creds.client_id,client_secret:creds.client_secret,refresh_token:creds.refresh_token,grant_type:'refresh_token'}).toString();
const tokenResp=await httpsRequest('https://oauth2.googleapis.com/token',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded','Content-Length':Buffer.byteLength(body)},body});
const token=tokenResp.access_token;
const url=`https://gmail.googleapis.com/gmail/v1/users/me/messages/${id}/modify`;
const patchBody=JSON.stringify({removeLabelIds:['UNREAD']});
await httpsRequest(url,{method:'POST',headers:{Authorization:`Bearer ${token}`,'Content-Type':'application/json'},body:patchBody});
console.log('Marked as read:',id);
}catch(err){console.error('Error:',err.message);process.exit(1);} })();