mirror of
https://github.com/Polaris-Entertainment/bytefy.git
synced 2026-07-07 16:15:09 +00:00
Test queue
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { AsciiToTextComponent } from '../tools/ascii-to-text/ascii-to-text.component';
|
||||
import { GuidComponent } from '../tools/guid/guid.component';
|
||||
import { Base64ConverterComponent } from '../tools/base64-converter/base64-converter.component';
|
||||
import { JwtToJsonComponent } from '../tools/jwt-to-json/jwt-to-json.component';
|
||||
import { TextToCronComponent } from '../tools/text-to-cron/text-to-cron.component';
|
||||
import { DdsToPngComponent } from '../tools/dds-to-png/dds-to-png.component';
|
||||
import { AsciiToTextComponent } from '../tools/client-side/ascii-to-text/ascii-to-text.component';
|
||||
import { GuidComponent } from '../tools/client-side/guid/guid.component';
|
||||
import { Base64ConverterComponent } from '../tools/client-side/base64-converter/base64-converter.component';
|
||||
import { JwtToJsonComponent } from '../tools/client-side/jwt-to-json/jwt-to-json.component';
|
||||
import { TextToCronComponent } from '../tools/client-side/text-to-cron/text-to-cron.component';
|
||||
import { DdsToPngComponent } from '../tools/client-side/dds-to-png/dds-to-png.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DualTextareaComponent } from '../../app/shared/dual-textarea/dual-textarea.component';
|
||||
import { DualTextareaComponent } from '../../../app/shared/dual-textarea/dual-textarea.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ascii-to-text',
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DualTextareaComponent } from '../../app/shared/dual-textarea/dual-textarea.component';
|
||||
import { DualTextareaComponent } from '../../../app/shared/dual-textarea/dual-textarea.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-base64-converter',
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FileConverterComponent } from '../../app/shared/upload/file-converter.component';
|
||||
import { FileConverterComponent } from '../../../app/shared/upload/file-converter.component';
|
||||
import { DdsToPngService } from './dds-to-png.service';
|
||||
|
||||
interface ProcessedFile {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DualTextareaComponent } from '../../app/shared/dual-textarea/dual-textarea.component';
|
||||
import { DualTextareaComponent } from '../../../app/shared/dual-textarea/dual-textarea.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jwt-to-json',
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DualTextareaComponent } from '../../app/shared/dual-textarea/dual-textarea.component';
|
||||
import { DualTextareaComponent } from '../../../app/shared/dual-textarea/dual-textarea.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-text-to-cron',
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable, tap } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ImageService {
|
||||
private baseUrl = 'http://localhost:1337'; // replace with your API base URL
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
convertImage(image: File, format: string): Observable<any> {
|
||||
const formData = new FormData();
|
||||
formData.append('image', image);
|
||||
|
||||
let imgToken = localStorage.getItem('imgToken');
|
||||
|
||||
const headers = new HttpHeaders({
|
||||
'2311d8d8-607d-4747-8939-1bde65643254': imgToken!
|
||||
});
|
||||
|
||||
return this.http.post(`${this.baseUrl}/convert/${format}`, formData, { headers });
|
||||
}
|
||||
|
||||
seteAntiforgeryToken(): void {
|
||||
this.http.get<string>(`${this.baseUrl}/antiforgery/token`, { responseType: 'text' as 'json' }).pipe(
|
||||
tap(token => localStorage.setItem('imgToken', token))
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<p>
|
||||
image-converter works!
|
||||
</p>
|
||||
@@ -0,0 +1,28 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DebugElement } from '@angular/core';
|
||||
|
||||
import { ImageConverterComponent } from './image-converter.component';
|
||||
|
||||
describe('ImageConverterComponent', () => {
|
||||
let component: ImageConverterComponent;
|
||||
let fixture: ComponentFixture<ImageConverterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ImageConverterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ImageConverterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-image-converter',
|
||||
templateUrl: 'image-converter.component.html',
|
||||
styleUrls: ['image-converter.component.scss']
|
||||
})
|
||||
export class ImageConverterComponent {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user