From 8adc75053ce621a9ec09d8c35b63c04f7abd3b0b Mon Sep 17 00:00:00 2001 From: jessevz Date: Tue, 7 Oct 2025 14:16:14 +0200 Subject: [PATCH 1/2] Fixed retrieving cracks of a task --- .../core/_datasources/hashes.datasource.ts | 47 ++----------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/src/app/core/_datasources/hashes.datasource.ts b/src/app/core/_datasources/hashes.datasource.ts index b96d1b63..43205b08 100644 --- a/src/app/core/_datasources/hashes.datasource.ts +++ b/src/app/core/_datasources/hashes.datasource.ts @@ -3,7 +3,6 @@ import { catchError, finalize, of } from 'rxjs'; import { JHash } from '@models/hash.model'; import { Filter, FilterType } from '@models/request-params.model'; import { ResponseWrapper } from '@models/response.model'; -import { JTask } from '@models/task.model'; import { JsonAPISerializer } from '@services/api/serializer-service'; import { SERV } from '@services/main.config'; @@ -27,59 +26,21 @@ export class HashesDataSource extends BaseDataSource { this.loading = true; if (this._dataType === 'tasks') { - const paramsTasks = new RequestParamBuilder().addInitial(this).addInclude('hashlist'); - if (query) { - paramsTasks.addFilter(query); - } - const taskService = this.service.get(SERV.TASKS, this._id, paramsTasks.create()); + const hashesService = this.service.ghelper(SERV.HELPER, "getCracksOfTask?task=" + this._id); this.subscriptions.push( - taskService + hashesService .pipe( catchError(() => of([])), finalize(() => (this.loading = false)) ) .subscribe((response: ResponseWrapper) => { - const task = new JsonAPISerializer().deserialize({ + const hashes = new JsonAPISerializer().deserialize({ data: response.data, included: response.included }); - const hashlistId = task.hashlist.id; - - const paramsHashlist = new RequestParamBuilder() - .addInitial(this) - .addInclude('hashlist') - .addFilter({ field: 'hashlistId', operator: FilterType.EQUAL, value: hashlistId }) - .addFilter({ field: 'isCracked', operator: FilterType.EQUAL, value: true }) - .addFilter({ field: 'hashlistId', operator: FilterType.EQUAL, value: hashlistId }); - if (query) { - paramsHashlist.addFilter(query); - } - const hashlistService = this.service.getAll(SERV.HASHES, paramsHashlist.create()); - - this.subscriptions.push( - hashlistService - .pipe( - catchError(() => of([])), - finalize(() => (this.loading = false)) - ) - .subscribe((responseHash: ResponseWrapper) => { - const hashes = new JsonAPISerializer().deserialize({ - data: responseHash.data, - included: responseHash.included - }); - - const length = responseHash.meta.page.total_elements; - const nextLink = responseHash.links.next; - const prevLink = responseHash.links.prev; - const after = nextLink ? new URL(nextLink).searchParams.get('page[after]') : null; - const before = prevLink ? new URL(prevLink).searchParams.get('page[before]') : null; - - this.setPaginationConfig(this.pageSize, length, after, before, this.index); - this.setData(hashes); - }) - ); + this.setData(hashes); }) ); } else { From 88c9c802e29403c29921f8f5ff1ad920ccfca047 Mon Sep 17 00:00:00 2001 From: jessevz Date: Tue, 7 Oct 2025 14:57:20 +0200 Subject: [PATCH 2/2] Fixed eslint suggestions --- src/app/core/_datasources/hashes.datasource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/_datasources/hashes.datasource.ts b/src/app/core/_datasources/hashes.datasource.ts index 43205b08..435267c9 100644 --- a/src/app/core/_datasources/hashes.datasource.ts +++ b/src/app/core/_datasources/hashes.datasource.ts @@ -26,7 +26,7 @@ export class HashesDataSource extends BaseDataSource { this.loading = true; if (this._dataType === 'tasks') { - const hashesService = this.service.ghelper(SERV.HELPER, "getCracksOfTask?task=" + this._id); + const hashesService = this.service.ghelper(SERV.HELPER, 'getCracksOfTask?task=' + this._id); this.subscriptions.push( hashesService