Set the EULA HTML endpoint
Fixed Http header typos
MODIFY
src/server/rest/v1/router/auth/AuthRouter.ts
src/server/rest/v1/router/auth/AuthRouter.ts
@@ -19,7 +19,8 @@ export default class AuthRouter {
this.buildRouteVerifyMail();
this.buildRouteResendVerificationMail();
this.buildRouteEndUserLicenseAgreement();
- this.buildRouteCheckEndUserLicenseAgreement();
+ this.buildRouteEndUserLicenseAgreementHtml();
+ this.buildRouteEndUserLicenseAgreementCheck();
return this.router;
}
@@ -65,7 +66,13 @@ export default class AuthRouter {
});
}
- protected buildRouteCheckEndUserLicenseAgreement(): void {
+ protected buildRouteEndUserLicenseAgreementHtml(): void {
+ this.router.get(`/${RESTServerRoute.REST_END_USER_LICENSE_AGREEMENT_HTML}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleRestServerAction(AuthService.handleGetEndUserLicenseAgreementHtml.bind(this), ServerAction.END_USER_LICENSE_AGREEMENT, req, res, next);
+ });
+ }
+
+ protected buildRouteEndUserLicenseAgreementCheck(): void {
this.router.get(`/${RESTServerRoute.REST_END_USER_LICENSE_AGREEMENT_CHECK}`, (req: Request, res: Response, next: NextFunction) => {
void RouterUtils.handleRestServerAction(AuthService.handleCheckEndUserLicenseAgreement.bind(this), ServerAction.CHECK_END_USER_LICENSE_AGREEMENT, req, res, next);
});

MODIFY
src/server/rest/v1/service/AssetService.ts
src/server/rest/v1/service/AssetService.ts
@@ -332,7 +332,7 @@ export default class AssetService {
encoding = image.substring(image.indexOf(';') + 1, image.indexOf(',')) as BufferEncoding;
image = image.substring(image.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(image, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/server/rest/v1/service/AuthService.ts
src/server/rest/v1/service/AuthService.ts
@@ -332,11 +332,23 @@ export default class AuthService {
// Filter
const filteredRequest = AuthValidatorRest.getInstance().validateAuthEulaReq(req.query);
// Get it
- const endUserLicenseAgreement = await UserStorage.getEndUserLicenseAgreement(Constants.DEFAULT_TENANT_OBJECT, filteredRequest.Language);
+ const endUserLicenseAgreement = await UserStorage.getEndUserLicenseAgreement(
+ Constants.DEFAULT_TENANT_OBJECT, filteredRequest.Language);
res.json(endUserLicenseAgreement);
next();
}
+ public static async handleGetEndUserLicenseAgreementHtml(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
+ // Filter
+ const filteredRequest = AuthValidatorRest.getInstance().validateAuthEulaReq(req.query);
+ // Get it
+ const endUserLicenseAgreement = await UserStorage.getEndUserLicenseAgreement(
+ Constants.DEFAULT_TENANT_OBJECT, filteredRequest.Language);
+ res.setHeader('Content-Type', 'text/html');
+ res.send(endUserLicenseAgreement.text);
+ next();
+ }
+
public static async handleVerifyEmail(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Filter
const filteredRequest = AuthValidatorRest.getInstance().validateAuthEmailVerifyReq(req.query);

MODIFY
src/server/rest/v1/service/CarService.ts
src/server/rest/v1/service/CarService.ts
@@ -97,7 +97,7 @@ export default class CarService {
encoding = image.substring(image.indexOf(';') + 1, image.indexOf(',')) as BufferEncoding;
image = image.substring(image.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(image, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/server/rest/v1/service/CompanyService.ts
src/server/rest/v1/service/CompanyService.ts
@@ -69,7 +69,7 @@ export default class CompanyService {
encoding = logo.substring(logo.indexOf(';') + 1, logo.indexOf(',')) as BufferEncoding;
logo = logo.substring(logo.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(logo, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/server/rest/v1/service/SiteAreaService.ts
src/server/rest/v1/service/SiteAreaService.ts
@@ -177,7 +177,7 @@ export default class SiteAreaService {
encoding = image.substring(image.indexOf(';') + 1, image.indexOf(',')) as BufferEncoding;
image = image.substring(image.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(image, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -266,7 +266,7 @@ export default class SiteService {
encoding = image.substring(image.indexOf(';') + 1, image.indexOf(',')) as BufferEncoding;
image = image.substring(image.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(image, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/server/rest/v1/service/TenantService.ts
src/server/rest/v1/service/TenantService.ts
@@ -88,7 +88,7 @@ export default class TenantService {
encoding = logo.substring(logo.indexOf(';') + 1, logo.indexOf(',')) as BufferEncoding;
logo = logo.substring(logo.indexOf(',') + 1);
}
- res.setHeader('content-type', header);
+ res.setHeader('Content-Type', header);
res.send(Buffer.from(logo, encoding));
} else {
res.status(StatusCodes.NOT_FOUND);

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -493,6 +493,7 @@ export enum RESTServerRoute {
REST_PASSWORD_RESET = 'password/reset',
REST_END_USER_LICENSE_AGREEMENT = 'eula',
REST_END_USER_LICENSE_AGREEMENT_CHECK = 'eula/check',
+ REST_END_USER_LICENSE_AGREEMENT_HTML = 'eula/html',
REST_MAIL_CHECK = 'mail/check',
REST_MAIL_RESEND = 'mail/resend',

Set the EULA HTML endpoint
Fixed Http header typos