Skip to content

Commit

Permalink
v1.186.0
Browse files Browse the repository at this point in the history
  • Loading branch information
varovaro committed Sep 30, 2024
2 parents 05cd042 + 4b93f32 commit e1623c8
Show file tree
Hide file tree
Showing 14 changed files with 587 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ describe('convertToPdfWorker', () => {

const recreateRedisQueue = async () => {
try {
await redisSMQ.deleteQueueAsync({ qname: 'convert-to-pdf_results' });
await redisSMQ.deleteQueueAsync({ qname: 'development_convert-to-pdf_results' });
} catch (err) {
if (err instanceof Error && err.name !== 'queueNotFound') {
throw err;
}
}
await redisSMQ.createQueueAsync({ qname: 'convert-to-pdf_results' });
await redisSMQ.createQueueAsync({ qname: 'development_convert-to-pdf_results' });
};

beforeAll(async () => {
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('convertToPdfWorker', () => {
};

await redisSMQ.sendMessageAsync({
qname: 'convert-to-pdf_results',
qname: 'development_convert-to-pdf_results',
message: JSON.stringify(message),
});
});
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('convertToPdfWorker', () => {
jest.spyOn(handleError, 'handleError').mockImplementationOnce(() => {});

await redisSMQ.sendMessageAsync({
qname: 'convert-to-pdf_results',
qname: 'development_convert-to-pdf_results',
message: JSON.stringify(message),
});

Expand Down
4 changes: 2 additions & 2 deletions app/api/services/tasksmanager/TaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class TaskManager<T = TaskMessage, R = ResultsMessage> {

constructor(service: Service<R>) {
this.service = service;
this.taskQueue = `${service.serviceName}_tasks`;
this.resultsQueue = `${service.serviceName}_results`;
this.taskQueue = `${config.ENVIRONMENT}_${service.serviceName}_tasks`;
this.resultsQueue = `${config.ENVIRONMENT}_${service.serviceName}_results`;
const redisUrl = `redis://${config.redis.host}:${config.redis.port}`;
this.redisClient = Redis.createClient(redisUrl);
this.redisSMQ = new RedisSMQ({ client: this.redisClient });
Expand Down
14 changes: 7 additions & 7 deletions app/api/services/tasksmanager/specs/ExternalDummyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ export class ExternalDummyService {
}

async resetQueue() {
await this.deleteQueue(`${this.serviceName}_tasks`);
await this.deleteQueue(`${this.serviceName}_results`);
await this.deleteQueue(`development_${this.serviceName}_tasks`);
await this.deleteQueue(`development_${this.serviceName}_results`);

await this.createQueue(`${this.serviceName}_tasks`);
await this.createQueue(`${this.serviceName}_results`);
await this.createQueue(`development_${this.serviceName}_tasks`);
await this.createQueue(`development_${this.serviceName}_results`);
}

async readFirstTaskMessage() {
const message: RedisSMQ.QueueMessage | {} = await this.rsmq.receiveMessageAsync({
qname: `${this.serviceName}_tasks`,
qname: `development_${this.serviceName}_tasks`,
});
const queueMessage = message as QueueMessage;

Expand All @@ -140,7 +140,7 @@ export class ExternalDummyService {
}

await this.rsmq.deleteMessageAsync({
qname: `${this.serviceName}_tasks`,
qname: `development_${this.serviceName}_tasks`,
id: queueMessage.id,
});

Expand Down Expand Up @@ -186,7 +186,7 @@ export class ExternalDummyService {
async sendFinishedMessage(task: ResultsMessage) {
try {
await this.rsmq.sendMessageAsync({
qname: `${this.serviceName}_results`,
qname: `development_${this.serviceName}_results`,
message: JSON.stringify(task),
});
} catch (err) {
Expand Down
66 changes: 33 additions & 33 deletions app/react/App/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
*/

/*
Expand Down Expand Up @@ -211,6 +211,8 @@ textarea {
/* 1 */
line-height: inherit;
/* 1 */
letter-spacing: inherit;
/* 1 */
color: inherit;
/* 1 */
margin: 0;
Expand All @@ -234,9 +236,9 @@ select {
*/

button,
[type='button'],
[type='reset'],
[type='submit'] {
input:where([type='button']),
input:where([type='reset']),
input:where([type='submit']) {
-webkit-appearance: button;
/* 1 */
background-color: transparent;
Expand Down Expand Up @@ -933,6 +935,10 @@ input[type="range"]::-ms-fill-lower {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
}

::backdrop {
Expand Down Expand Up @@ -983,6 +989,10 @@ input[type="range"]::-ms-fill-lower {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
}

.container {
Expand Down Expand Up @@ -1750,10 +1760,6 @@ input[type="range"]::-ms-fill-lower {
margin-bottom: 1rem;
}

.-ml-0 {
margin-left: -0px;
}

.-ml-0\.5 {
margin-left: -0.125rem;
}
Expand Down Expand Up @@ -2402,12 +2408,6 @@ input[type="range"]::-ms-fill-lower {
gap: 2rem;
}

.space-x-0 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0px * var(--tw-space-x-reverse));
margin-left: calc(0px * calc(1 - var(--tw-space-x-reverse)));
}

.space-x-0\.5 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0.125rem * var(--tw-space-x-reverse));
Expand Down Expand Up @@ -4134,97 +4134,97 @@ input[type="range"]::-ms-fill-lower {
display: none;
}

:is(.dark .dark\:border-gray-600) {
.dark\:border-gray-600:is(.dark *) {
--tw-border-opacity: 1;
border-color: rgb(75 85 99 / var(--tw-border-opacity));
}

:is(.dark .dark\:\!bg-primary-600) {
.dark\:\!bg-primary-600:is(.dark *) {
--tw-bg-opacity: 1 !important;
background-color: rgb(79 70 229 / var(--tw-bg-opacity)) !important;
}

:is(.dark .dark\:\!bg-primary-700) {
.dark\:\!bg-primary-700:is(.dark *) {
--tw-bg-opacity: 1 !important;
background-color: rgb(67 56 202 / var(--tw-bg-opacity)) !important;
}

:is(.dark .dark\:bg-blue-600) {
.dark\:bg-blue-600:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(79 70 229 / var(--tw-bg-opacity));
}

:is(.dark .dark\:bg-gray-600) {
.dark\:bg-gray-600:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(75 85 99 / var(--tw-bg-opacity));
}

:is(.dark .dark\:bg-gray-700) {
.dark\:bg-gray-700:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
}

:is(.dark .dark\:bg-gray-800) {
.dark\:bg-gray-800:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
}

:is(.dark .dark\:text-error-400) {
.dark\:text-error-400:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(244 114 182 / var(--tw-text-opacity));
}

:is(.dark .dark\:text-gray-400) {
.dark\:text-gray-400:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity));
}

:is(.dark .dark\:text-gray-500) {
.dark\:text-gray-500:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(107 114 128 / var(--tw-text-opacity));
}

:is(.dark .dark\:text-white) {
.dark\:text-white:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}

:is(.dark .dark\:placeholder-gray-400)::-moz-placeholder {
.dark\:placeholder-gray-400:is(.dark *)::-moz-placeholder {
--tw-placeholder-opacity: 1;
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
}

:is(.dark .dark\:placeholder-gray-400)::placeholder {
.dark\:placeholder-gray-400:is(.dark *)::placeholder {
--tw-placeholder-opacity: 1;
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
}

:is(.dark .dark\:hover\:\!bg-primary-700:hover) {
.dark\:hover\:\!bg-primary-700:hover:is(.dark *) {
--tw-bg-opacity: 1 !important;
background-color: rgb(67 56 202 / var(--tw-bg-opacity)) !important;
}

:is(.dark .dark\:hover\:bg-blue-700:hover) {
.dark\:hover\:bg-blue-700:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(67 56 202 / var(--tw-bg-opacity));
}

:is(.dark .dark\:hover\:bg-gray-600:hover) {
.dark\:hover\:bg-gray-600:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(75 85 99 / var(--tw-bg-opacity));
}

:is(.dark .dark\:hover\:text-white:hover) {
.dark\:hover\:text-white:hover:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}

:is(.dark .dark\:focus\:border-blue-500:focus) {
.dark\:focus\:border-blue-500:focus:is(.dark *) {
--tw-border-opacity: 1;
border-color: rgb(99 102 241 / var(--tw-border-opacity));
}

:is(.dark .dark\:focus\:ring-blue-500:focus) {
.dark\:focus\:ring-blue-500:focus:is(.dark *) {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity));
}
Expand Down
16 changes: 14 additions & 2 deletions app/react/Markdown/MarkdownViewer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import sanitizeHtml from 'sanitize-html';
import { risonDecodeOrIgnore } from 'app/utils';
import { Translate } from 'app/I18N';
import { MarkdownLink, SearchBox, MarkdownMedia, ItemList } from './components';
import CustomHookComponents from './CustomHooks';

import markdownToReact from './markdownToReact';
import { ValidatedElement } from './ValidatedElement';
import { visualizationHtmlTags } from './utils';

class MarkdownViewer extends Component {
static errorHtml(index, message) {
Expand Down Expand Up @@ -107,8 +109,15 @@ class MarkdownViewer extends Component {
return false;
}

const sanitizedMarkdown = !this.props.sanitized
? this.props.markdown
: sanitizeHtml(this.props.markdown, {
allowedTags: visualizationHtmlTags,
allowedAttributes: false,
});

const ReactFromMarkdown = markdownToReact(
this.props.markdown,
sanitizedMarkdown,
this.customComponent.bind(this),
this.props.html
);
Expand All @@ -120,7 +129,8 @@ class MarkdownViewer extends Component {
return ValidatedElement(
'div',
{ className: 'markdown-viewer' },
...React.Children.toArray(ReactFromMarkdown)
React.Children.toArray(ReactFromMarkdown),
this.props.sanitized
);
}
}
Expand All @@ -130,13 +140,15 @@ MarkdownViewer.defaultProps = {
markdown: '',
html: false,
compact: false,
sanitized: true,
};

MarkdownViewer.propTypes = {
markdown: PropTypes.string,
lists: PropTypes.arrayOf(PropTypes.object),
html: PropTypes.bool,
compact: PropTypes.bool,
sanitized: PropTypes.bool,
};

export default MarkdownViewer;
20 changes: 14 additions & 6 deletions app/react/Markdown/ValidatedElement.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import { validHtmlTags } from './utils';
import { extendedHtmlTags, visualizationHtmlTags } from './utils';

const isValidTagName = (tagName: string): boolean => validHtmlTags.has(tagName);
const isValidTagName = (tagName: string, sanitized: boolean): boolean =>
!sanitized ? extendedHtmlTags.includes(tagName) : visualizationHtmlTags.includes(tagName);

const ValidatedElement = (
type: string | React.JSXElementConstructor<any>,
props: (React.Attributes & { children?: React.ReactNode }) | null,
...children: React.ReactNode[]
children: React.ReactNode[],
sanitized = true
): React.ReactElement | null => {
if (typeof type === 'string' && !isValidTagName(type)) {
if (typeof type === 'string' && !isValidTagName(type, sanitized)) {
return React.createElement('div', { className: 'error' }, `Invalid tag: ${type}`);
}

Expand All @@ -17,15 +19,21 @@ const ValidatedElement = (
return child.map(c => {
const childProps = c.props as React.Attributes & { children?: React.ReactNode };
return React.isValidElement(c)
? ValidatedElement(c.type, childProps, ...React.Children.toArray(childProps.children))
? ValidatedElement(
c.type,
childProps,
React.Children.toArray(childProps.children),
sanitized
)
: c;
});
}
if (React.isValidElement(child)) {
return ValidatedElement(
child.type,
child.props as React.Attributes & { children?: React.ReactNode },
...React.Children.toArray(child.props.children)
React.Children.toArray(child.props.children),
sanitized
);
}
return child;
Expand Down
Loading

0 comments on commit e1623c8

Please sign in to comment.