-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MCS #132
Merged
Merged
Add MCS #132
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d7032d6
Add MCS api
weeman1337 25f2279
Add MCS UI
weeman1337 1042876
Use components from matrix-react-sdk.
weeman1337 f98400c
Move translations to tchap_translations
weeman1337 05e39a8
Make infected content less scary
weeman1337 68c3b4a
Drop NoopContentScanner; use server URL; rename var
weeman1337 075d3b1
Merge branch 'weeman1337/mcs-api' into weeman1337/mcs-ui
weeman1337 54b0067
Implement content scan API error handling
weeman1337 b5902ac
Extract scan() to async function
weeman1337 e4d40c8
Refactor ContentScanningDownloadActionButton
weeman1337 280b276
Rename pendingScans to cachedScans
weeman1337 531a35e
Extract fetchKey function
weeman1337 c796a3b
Remove local content scanner URL override
weeman1337 9f22df7
Use fetchKey
weeman1337 0599b51
Remove unused state
weeman1337 4588e70
Add content_scanner.url config option
weeman1337 535661a
Refactor ContentScanningDownloadActionButton
weeman1337 00e10d2
Let ContentScannerConfig extends IConfigOptions
weeman1337 2fdd144
Refactor contentScannerUrl
weeman1337 d7e350b
Fix ContentScanningDownloadActionButton
weeman1337 9886d2a
Merge branch 'develop_tchap' into weeman1337/mcs-api
weeman1337 c7638ad
Merge branch 'weeman1337/mcs-api' into weeman1337/mcs-ui
weeman1337 2eedf79
Update customisations
weeman1337 ce1a2cc
Fix wait for keys
weeman1337 eb02004
Migrate ContentScanningDownloadActionButton
weeman1337 04e808f
Remove postcss-strip-inline-comments
weeman1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx | ||
index 5841c03..f410ccb 100644 | ||
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx | ||
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx | ||
@@ -22,7 +22,7 @@ import InlineSpinner from '../elements/InlineSpinner'; | ||
import { _t } from "../../../languageHandler"; | ||
import AudioPlayer from "../audio_messages/AudioPlayer"; | ||
import { IMediaEventContent } from "../../../customisations/models/IMediaEventContent"; | ||
-import MFileBody from "./MFileBody"; | ||
+import MFileBody from "../../../../../../src/components/views/messages/OriginalFileBody"; | ||
import { IBodyProps } from "./IBodyProps"; | ||
import { PlaybackManager } from "../../../audio/PlaybackManager"; | ||
import { isVoiceMessage } from "../../../utils/EventUtils"; | ||
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx | ||
index 87d7e41..3acc972 100644 | ||
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx | ||
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx | ||
@@ -22,7 +22,7 @@ import { CSSTransition, SwitchTransition } from 'react-transition-group'; | ||
import { logger } from "matrix-js-sdk/src/logger"; | ||
import { ClientEvent, ClientEventHandlerMap } from "matrix-js-sdk/src/client"; | ||
|
||
-import MFileBody from './MFileBody'; | ||
+import MFileBody from "../../../../../../src/components/views/messages/OriginalFileBody"; | ||
import Modal from '../../../Modal'; | ||
import { _t } from '../../../languageHandler'; | ||
import SettingsStore from "../../../settings/SettingsStore"; | ||
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MStickerBody.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MStickerBody.tsx | ||
index 18d8e4d..695662a 100644 | ||
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MStickerBody.tsx | ||
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MStickerBody.tsx | ||
@@ -16,7 +16,7 @@ limitations under the License. | ||
|
||
import React from 'react'; | ||
|
||
-import MImageBody from './MImageBody'; | ||
+import MImageBody from "../../../../../../src/components/views/messages/OriginalImageBody"; | ||
import { BLURHASH_FIELD } from "../../../utils/image-media"; | ||
import Tooltip from "../elements/Tooltip"; | ||
import { IMediaEventContent } from "../../../customisations/models/IMediaEventContent"; | ||
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MVideoBody.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MVideoBody.tsx | ||
index fefedc6..08d7790 100644 | ||
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MVideoBody.tsx | ||
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MVideoBody.tsx | ||
@@ -25,7 +25,7 @@ import { mediaFromContent } from "../../../customisations/Media"; | ||
import { BLURHASH_FIELD } from "../../../utils/image-media"; | ||
import { IMediaEventContent } from "../../../customisations/models/IMediaEventContent"; | ||
import { IBodyProps } from "./IBodyProps"; | ||
-import MFileBody from "./MFileBody"; | ||
+import MFileBody from "../../../../../../src/components/views/messages/OriginalFileBody"; | ||
import { ImageSize, suggestedSize as suggestedVideoSize } from "../../../settings/enums/ImageSize"; | ||
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext"; | ||
import MediaProcessingError from './shared/MediaProcessingError'; | ||
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx | ||
index 7bcefff..824fa36 100644 | ||
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx | ||
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx | ||
@@ -19,8 +19,8 @@ import React from "react"; | ||
import InlineSpinner from '../elements/InlineSpinner'; | ||
import { _t } from "../../../languageHandler"; | ||
import RecordingPlayback from "../audio_messages/RecordingPlayback"; | ||
-import MAudioBody from "./MAudioBody"; | ||
-import MFileBody from "./MFileBody"; | ||
+import MAudioBody from "../../../../../../src/components/views/messages/OriginalAudioBody"; | ||
+import MFileBody from "../../../../../../src/components/views/messages/OriginalFileBody"; | ||
import MediaProcessingError from "./shared/MediaProcessingError"; | ||
|
||
export default class MVoiceMessageBody extends MAudioBody { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.mx_BlockedIcon { | ||
background-color: #f07a12; | ||
border-radius: 4px; | ||
content: ''; | ||
display: inline-block; | ||
height: 40px; | ||
position: relative; | ||
width: 40px; | ||
|
||
&::after { | ||
background-color: #fff; | ||
content: ''; | ||
height: 20px; | ||
left: 10px; | ||
mask-image: url('../../../img/blocked.svg'); | ||
mask-position: center; | ||
mask-repeat: no-repeat; | ||
mask-size: contain; | ||
position: absolute; | ||
top: 10px; | ||
width: 20px; | ||
} | ||
} | ||
|
||
.mx_BlockedIcon_messageContext { | ||
height: 28px; | ||
width: 28px; | ||
z-index: 1; | ||
|
||
&::after { | ||
height: 24px; | ||
left: 2px; | ||
top: 2px; | ||
width: 24px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.mx_ContentScanningStatus_scanning--light, | ||
.mx_ContentScanningStatus_done--light { | ||
color: #61708b; | ||
} | ||
|
||
.mx_ContentScanningStatus_scanning--dark, | ||
.mx_ContentScanningStatus_done--dark { | ||
color: #b9bec6; | ||
} | ||
|
||
.mx_ContentScanningStatus_scanning--custom-Tchap, | ||
.mx_ContentScanningStatus_done--custom-Tchap { | ||
color: var(--timeline-text-color-50pct); | ||
} | ||
|
||
.mx_ContentScanningStatus_unsafe, | ||
.mx_ContentScanningStatus_error { | ||
color: #f07a12; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
Copyright 2022 New Vector Ltd | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
|
||
.mx_EventTile[data-layout="bubble"] { | ||
.mx_EventTile_mediaLine > a:first-child { | ||
bottom: 18px; // Scan result line | ||
} | ||
|
||
.mx_EventTile_image > a:first-child { | ||
bottom: 23px; // Scan result line + 5px image flex gap | ||
} | ||
} | ||
|
||
.mx_MFileBody_download_icon.mx_MFileBody_download_icon { | ||
mask-image: url("~matrix-react-sdk/res/img/element-icons/roomlist/checkmark.svg"); | ||
height: 10px; | ||
mask-size: 18px; | ||
margin-right: 4px; | ||
} | ||
|
||
.mx_MFileBody_info { | ||
.mx_InlineSpinner { | ||
height: 32px; | ||
|
||
.mx_InlineSpinner_icon { | ||
margin: 6px; | ||
} | ||
} | ||
} | ||
|
||
.mx_MFileBody_scanning { | ||
.mx_MFileBody_info.mx_MFileBody_info .mx_MFileBody_info_icon::before { | ||
content: unset; | ||
} | ||
} | ||
|
||
.mx_MFileBody_unsafe_icon { | ||
background-color: #f07a12; | ||
border-radius: 4px; | ||
display: inline-block; | ||
height: 32px; | ||
margin-right: 12px; | ||
position: relative; | ||
vertical-align: middle; | ||
width: 32px; | ||
|
||
&::before { | ||
background-color: #fff; // hardcoded | ||
content: ''; | ||
height: 17px; | ||
left: 7px; | ||
mask-image: url('../../../img/blocked.svg'); | ||
mask-position: center; | ||
mask-repeat: no-repeat; | ||
mask-size: contain; | ||
position: absolute; | ||
top: 7px; | ||
width: 17px; | ||
} | ||
} | ||
|
||
.mx_MFileBody_download { | ||
.mx_AccessibleButton { | ||
display: inline-block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.mx_MImageBody { | ||
position: relative; | ||
} | ||
|
||
.mx_EventTile_image, | ||
.mx_EventTile_sticker, | ||
.mx_EventTile_mediaLine { | ||
flex-direction: column; | ||
} | ||
|
||
.mx_EventTile .mx_EventTile_line.mx_EventTile_mediaLine { | ||
.mx_MImageBody_pending, | ||
.mx_MImageBody_error, | ||
.mx_MImageBody_unsafe { | ||
background-color: rgba(141, 151, 165, 0.2); | ||
border-radius: 8px; | ||
display: inline-block; | ||
} | ||
} | ||
|
||
.mx_MImageBody_BlockedIcon { | ||
left: calc(50% - 20px); | ||
position: absolute; | ||
top: calc(50% - 20px); | ||
z-index: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.mx_MVideoBody { | ||
position: relative; | ||
} | ||
|
||
.mx_EventTile_image { | ||
flex-direction: column; | ||
} | ||
|
||
.mx_EventTile .mx_EventTile_line.mx_EventTile_mediaLine { | ||
.mx_MVideoBody_pending, | ||
.mx_MVideoBody_error, | ||
.mx_MVideoBody_unsafe { | ||
background-color: rgba(141, 151, 165, 0.2); | ||
border-radius: 8px; | ||
display: inline-block; | ||
} | ||
} | ||
|
||
.mx_MVideoBody_BlockedIcon { | ||
left: calc(50% - 20px); | ||
position: absolute; | ||
top: calc(50% - 20px); | ||
z-index: 1; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to reuse colors, like --var(warning) or something.
Not a blocker, if it's not a 5 minute task then let's file an issue instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree. Unfortunately, when not using a custom theme we don't have this variables. This is a > 5 minutes task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIth Angelo, we want to use a different way to custom the theme : #130
It could be add to the issue when it will be priorized.