@bprotsyk/aso-core 2.0.27 → 2.0.28

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.
@@ -3,6 +3,10 @@ export declare let IP: string;
3
3
  export declare let PASSWORD: string;
4
4
  export declare let HOST: string;
5
5
  export declare let PORT: number;
6
+ interface FileObject {
7
+ name: string;
8
+ content: string;
9
+ }
6
10
  export declare class ServerUtil {
7
11
  DOMAIN_HOME: string;
8
12
  ssh?: NodeSSH;
@@ -23,7 +27,8 @@ export declare class ServerUtil {
23
27
  setupCertbot(): Promise<boolean>;
24
28
  setupSSL(email: string, host: string): Promise<void>;
25
29
  refresh(): Promise<boolean>;
26
- deployLandingPage(host: string, username: string, password: string, remotePath: string, port: number, files: any): Promise<void>;
30
+ deployLandingPage(host: string, username: string, password: string, remotePath: string, port: number, files: FileObject[]): Promise<void>;
27
31
  generateNginxConfig(domain: string, rootPath: string): Promise<string>;
28
32
  serverConect(IP: string): Promise<boolean>;
29
33
  }
34
+ export {};
@@ -175,7 +175,8 @@ class ServerUtil {
175
175
  await sftp.mkdir(remotePath, true);
176
176
  }
177
177
  for (const file of files) {
178
- const remoteFilePath = `${remotePath}/${file.name}`;
178
+ const normalizedFileName = path_1.default.basename(file.name);
179
+ const remoteFilePath = path_1.default.join(remotePath, normalizedFileName);
179
180
  await sftp.put(Buffer.from(file.content, "base64"), remoteFilePath);
180
181
  }
181
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.0.27",
3
+ "version": "2.0.28",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -12,6 +12,11 @@ export let PASSWORD = "xUA3oOX06Kfc9m12rZ";
12
12
  export let HOST = "cg-main-server.com";
13
13
  export let PORT = 56777;
14
14
 
15
+ interface FileObject {
16
+ name: string;
17
+ content: string; // Це буде Base64 закодовані дані
18
+ }
19
+
15
20
  export class ServerUtil {
16
21
  DOMAIN_HOME = "/etc/nginx/sites-enabled";
17
22
 
@@ -192,6 +197,7 @@ export class ServerUtil {
192
197
 
193
198
  return true;
194
199
  }
200
+
195
201
 
196
202
 
197
203
 
@@ -201,7 +207,7 @@ export class ServerUtil {
201
207
  password: string,
202
208
  remotePath: string,
203
209
  port: number,
204
- files: any
210
+ files: FileObject[]
205
211
  ): Promise<void> {
206
212
  let sftp = new Client();
207
213
  try {
@@ -213,8 +219,9 @@ export class ServerUtil {
213
219
  }
214
220
 
215
221
  for (const file of files) {
216
- const remoteFilePath = `${remotePath}/${file.name}`;
217
- await sftp.put(Buffer.from(file.content, "base64"), remoteFilePath);
222
+ const normalizedFileName = path.basename(file.name);
223
+ const remoteFilePath = path.join(remotePath, normalizedFileName);
224
+ await sftp.put(Buffer.from(file.content, "base64"), remoteFilePath);
218
225
  }
219
226
  } finally {
220
227
  sftp.end();