@clawchatsai/connector 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -747,10 +747,17 @@ async function handleSetup(token) {
|
|
|
747
747
|
reject(new Error('Setup timed out'));
|
|
748
748
|
}, 30_000);
|
|
749
749
|
ws.on('open', () => {
|
|
750
|
+
const setupHostname = (() => { try {
|
|
751
|
+
return require('os').hostname();
|
|
752
|
+
}
|
|
753
|
+
catch {
|
|
754
|
+
return undefined;
|
|
755
|
+
} })();
|
|
750
756
|
ws.send(JSON.stringify({
|
|
751
757
|
type: 'setup',
|
|
752
758
|
setupSecret: tokenData.setupSecret,
|
|
753
759
|
apiKey,
|
|
760
|
+
hostname: setupHostname,
|
|
754
761
|
}));
|
|
755
762
|
});
|
|
756
763
|
ws.on('message', async (raw) => {
|
|
@@ -785,8 +792,21 @@ async function handleSetup(token) {
|
|
|
785
792
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
786
793
|
fs.mkdirSync(uploadsDir, { recursive: true });
|
|
787
794
|
ws.close();
|
|
795
|
+
// Ask if user wants to reuse TOTP from another gateway
|
|
796
|
+
let reuseSecret;
|
|
797
|
+
if (config.schemaVersion === 1) {
|
|
798
|
+
const rlSetup = (await import('node:readline')).createInterface({ input: process.stdin, output: process.stdout });
|
|
799
|
+
const askSetup = (q) => new Promise(r => rlSetup.question(q, r));
|
|
800
|
+
console.log('');
|
|
801
|
+
console.log(' 💡 Already have ClawChats on another gateway?');
|
|
802
|
+
console.log(' Run \`openclaw clawchats show-totp\` on that machine and paste the secret below.');
|
|
803
|
+
const reuseAnswer = await askSetup(' Paste existing TOTP secret to reuse it (or press Enter to set up new): ');
|
|
804
|
+
rlSetup.close();
|
|
805
|
+
if (reuseAnswer.trim())
|
|
806
|
+
reuseSecret = reuseAnswer.trim();
|
|
807
|
+
}
|
|
788
808
|
// Enroll TOTP (interactive — requires stdin)
|
|
789
|
-
const totpOk = await enrollTotp(config);
|
|
809
|
+
const totpOk = await enrollTotp(config, reuseSecret);
|
|
790
810
|
if (!totpOk) {
|
|
791
811
|
console.log('');
|
|
792
812
|
console.log(' ⚠️ TOTP not configured. You can set it up later with: openclaw clawchats reauth');
|