shellbase 0.3.2 → 0.4.0
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/agent.js +24 -1
- package/dist/devices.js +4 -0
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -7,7 +7,7 @@ import { requireClient } from './auth.js';
|
|
|
7
7
|
import { TERMINAL_CATEGORY, CONTROL_TOKEN } from './config.js';
|
|
8
8
|
import { startSleepGuard, stopSleepGuard } from './sleep-guard.js';
|
|
9
9
|
import { encryptFrame, decryptFrame, generateFrameKey } from './crypto.js';
|
|
10
|
-
import { registerDevice, heartbeatDevice, unregisterDevice, listOnlineDirs } from './devices.js';
|
|
10
|
+
import { registerDevice, heartbeatDevice, unregisterDevice, listOnlineDirs, renameDevice, } from './devices.js';
|
|
11
11
|
import { promptApproval } from './prompt.js';
|
|
12
12
|
import { touchRecentDir } from './recent-dirs.js';
|
|
13
13
|
import { listDirs } from './browse.js';
|
|
@@ -315,6 +315,29 @@ export async function runAgent(options) {
|
|
|
315
315
|
void closeSession(session, { deliberate: true });
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
+
// 폰에서 세션 이름 바꾸기 — 컴퓨터를 가리키는 앞부분은 유지해서 목록의 컴퓨터 묶음이 깨지지 않게 한다
|
|
319
|
+
if (frame.kind === 'rename') {
|
|
320
|
+
const control = readControl(frame.data, session.frameKey);
|
|
321
|
+
if (!control || typeof control.name !== 'string')
|
|
322
|
+
return;
|
|
323
|
+
const label = control.name.trim().slice(0, 40);
|
|
324
|
+
if (!label)
|
|
325
|
+
return;
|
|
326
|
+
const nextName = `${hostLabel} · ${label}`;
|
|
327
|
+
const before = session.name;
|
|
328
|
+
session.name = nextName;
|
|
329
|
+
renameDevice(cb, session.rowId, nextName)
|
|
330
|
+
.then(() => {
|
|
331
|
+
// 재시작 복구 목록에도 바뀐 이름이 남도록 저장
|
|
332
|
+
persistOpenSessions();
|
|
333
|
+
console.log(`📱 세션 이름을 바꿨어요: "${before}" → "${nextName}"`);
|
|
334
|
+
})
|
|
335
|
+
.catch((err) => {
|
|
336
|
+
session.name = before;
|
|
337
|
+
console.error('이름 변경 실패:', err.message);
|
|
338
|
+
});
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
318
341
|
if (frame.kind === 'list_dirs') {
|
|
319
342
|
const control = readControl(frame.data, session.frameKey);
|
|
320
343
|
if (!control)
|
package/dist/devices.js
CHANGED
|
@@ -46,3 +46,7 @@ export async function listOnlineDirs(cb) {
|
|
|
46
46
|
}
|
|
47
47
|
return dirs;
|
|
48
48
|
}
|
|
49
|
+
// 폰에서 세션 이름을 바꿀 때 — 목록 row 의 표시 이름만 갱신한다 (세션 자체는 그대로 유지)
|
|
50
|
+
export async function renameDevice(cb, rowId, deviceName) {
|
|
51
|
+
await cb.database.updateData(DEVICES_TABLE_ID, rowId, { data: { device_name: deviceName } });
|
|
52
|
+
}
|