From 04ff50633a882cbae3ef4c8de5c554d545747304 Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Fri, 4 Aug 2023 15:51:27 +0200 Subject: [PATCH 1/2] Fix issue with same source UUID on restarting source --- .../observing/implementations/files.ts | 2 +- application/platform/types/observe/factory.ts | 4 ++-- application/platform/types/observe/index.ts | 5 ++++- .../platform/types/observe/origin/concat.ts | 7 +++++++ application/platform/types/observe/origin/file.ts | 6 +++--- .../platform/types/observe/origin/index.ts | 15 +++++++++++++-- .../platform/types/observe/origin/stream.ts | 10 ++++++++++ 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/application/client/src/app/service/session/dependencies/observing/implementations/files.ts b/application/client/src/app/service/session/dependencies/observing/implementations/files.ts index 64dfd34fce..671597a4e2 100644 --- a/application/client/src/app/service/session/dependencies/observing/implementations/files.ts +++ b/application/client/src/app/service/session/dependencies/observing/implementations/files.ts @@ -42,7 +42,7 @@ export class Provider extends Base { this._sources.push( ...concat.configuration.map((conf: $.Origin.File.IConfiguration) => { const observe = new Factory.File() - .source(conf[0]) + .alias(conf[0]) .type(conf[1]) .file(conf[2]) .parser(source.observe.parser.instance) diff --git a/application/platform/types/observe/factory.ts b/application/platform/types/observe/factory.ts index 00294d3260..5ee55b32e7 100644 --- a/application/platform/types/observe/factory.ts +++ b/application/platform/types/observe/factory.ts @@ -118,11 +118,11 @@ export class File extends Factory { ); } - public source(id: string): File { + public alias(alias: string): File { if (!(this.observe.origin.instance instanceof $.Origin.File.Configuration)) { throw new Error(`Given observe object doesn't have File origin`); } - this.observe.origin.instance.set().source(id); + this.observe.origin.instance.set().alias(alias); this.updated().origin(); return this; } diff --git a/application/platform/types/observe/index.ts b/application/platform/types/observe/index.ts index 04f3292ccc..7cba9c3d76 100644 --- a/application/platform/types/observe/index.ts +++ b/application/platform/types/observe/index.ts @@ -128,7 +128,10 @@ export class Observe } public clone(): Observe { - return new Observe(this.sterilized()); + const cloned = new Observe(this.sterilized()); + // Drop alias to prevent multiple observing entries with same UUID + cloned.origin.set().alias(); + return cloned; } public locker(): { diff --git a/application/platform/types/observe/origin/concat.ts b/application/platform/types/observe/origin/concat.ts index 716b0e52a7..d64fb70576 100644 --- a/application/platform/types/observe/origin/concat.ts +++ b/application/platform/types/observe/origin/concat.ts @@ -65,6 +65,7 @@ export class Configuration defaults(type: Types.File.FileType): Configuration; push(filename: string, type: Types.File.FileType): Configuration; remove(filename: string): Configuration; + alias(alias?: string): Configuration; } { return { files: (files: string[]): Configuration => { @@ -90,6 +91,12 @@ export class Configuration } return this; }, + alias: (alias?: string): Configuration => { + this.configuration.forEach((file) => { + file[0] = alias === undefined ? unique() : alias; + }); + return this; + }, }; } diff --git a/application/platform/types/observe/origin/file.ts b/application/platform/types/observe/origin/file.ts index f2130a713b..ba86383b64 100644 --- a/application/platform/types/observe/origin/file.ts +++ b/application/platform/types/observe/origin/file.ts @@ -67,7 +67,7 @@ export class Configuration public set(): { filename(filename: string): Configuration; type(type: Types.File.FileType): Configuration; - source(id: string): Configuration; + alias(alias?: string): Configuration; } { return { filename: (filename: string): Configuration => { @@ -78,8 +78,8 @@ export class Configuration this.configuration[1] = type; return this; }, - source: (id: string): Configuration => { - this.configuration[0] = id; + alias: (alias: string): Configuration => { + this.configuration[0] = alias === undefined ? unique() : alias; return this; }, }; diff --git a/application/platform/types/observe/origin/index.ts b/application/platform/types/observe/origin/index.ts index e6dcf21f38..6229a0dc4d 100644 --- a/application/platform/types/observe/origin/index.ts +++ b/application/platform/types/observe/origin/index.ts @@ -115,10 +115,10 @@ export class Configuration this.configuration[context] as any, { watcher: this.watcher, - overwrite: ((config: IConfiguration) => { + overwrite: (config: IConfiguration) => { this.overwrite(config); return this.configuration[context] as any; - }) + }, }, ); return this; @@ -223,6 +223,17 @@ export class Configuration } } + public set(): { + alias(alias?: string): void; + } { + return { + // Change signature of source + alias: (alias?: string): void => { + this.instance.set().alias(alias); + }, + }; + } + public override storable(): IConfiguration { return { [this.instance.alias()]: this.instance.storable() }; } diff --git a/application/platform/types/observe/origin/stream.ts b/application/platform/types/observe/origin/stream.ts index bfa99f28b5..6634c1573b 100644 --- a/application/platform/types/observe/origin/stream.ts +++ b/application/platform/types/observe/origin/stream.ts @@ -122,6 +122,16 @@ export class Configuration return this.instance.getSupportedParsers(); } + public set(): { + alias(alias?: string): void; + } { + return { + alias: (alias?: string): void => { + this.configuration[0] = alias === undefined ? unique() : alias; + }, + }; + } + public as( Ref: { new (...args: any[]): Stream.Declaration } & Alias, ): T | undefined { From bf84ab99a23e9023f3f7bd14682da3efaa621134 Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Fri, 4 Aug 2023 15:51:40 +0200 Subject: [PATCH 2/2] Version up 3.9.4 --- application/holder/package.json | 2 +- changelog.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/application/holder/package.json b/application/holder/package.json index c5da490894..2eb8e7e2a6 100644 --- a/application/holder/package.json +++ b/application/holder/package.json @@ -1,6 +1,6 @@ { "name": "chipmunk", - "version": "3.9.3", + "version": "3.9.4", "chipmunk": { "versions": {} }, diff --git a/changelog.md b/changelog.md index 0418d652ae..fb707235e0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,25 @@ +# 3.9.4 + +## Fixes: +- Fix issue with same source UUID on restarting source + +# 3.9.3 + +## Features +- Import / Export filters from context menu on sidebar + +## Fixes: +- Fix quick observe setup + +# 3.9.2 + +## Fixes +- Creates suitable source for exporting as raw +- Allows export SomeIp into binary from PcapNg +- Fixes issue with exporting DLT from PcapNg +- Allows attaching to same session text & binary files after concat operation was done +- Fires error on attempt to attach a file to session with linked session file + # 3.9.1 ## Fixes