shellbase 0.1.8 → 0.1.9
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/session.js +2 -1
- package/dist/spawner.js +8 -2
- package/package.json +1 -1
package/dist/session.js
CHANGED
|
@@ -155,7 +155,8 @@ export async function startSession(options) {
|
|
|
155
155
|
const control = readControl(frame.data, device.frameKey);
|
|
156
156
|
if (!control || typeof control.dir !== 'string')
|
|
157
157
|
return;
|
|
158
|
-
|
|
158
|
+
// 이름 앞부분(컴퓨터를 가리키는 부분)만 물려줘서 "GB10 (Docker) · shellbase" 처럼 나오게 함
|
|
159
|
+
const result = spawnSession(control.dir, deviceName.split(' · ')[0]);
|
|
159
160
|
if (result.ok) {
|
|
160
161
|
console.log(`\n📱 폰 요청으로 새 세션을 열었어요 (${control.dir})`);
|
|
161
162
|
return;
|
package/dist/spawner.js
CHANGED
|
@@ -11,7 +11,10 @@ function resolveEntry() {
|
|
|
11
11
|
return current;
|
|
12
12
|
return path.join(path.dirname(fileURLToPath(import.meta.url)), 'cli.js');
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
// nameLabel: 폰 목록에서 부모 세션과 같은 컴퓨터임을 알아보게 물려받는 이름 앞부분.
|
|
15
|
+
// 도커 컨테이너 안에서는 os.hostname() 이 컨테이너 ID(예: 7a54a499a8f3)로 나와서 기본 이름이
|
|
16
|
+
// "7a54a499a8f3 · shellbase" 처럼 알아보기 어려워짐 — 그래서 부모 이름을 물려준다.
|
|
17
|
+
export function spawnSession(dir, nameLabel) {
|
|
15
18
|
const target = path.resolve(dir);
|
|
16
19
|
let stat;
|
|
17
20
|
try {
|
|
@@ -26,7 +29,10 @@ export function spawnSession(dir) {
|
|
|
26
29
|
// 폰에서 띄우는 세션은 승인 물음에 대답할 터미널이 없다(stdio: 'ignore') — 그대로 두면 30초 뒤
|
|
27
30
|
// 자동 거부돼서 화면만 보이고 타이핑이 안 되는 세션이 된다. 요청을 보낸 쪽은 이미 이 세션의
|
|
28
31
|
// 암호화 키(주인만 읽을 수 있는 devices row)를 가지고 있음이 확인된 상태라 자동 승인으로 띄운다.
|
|
29
|
-
const
|
|
32
|
+
const args = [resolveEntry(), 'start', '--dir', target, '--auto-approve'];
|
|
33
|
+
if (nameLabel)
|
|
34
|
+
args.push('--name', `${nameLabel} · ${path.basename(target)}`);
|
|
35
|
+
const child = spawn(process.execPath, args, {
|
|
30
36
|
cwd: target,
|
|
31
37
|
env: process.env,
|
|
32
38
|
// 부모 세션을 Ctrl+C 로 껐을 때 폰에서 따로 만든 세션까지 같이 죽지 않도록 독립 프로세스로 띄움
|