@bprotsyk/aso-core 2.0.43 → 2.0.45

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/lib/app/app.d.ts CHANGED
@@ -29,6 +29,13 @@ export interface IApp extends Document {
29
29
  domainParams: IDomainParams;
30
30
  developerParams: IDeveloperParams;
31
31
  offersListId: number;
32
+ externalParams?: IExternalParams;
33
+ }
34
+ export interface IExternalParams {
35
+ showButton: boolean;
36
+ schema: string;
37
+ autoRedirect: boolean;
38
+ repeatAutoRedirect: boolean;
32
39
  }
33
40
  export interface IRemoteServerParams {
34
41
  ip: string;
@@ -150,6 +157,12 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
150
157
  onesignalAppId?: string | undefined;
151
158
  onesignalRestApiKey?: string | undefined;
152
159
  linkPath?: string | undefined;
160
+ externalParams?: {
161
+ schema?: string | undefined;
162
+ showButton?: boolean | undefined;
163
+ autoRedirect?: boolean | undefined;
164
+ repeatAutoRedirect?: boolean | undefined;
165
+ } | undefined;
153
166
  generationOptions?: {
154
167
  splashName?: string | undefined;
155
168
  webViewName?: string | undefined;
package/lib/app/app.js CHANGED
@@ -70,6 +70,12 @@ exports.AppSchema = new mongoose_1.Schema({
70
70
  linkPath: {
71
71
  type: String
72
72
  },
73
+ externalParams: {
74
+ showButton: Boolean,
75
+ schema: String,
76
+ autoRedirect: Boolean,
77
+ repeatAutoRedirect: Boolean
78
+ },
73
79
  integrationVersion: {
74
80
  type: String,
75
81
  default: IntegrationVersion.OFFER_STUB,
@@ -1,4 +1,4 @@
1
- import { IAppGenerationOptions, IAppKeitaroData, IBannerParams, IDeveloperParams, IDirectParams, IDomainParams, IOffersStubParams, IPrivacyPolicyParams, IRemoteServerParams, IRemoveDataParams, IntegrationVersion } from "app/app";
1
+ import { IAppGenerationOptions, IAppKeitaroData, IBannerParams, IDeveloperParams, IDirectParams, IDomainParams, IExternalParams, IOffersStubParams, IPrivacyPolicyParams, IRemoteServerParams, IRemoveDataParams, IntegrationVersion } from "app/app";
2
2
  export interface IUpsertAppRequest {
3
3
  id: number;
4
4
  name?: string;
@@ -19,9 +19,11 @@ export interface IUpsertAppRequest {
19
19
  remoteServerParams?: IRemoteServerParams;
20
20
  domainParams: IDomainParams;
21
21
  directParams?: IDirectParams;
22
+ externalParams?: IExternalParams;
22
23
  }
23
24
  export interface IUpsertAppResponse {
24
25
  data: IUpsertAppRequest;
25
26
  linkName: string;
26
27
  archive: string;
28
+ externalParams?: IExternalParams;
27
29
  }
@@ -15,6 +15,7 @@ export declare class ServerUtil {
15
15
  sftpConfig: ISFTP;
16
16
  constructor(sftpConfig: ISFTP);
17
17
  connectSSH(): Promise<void>;
18
+ ensureConnected(): Promise<void>;
18
19
  exec(command: string, options?: any): Promise<string>;
19
20
  generateSSHKey(): Promise<string>;
20
21
  createDirectories(): Promise<void>;
@@ -33,9 +33,15 @@ class ServerUtil {
33
33
  password: this.sftpConfig.password,
34
34
  });
35
35
  }
36
+ async ensureConnected() {
37
+ if (!this.ssh.isConnected()) {
38
+ await this.connectSSH(); // Підключення, якщо ще не підключено
39
+ }
40
+ }
36
41
  // Выконує команду або по SSH або локально, повертаючи текст незалежно від результату (помилка чи успіх)
37
42
  async exec(command, options) {
38
- if (this.ssh) {
43
+ await this.ensureConnected();
44
+ if (this.ssh.isConnected()) {
39
45
  return (await this.ssh.execCommand(command, options)).stdout;
40
46
  }
41
47
  else {
@@ -164,13 +170,13 @@ class ServerUtil {
164
170
  await this.ssh.execCommand(`apt-get install -y certbot python3-certbot-nginx;`);
165
171
  return true;
166
172
  }
167
- // creating a SSL certificate
168
173
  async setupSSL(email, host) {
169
- let certbotResponse = await this.exec(`certbot --non-interactive --agree-tos --nginx -m "${email}" -d "${host}"`);
170
- if (certbotResponse.includes(`Some challenges have failed.`)) {
174
+ // Прямий виклик this.ssh.execCommand
175
+ let certbotResponse = await this.ssh.execCommand(`certbot --non-interactive --agree-tos --nginx -m "${email}" -d "${host}"`);
176
+ if (certbotResponse.stdout.includes(`Some challenges have failed.`)) {
171
177
  throw new Error("Certbot encountered an error");
172
178
  }
173
- await this.exec(`echo "0 12 * * * /usr/bin/certbot renew --quiet" | crontab -`);
179
+ await this.ssh.execCommand(`echo "0 12 * * * /usr/bin/certbot renew --quiet" | crontab -`);
174
180
  }
175
181
  // Git
176
182
  async refresh() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.0.43",
3
+ "version": "2.0.45",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
package/src/app/app.ts CHANGED
@@ -37,6 +37,14 @@ export interface IApp extends Document {
37
37
  developerParams: IDeveloperParams
38
38
 
39
39
  offersListId: number
40
+ externalParams?:IExternalParams
41
+ }
42
+
43
+ export interface IExternalParams {
44
+ showButton: boolean;
45
+ schema: string;
46
+ autoRedirect: boolean;
47
+ repeatAutoRedirect:boolean;
40
48
  }
41
49
 
42
50
  export interface IRemoteServerParams {
@@ -206,6 +214,12 @@ export const AppSchema = new Schema({
206
214
  linkPath: {
207
215
  type: String
208
216
  },
217
+ externalParams : {
218
+ showButton: Boolean,
219
+ schema: String,
220
+ autoRedirect: Boolean,
221
+ repeatAutoRedirect:Boolean
222
+ },
209
223
 
210
224
  integrationVersion: {
211
225
  type: String,
@@ -305,6 +319,7 @@ export const AppSchema = new Schema({
305
319
  type: String,
306
320
  },
307
321
  }
322
+
308
323
  })
309
324
 
310
325
  // TODO app type (casino / fin)
@@ -1,4 +1,4 @@
1
- import { IAppGenerationOptions, IAppKeitaroData, IBannerParams, IDeveloperParams, IDirectParams, IDomainParams, IOffersStubParams, IPrivacyPolicyParams, IRemoteServerParams, IRemoveDataParams, IntegrationVersion } from "app/app"
1
+ import { IAppGenerationOptions, IAppKeitaroData, IBannerParams, IDeveloperParams, IDirectParams, IDomainParams, IExternalParams, IOffersStubParams, IPrivacyPolicyParams, IRemoteServerParams, IRemoveDataParams, IntegrationVersion } from "app/app"
2
2
  import { PlugType } from "index"
3
3
 
4
4
  export interface IUpsertAppRequest {
@@ -27,11 +27,14 @@ export interface IUpsertAppRequest {
27
27
  remoteServerParams?: IRemoteServerParams,
28
28
  domainParams: IDomainParams,
29
29
  directParams?: IDirectParams,
30
+ externalParams?:IExternalParams,
30
31
  }
31
32
 
33
+
32
34
  export interface IUpsertAppResponse {
33
35
  data: IUpsertAppRequest,
34
36
  linkName: string,
35
- archive: string
37
+ archive: string,
38
+ externalParams?:IExternalParams,
36
39
  }
37
40
 
@@ -46,9 +46,17 @@ export class ServerUtil {
46
46
  });
47
47
  }
48
48
 
49
+ async ensureConnected(): Promise<void> {
50
+ if (!this.ssh.isConnected()) {
51
+ await this.connectSSH(); // Підключення, якщо ще не підключено
52
+ }
53
+ }
54
+
55
+
49
56
  // Выконує команду або по SSH або локально, повертаючи текст незалежно від результату (помилка чи успіх)
50
57
  async exec(command: string, options?: any): Promise<string> {
51
- if (this.ssh) {
58
+ await this.ensureConnected();
59
+ if (this.ssh.isConnected()) {
52
60
  return (await this.ssh.execCommand(command, options)).stdout;
53
61
  } else {
54
62
  return await new Promise<string>((resolve) => {
@@ -198,18 +206,22 @@ export class ServerUtil {
198
206
 
199
207
  return true;
200
208
  }
201
- // creating a SSL certificate
209
+
202
210
  async setupSSL(email: string, host: string): Promise<void> {
203
- let certbotResponse = await this.exec(
211
+ // Прямий виклик this.ssh.execCommand
212
+ let certbotResponse = await this.ssh.execCommand(
204
213
  `certbot --non-interactive --agree-tos --nginx -m "${email}" -d "${host}"`
205
214
  );
206
- if (certbotResponse.includes(`Some challenges have failed.`)) {
215
+
216
+ if (certbotResponse.stdout.includes(`Some challenges have failed.`)) {
207
217
  throw new Error("Certbot encountered an error");
208
218
  }
209
- await this.exec(
219
+
220
+ await this.ssh.execCommand(
210
221
  `echo "0 12 * * * /usr/bin/certbot renew --quiet" | crontab -`
211
222
  );
212
223
  }
224
+
213
225
 
214
226
  // Git
215
227
  async refresh(): Promise<boolean> {