bdy 1.17.9-dev → 1.17.11-dev
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/distTs/package.json
CHANGED
|
@@ -159,6 +159,8 @@ const addEntryToZip = (dirPath, zip, entry) => {
|
|
|
159
159
|
let name = (0, path_1.join)(entry.parentPath.replace(dirPath, ''), entry.name);
|
|
160
160
|
if (isDir)
|
|
161
161
|
name += '/';
|
|
162
|
+
else
|
|
163
|
+
name = name.replace(/^\//, '');
|
|
162
164
|
const file = new fflate_1.default.AsyncZipDeflate(name, {
|
|
163
165
|
level: 9,
|
|
164
166
|
});
|
|
@@ -214,16 +216,13 @@ const createZip = (dirPath, zipPath, entries, onEntry) => {
|
|
|
214
216
|
ws.close();
|
|
215
217
|
reject(err);
|
|
216
218
|
}
|
|
219
|
+
else if (final) {
|
|
220
|
+
ws.end(data, () => {
|
|
221
|
+
resolve();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
217
224
|
else {
|
|
218
225
|
ws.write(data);
|
|
219
|
-
if (final) {
|
|
220
|
-
ws.close((err) => {
|
|
221
|
-
if (err)
|
|
222
|
-
reject(err);
|
|
223
|
-
else
|
|
224
|
-
resolve();
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
226
|
}
|
|
228
227
|
});
|
|
229
228
|
addEntriesToZip(dirPath, zip, entries, onEntry)
|
|
@@ -231,6 +230,7 @@ const createZip = (dirPath, zipPath, entries, onEntry) => {
|
|
|
231
230
|
zip.end();
|
|
232
231
|
})
|
|
233
232
|
.catch((err) => {
|
|
233
|
+
wasError = true;
|
|
234
234
|
ws.close(() => {
|
|
235
235
|
reject(err);
|
|
236
236
|
});
|
|
@@ -84,7 +84,7 @@ class ServerSsh extends events_1.default {
|
|
|
84
84
|
}
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
|
-
createProxyConnection(privateKey) {
|
|
87
|
+
createProxyConnection(privateKey, user) {
|
|
88
88
|
return new Promise((resolve, reject) => {
|
|
89
89
|
const client = new ssh2_1.default.Client();
|
|
90
90
|
client.once('error', (err) => {
|
|
@@ -98,7 +98,7 @@ class ServerSsh extends events_1.default {
|
|
|
98
98
|
client.connect({
|
|
99
99
|
host: '127.0.0.1',
|
|
100
100
|
port: 22,
|
|
101
|
-
username:
|
|
101
|
+
username: user,
|
|
102
102
|
privateKey: privateKey,
|
|
103
103
|
});
|
|
104
104
|
});
|
|
@@ -125,11 +125,13 @@ class ServerSsh extends events_1.default {
|
|
|
125
125
|
if (ctx.method === 'publickey') {
|
|
126
126
|
let keys;
|
|
127
127
|
let privateKey;
|
|
128
|
+
let user;
|
|
128
129
|
try {
|
|
129
130
|
const resp = await buddy_1.default.fetchAgentKeys(this.agent.id, this.agent.host, this.agent.token);
|
|
130
131
|
logger_1.default.debug(resp);
|
|
131
132
|
keys = resp.keys;
|
|
132
133
|
privateKey = resp.privateKey;
|
|
134
|
+
user = resp.user || 'root';
|
|
133
135
|
}
|
|
134
136
|
catch {
|
|
135
137
|
ctx.reject(allowed);
|
|
@@ -143,7 +145,7 @@ class ServerSsh extends events_1.default {
|
|
|
143
145
|
}
|
|
144
146
|
logger_1.default.debug('verified');
|
|
145
147
|
try {
|
|
146
|
-
const proxyClient = await this.createProxyConnection(privateKey);
|
|
148
|
+
const proxyClient = await this.createProxyConnection(privateKey, user);
|
|
147
149
|
logger_1.default.debug('proxy connected');
|
|
148
150
|
ctx.accept();
|
|
149
151
|
return proxyClient;
|