claude-remote-cli 1.7.0 → 1.7.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/app.js +54 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Remote web interface for Claude Code CLI sessions",
5
5
  "type": "module",
6
6
  "main": "dist/server/index.js",
package/public/app.js CHANGED
@@ -155,6 +155,60 @@
155
155
  }
156
156
  });
157
157
 
158
+ // On Windows/Linux, Ctrl+V is the paste shortcut but xterm.js intercepts it
159
+ // internally without firing a native paste event, so our image paste handler
160
+ // on terminalContainer never runs. Intercept Ctrl+V here to check for images.
161
+ // On macOS, Ctrl+V sends a raw \x16 to the terminal (used by vim etc.), so
162
+ // we only intercept on non-Mac platforms.
163
+ var isMac = /Mac|iPhone|iPad|iPod/.test(navigator.platform || '');
164
+ if (!isMac) {
165
+ term.attachCustomKeyEventHandler(function (e) {
166
+ if (e.type === 'keydown' && e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey &&
167
+ (e.key === 'v' || e.key === 'V')) {
168
+ if (navigator.clipboard && navigator.clipboard.read) {
169
+ navigator.clipboard.read().then(function (clipboardItems) {
170
+ var imageBlob = null;
171
+ var imageType = null;
172
+
173
+ for (var i = 0; i < clipboardItems.length; i++) {
174
+ var types = clipboardItems[i].types;
175
+ for (var j = 0; j < types.length; j++) {
176
+ if (types[j].indexOf('image/') === 0) {
177
+ imageType = types[j];
178
+ imageBlob = clipboardItems[i];
179
+ break;
180
+ }
181
+ }
182
+ if (imageBlob) break;
183
+ }
184
+
185
+ if (imageBlob) {
186
+ imageBlob.getType(imageType).then(function (blob) {
187
+ uploadImage(blob, imageType);
188
+ });
189
+ } else {
190
+ navigator.clipboard.readText().then(function (text) {
191
+ if (text) term.paste(text);
192
+ });
193
+ }
194
+ }).catch(function () {
195
+ // Clipboard read failed (permission denied, etc.) — fall back to text.
196
+ // If readText also fails, paste is lost for this keypress; this only
197
+ // happens when clipboard permission is fully denied, which is rare
198
+ // for user-gesture-triggered reads on HTTPS origins.
199
+ if (navigator.clipboard.readText) {
200
+ navigator.clipboard.readText().then(function (text) {
201
+ if (text) term.paste(text);
202
+ }).catch(function () {});
203
+ }
204
+ });
205
+ return false; // Prevent xterm from handling Ctrl+V
206
+ }
207
+ }
208
+ return true; // Let xterm handle all other keys
209
+ });
210
+ }
211
+
158
212
  var resizeObserver = new ResizeObserver(function () {
159
213
  fitAddon.fit();
160
214
  sendResize();