Skip to content

Commit 03257b0

Browse files
committed
checkHash renamed to preprocessHash
1 parent cf5f02a commit 03257b0

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ document.dispatchEvent(event);
132132
* `paginationRppOptions` The pagination options containing the numbers defining how many results should be shown per page. (Default: `[5, 10, 25]`)
133133
* `simultaneousDownloads` Number of simultaneous downloads. (Default: `2`)
134134
* `downloadMethod` HTTP method to use when downloading from the server (`GET`, `POST`, `PUT`, `PATCH`). (Default: `GET`)
135-
* `checkHashModule` Indicates if the built-in hash check module should be added. (Default: `'false'`)
136-
* `checkHashEnabled` Indicates if the built-in hash check should be enabled. (Default: `'true'`)
137-
* `checkHashTarget` The target URL for the GET request to the server for each file to see if it already exists based on the in-browser calculated hash. This can be a `string` or a `function` that allows you you to construct and return a value, based on supplied `params`. (Default: `https://httpbin.org`)
138-
* `checkHashMethod` HTTP method to use when sending file hash check requests. (Default: `'GET'`)
139-
* `checkHashParameterName` The name of the check hash request parameter. (Default: `'hash'`)
140-
* `checkHashFunctionName` The name of the hash function to be used in the built-in hash check. (`sha1`, `md5`) (Default: `'sha1'`)
141-
* `checkHashEncodingName` The name of the encoding scheme to be used in the built-in hash check. (`latin1`, `hex`, `base64`, `utf8`) (Default: `'hex'`)
142-
* `checkHashInputEncodingName` The name of the input encoding scheme to be used in the built-in hash check. (`latin1`, `hex`, `base64`, `utf8`) (Default: `'latin1'`)
135+
* `preprocessHashModule` Indicates if the built-in preprocess hash module should be added. (Default: `'false'`)
136+
* `preprocessHashEnabled` Indicates if the built-in preprocess hash should be enabled. (Default: `'true'`)
137+
* `preprocessHashTarget` The target URL for the GET request to the server for each file to see if it already exists based on the in-browser calculated hash. This can be a `string` or a `function` that allows you you to construct and return a value, based on supplied `params`. (Default: `https://httpbin.org`)
138+
* `preprocessHashMethod` HTTP method to use when sending file preprocess hash requests. (Default: `'GET'`)
139+
* `preprocessHashParameterName` The name of the preprocess hash request parameter. (Default: `'hash'`)
140+
* `preprocessHashFunctionName` The name of the hash function to be used in the built-in preprocess hash module. (`sha1`, `md5`) (Default: `'sha1'`)
141+
* `preprocessHashEncodingName` The name of the encoding scheme to be used in the built-in preprocess hash module. (`latin1`, `hex`, `base64`, `utf8`) (Default: `'hex'`)
142+
* `preprocessHashInputEncodingName` The name of the input encoding scheme to be used in the built-in preprocess hash module. (`latin1`, `hex`, `base64`, `utf8`) (Default: `'latin1'`)
143143

144144
### Resumablejs configuration
145145
* `target` The target URL for the multipart POST request. This can be a `string` or a `function` that allows you you to construct and return a value, based on supplied `params`. (Default: `https://httpbin.org`)

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Export
2626
<mat-icon>expand_more</mat-icon>
2727
</button>
28-
<mat-checkbox *ngIf="datatransferFacade.showPreprocessingCheckbox()" [(ngModel)]="config.core.checkHashEnabled" style="margin-left: 10px;">
28+
<mat-checkbox *ngIf="datatransferFacade.showPreprocessingCheckbox()" [(ngModel)]="config.core.preprocessHashEnabled" style="margin-left: 10px;">
2929
Preprocessing
3030
</mat-checkbox>
3131
</div>

src/app/facades/datatransfer.facade.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export class DatatransferFacade {
291291
}
292292

293293
public showPreprocessingCheckbox(): boolean {
294-
return this.store.count > 0 && this.config.core.checkHashModule;
294+
return this.store.count > 0 && this.config.core.preprocessHashModule;
295295
}
296296

297297
public showSpinner(item: IDatatransferItem): boolean {

src/app/io/datatransfer.io.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export abstract class BaseDatatransfer implements IDatatransfer {
2828

2929
constructor(protected logger: LoggerService, protected config: IAppConfig,
3030
protected guidUtil: GuidUtil, protected cryptoService: CryptoService) {
31-
this.hashType = HashType.toEnum(HashTypeImplementation.Internal, config.core.checkHashFunctionName);
32-
this.encodingType = EncodingType.toEnum(EncodingTypeImplementation.Internal, config.core.checkHashEncodingName);
33-
this.inputEncodingType = EncodingType.toEnum(EncodingTypeImplementation.Internal, config.core.checkHashInputEncodingName);
31+
this.hashType = HashType.toEnum(HashTypeImplementation.Internal, config.core.preprocessHashFunctionName);
32+
this.encodingType = EncodingType.toEnum(EncodingTypeImplementation.Internal, config.core.preprocessHashEncodingName);
33+
this.inputEncodingType = EncodingType.toEnum(EncodingTypeImplementation.Internal, config.core.preprocessHashInputEncodingName);
3434
}
3535

3636
public on(event: string, callback: Function): void {
@@ -92,7 +92,7 @@ export abstract class BaseDatatransfer implements IDatatransfer {
9292
return this.guidUtil.createGuid();
9393
}
9494

95-
protected checkHash(item: IDatatransferItem, file: File, continueCallback: Function, cancelCallback: Function): void {
95+
protected preprocessHash(item: IDatatransferItem, file: File, continueCallback: Function, cancelCallback: Function): void {
9696
let successCallback = function (container: IStreamHashContainer) {
9797
let that = this as BaseDatatransfer;
9898
if (container.hashString) {
@@ -119,7 +119,7 @@ export abstract class BaseDatatransfer implements IDatatransfer {
119119
let params = [];
120120
params = params.concat(
121121
[
122-
[that.config.core.checkHashParameterName, container.hashString]
122+
[that.config.core.preprocessHashParameterName, container.hashString]
123123
]
124124
.map(function (pair) {
125125
return [
@@ -128,7 +128,7 @@ export abstract class BaseDatatransfer implements IDatatransfer {
128128
})
129129
);
130130

131-
xhr.open(that.config.core.checkHashMethod, that.config.core.getTarget('checkHash', params));
131+
xhr.open(that.config.core.preprocessHashMethod, that.config.core.getTarget('preprocessHash', params));
132132
xhr.send(null);
133133

134134
} else {

src/app/io/uploaders/resumablejs.uploader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class ResumableJsUploader extends BaseUploader {
4343
that.changeItemStatus(resumableFile.internalItem, TransferStatus.Preprocessing);
4444
that.preprocessFileFn(resumableFile);
4545
} else {
46-
if (that.config.core.checkHashModule && that.config.core.checkHashEnabled) {
46+
if (that.config.core.preprocessHashModule && that.config.core.preprocessHashEnabled) {
4747
that.changeItemStatus(resumableFile.internalItem, TransferStatus.Preprocessing);
4848
let continueCallback = function() {
4949
resumableFile.preprocessFinished();
@@ -53,7 +53,7 @@ export class ResumableJsUploader extends BaseUploader {
5353
that.changeItemStatus(resumableFile.internalItem, TransferStatus.Finished, resumableFile.internalItem.message);
5454
that.r.uploadNextChunk();
5555
};
56-
that.checkHash(resumableFile.internalItem, resumableFile.file, continueCallback, cancelCallback);
56+
that.preprocessHash(resumableFile.internalItem, resumableFile.file, continueCallback, cancelCallback);
5757
} else {
5858
resumableFile.preprocessFinished();
5959
}

src/app/models/app-config.model.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ export class CoreAppConfig {
1515
paginationRppOptions = [5, 10, 25];
1616
simultaneousDownloads = 2;
1717
downloadMethod = 'GET';
18-
checkHashModule = false;
19-
checkHashEnabled = true;
20-
checkHashTarget = 'https://httpbin.org';
21-
checkHashMethod = 'GET';
22-
checkHashParameterName = 'hash';
23-
checkHashFunctionName = 'sha1';
24-
checkHashEncodingName = 'hex';
25-
checkHashInputEncodingName = 'latin1';
18+
preprocessHashModule = false;
19+
preprocessHashEnabled = true;
20+
preprocessHashTarget = 'https://httpbin.org';
21+
preprocessHashMethod = 'GET';
22+
preprocessHashParameterName = 'hash';
23+
preprocessHashFunctionName = 'sha1';
24+
preprocessHashEncodingName = 'hex';
25+
preprocessHashInputEncodingName = 'latin1';
2626
getTarget = function (request, params) {
2727
let target;
2828

29-
if (request === 'checkHash' && this.checkHashEnabled) {
30-
target = this.checkHashTarget;
29+
if (request === 'preprocessHash' && this.preprocessHashEnabled) {
30+
target = this.preprocessHashTarget;
3131
}
3232

3333
if (typeof target === 'function') {

0 commit comments

Comments
 (0)