cloud-pc-templates 1.1.0 → 1.1.1

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.
@@ -19,36 +19,41 @@ function promptForApiKey() {
19
19
  stdin.resume();
20
20
 
21
21
  let apiKey = '';
22
- let isFirstInput = true;
23
22
 
24
- stdin.on('data', (byte) => {
25
- const char = byte.toString();
23
+ stdin.on('data', (buffer) => {
24
+ const chunk = buffer.toString();
26
25
 
27
- if (char === '\n' || char === '\r' || char === '\u0004') {
28
- // Enter or EOF
29
- if (stdin.isTTY) {
30
- stdin.setRawMode(false);
31
- }
32
- stdin.pause();
33
- stdin.removeAllListeners('data');
34
- console.log('');
35
- resolve(apiKey);
36
- } else if (char === '\u0003') {
37
- // Ctrl+C
38
- if (stdin.isTTY) {
39
- stdin.setRawMode(false);
40
- }
41
- process.exit();
42
- } else if (char === '\x7f' || char === '\b') {
43
- // Backspace
44
- if (apiKey.length > 0) {
45
- apiKey = apiKey.slice(0, -1);
46
- process.stdout.write('\x1b[D\x1b[K');
26
+ // Process each character in the chunk (handles pasted text)
27
+ for (let i = 0; i < chunk.length; i++) {
28
+ const char = chunk[i];
29
+
30
+ if (char === '\n' || char === '\r' || char === '\u0004') {
31
+ // Enter or EOF
32
+ if (stdin.isTTY) {
33
+ stdin.setRawMode(false);
34
+ }
35
+ stdin.pause();
36
+ stdin.removeAllListeners('data');
37
+ console.log('');
38
+ resolve(apiKey);
39
+ return;
40
+ } else if (char === '\u0003') {
41
+ // Ctrl+C
42
+ if (stdin.isTTY) {
43
+ stdin.setRawMode(false);
44
+ }
45
+ process.exit();
46
+ } else if (char === '\x7f' || char === '\b') {
47
+ // Backspace
48
+ if (apiKey.length > 0) {
49
+ apiKey = apiKey.slice(0, -1);
50
+ process.stdout.write('\x1b[D\x1b[K');
51
+ }
52
+ } else if (char >= '\x20' && char <= '\x7e') {
53
+ // Printable character
54
+ apiKey += char;
55
+ process.stdout.write('*');
47
56
  }
48
- } else if (char >= '\x20' && char <= '\x7e') {
49
- // Printable character
50
- apiKey += char;
51
- process.stdout.write('*');
52
57
  }
53
58
  });
54
59
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-pc-templates",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {