-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ivan Kudinov
committed
Sep 26, 2024
1 parent
7b03648
commit 029f96e
Showing
14 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
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 @@ | ||
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
import React, { FC } from 'react' | ||
import { observer } from 'mobx-react' | ||
import styled from 'styled-components' | ||
import { useStore } from '../../hooks/useStore' | ||
import FeatureHeader from '../../components/FeatureHeader' | ||
import Button from '../../components/Button' | ||
import FeaturePage from '../../components/FeaturePage' | ||
|
||
const Buttons = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
` | ||
|
||
const AntimalwarePage: FC = () => { | ||
const { antimalwareStore: store } = useStore() | ||
|
||
const handleOpenRegularFile = () => store.openFile(false) | ||
|
||
const handleOpenInfectedFile = () => store.openFile(true) | ||
|
||
return ( | ||
<FeaturePage> | ||
<FeatureHeader name="Антивирусная проверка файлов" /> | ||
Открыть файл | ||
<Buttons> | ||
<Button onClick={handleOpenRegularFile} id="submit" title="Обычный" icon="image" /> | ||
<Button onClick={handleOpenInfectedFile} id="submit" title="Зараженный" icon="bug_report" /> | ||
</Buttons> | ||
</FeaturePage> | ||
) | ||
} | ||
|
||
export default observer(AntimalwarePage) |
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 @@ | ||
import * as SDK from '@expressms/smartapp-sdk' | ||
import { RootStore } from '../../store/rootStore' | ||
import { File, STATUS, StatusResponse } from '@expressms/smartapp-sdk/build/main/types' | ||
import { makeAutoObservable } from 'mobx' | ||
|
||
export class AntimalwareStore { | ||
rootStore: RootStore | ||
|
||
constructor(rootStore: RootStore) { | ||
makeAutoObservable(this) | ||
|
||
this.rootStore = rootStore | ||
} | ||
|
||
async openFile(infected: boolean): Promise<void> { | ||
try { | ||
const response = (await SDK.Bridge?.sendBotEvent({ | ||
method: 'get_example_file', | ||
params: { | ||
fileType: infected ? 'infected' : 'regular', | ||
}, | ||
})) as StatusResponse | ||
|
||
if (response.payload.status === STATUS.ERROR) { | ||
this.rootStore.toastStore.showToast(`Ошибка получения файла ${JSON.stringify(response.payload)}`) | ||
return | ||
} | ||
|
||
const [file] = response.files as File[] | ||
await SDK.openFile(file) | ||
} catch (e) { | ||
this.rootStore.toastStore.showToast(`Ошибка получения файла ${e?.message}`) | ||
} | ||
} | ||
} |
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
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