Skip to content

Commit

Permalink
fix: frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed May 7, 2024
1 parent 64ddea7 commit 2af8464
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
.sessionManagement(mySm -> mySm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.headers(myHeaders -> myHeaders.xssProtection(myXss -> myXss.headerValue(HeaderValue.ENABLED)))
.headers(myHeaders -> myHeaders.contentSecurityPolicy(myCsp -> myCsp.policyDirectives(
"default-src 'self' data:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';")))
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';")))
.headers(myHeaders -> myHeaders.frameOptions(myFo -> myFo.sameOrigin()))
// .addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="upload-spinner"><mat-spinner></mat-spinner></div>
} @else if(result) {
<div class="horizontal-container">
<div><img [src]="createImageUrl()"></div>
<div><img [src]="result.b64Image"></div>
<div>{{result.answer}}</div>
</div>
} @else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export class ImageQueryComponent {
this.imageForm.controls.file.setValue(!!files && files.length > 0 ? files[0] : null);
}

protected createImageUrl(): string {
return !this.result ? '' : 'data:image/'+this?.result?.imageType+';base64,'+this?.result?.b64Image;
protected createImageUrl(myResult: ImageFile): ImageFile {
if(!!myResult) {
myResult.b64Image = 'data:image/'+myResult?.imageType+';base64,'+myResult?.b64Image;
}
return myResult
}

protected upload(): void {
Expand All @@ -75,7 +78,7 @@ export class ImageQueryComponent {
)
.subscribe((result) => {
this.uploading = false;
this.result = result;
this.result = this.createImageUrl(result);
this.imageForm.controls.file.setValue(null);
//console.log(result);
});
Expand Down

0 comments on commit 2af8464

Please sign in to comment.