diff --git a/src/APIClient/APIClient10.js b/src/APIClient/APIClient10.js
index ad96a84..cb8e714 100644
--- a/src/APIClient/APIClient10.js
+++ b/src/APIClient/APIClient10.js
@@ -444,6 +444,14 @@ class APIClient10 {
return this.request(`/api/v1/dashboard/logout`);
}
+ getFileBlackList(){
+ return this.request(`/api/v1/cidstore/list`);
+ }
+
+ addFileBlackList(arg,batch){
+ return this.request(`/api/v1/cidstore/add?arg=${arg}&batch=${batch}`);
+ }
+
}
const Client10 = new APIClient10();
diff --git a/src/components/Modals/FileBlackListModal.js b/src/components/Modals/FileBlackListModal.js
new file mode 100644
index 0000000..27e233a
--- /dev/null
+++ b/src/components/Modals/FileBlackListModal.js
@@ -0,0 +1,197 @@
+import React, { useEffect, useState } from 'react';
+import { useIntl } from 'react-intl';
+import { getFileBlackList, addFileBlackList } from 'services/filesService.js';
+import { LoadingOutlined } from '@ant-design/icons';
+import { Spin, Input } from 'antd';
+import Emitter from 'utils/eventBus';
+import { t } from 'utils/text.js';
+import CommonModal from './CommonModal';
+import isIPFS from 'is-ipfs';
+
+const { TextArea } = Input;
+
+export default function EncryptFileModal({ color, closeModal, showModal = false }) {
+
+ const intl = useIntl();
+ const [loading, setLoading] = useState(false);
+ const [isEdit, setIsEdit] = useState(false);
+ const [listVal, setListVal] = useState('');
+ const [initListVal, setInitListVal] = useState('');
+ const [validateMsg, setValidateMsg] = useState('');
+
+ const getFileBlackListData = async () => {
+ let listData = await getFileBlackList() || [];
+ let listStr = listData.join('\n') || ''
+ setListVal(listStr);
+ setInitListVal(listStr);
+ };
+
+ useEffect(() => {
+ if (showModal) {
+ setValidateMsg('');
+ getFileBlackListData();
+ }
+ // Emitter.on('openDecryptFileModal', set);
+ return () => {
+ // Emitter.removeListener('openDecryptFileModal');
+ window.body.style.overflow = '';
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [showModal]);
+
+ useEffect(() => {
+ setIsEdit(false);
+ }, [showModal]);
+
+ const validateCid = val => {
+
+ let res = isIPFS.cid(val);
+ if (res) {
+ setValidateMsg('');
+ return true;
+ }
+ return false;
+ };
+
+ // const validateListVal = val => {
+ // console.log(val,'11')
+ // let reg = /^[A-Za-z0-9]+$/;
+ // if (!val || reg.test(val)) {
+ // setValidateMsg('');
+ // return true;
+ // }
+ // if (!reg.test(val)) {
+ // setValidateMsg(t('validate_file_blacklist_cid1'));
+ // return false;
+ // }
+ // return true;
+ // };
+
+ const changeListVal = e => {
+ setListVal(e.target.value);
+ };
+
+ const editFileList = () => {
+ setIsEdit(!isEdit);
+ };
+
+ const cancelEdit = () => {
+ setValidateMsg('');
+ setListVal(initListVal);
+ setIsEdit(false);
+ };
+
+ const saveFileList = async () => {
+ // if (listVal && !validateListVal(listVal)) {
+ // return;
+ // }
+ let listArr = listVal.split('\n');
+ let validateCids = true;
+ for (var v in listArr){
+ if(listArr[v] && !validateCid(listArr[v])){
+ validateCids = false
+ break;
+ }
+
+ }
+ if(!validateCids){
+ setValidateMsg(t('validate_file_blacklist_cid2'));
+ return
+ }
+
+ try {
+ await addFileBlackList(listArr,true);
+ setLoading(false);
+ setInitListVal(listVal);
+ setIsEdit(false)
+ Emitter.emit('showMessageAlert', {
+ message: 'add_file_blacklist_success',
+ status: 'success',
+ type: 'frontEnd',
+ });
+ } catch (e) {
+ Emitter.emit('showMessageAlert', { message: e.Message, status: 'error' });
+ }
+
+ };
+
+
+ return (
+
+
+
+
+ {t('file_blacklist_title')}
+
+ {t('file_blacklist_desc')}
+
+
+ {t('file_blacklist_desc2')}
+
+
+
+
+
+
+
+ {validateMsg}
+
+ {isEdit ? (
+
+
+
+
+ }>
+
+
+
+
+ ) : (
+
+
+
+ }>
+
+
+
+
+ )}
+
+
+
+ );
+}
diff --git a/src/components/Stats/NodeStorageStats.js b/src/components/Stats/NodeStorageStats.js
index ca54125..30fab78 100644
--- a/src/components/Stats/NodeStorageStats.js
+++ b/src/components/Stats/NodeStorageStats.js
@@ -41,7 +41,7 @@ const Contracts = ({ contracts, hostPrice }) => {
{contracts}
- {t('price')}: {hostPrice} WBTT (GB / {t('month')})
+ {t('price')}: {hostPrice} WBTT (GB / {t('day')})
diff --git a/src/components/Tables/LocalFilesTable.js b/src/components/Tables/LocalFilesTable.js
index 51f85cb..1491733 100644
--- a/src/components/Tables/LocalFilesTable.js
+++ b/src/components/Tables/LocalFilesTable.js
@@ -1,11 +1,12 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { useEffect, useState, useCallback, useRef } from 'react';
import { useIntl } from 'react-intl';
-import { Breadcrumb, Pagination, Tabs, Tooltip } from 'antd';
+import { Breadcrumb, Pagination, Tabs, Tooltip, Button } from 'antd';
import PropTypes from 'prop-types';
import FileTableDropdown from 'components/Dropdowns/FileTableDropdown.js';
import ImportFilesDropdown from 'components/Dropdowns/ImportFilesDropdown.js';
import ImportFilesEncryptDropdown from 'components/Dropdowns/ImportFilesEncryptDropdown.js';
+import FileBlackListModal from 'components/Modals/FileBlackListModal.js';
import FileControl from 'components/Footers/FileControl.js';
import S3ApiTable from './S3ApiTable';
import { getRootFiles, getHashByPath, getFolerSize, getFiles, searchFiles } from 'services/filesService.js';
@@ -16,7 +17,6 @@ import moment from 'moment';
import Emitter from 'utils/eventBus';
import { Truncate } from 'utils/text';
-
let didCancel = false;
let filesAll = [];
let nameArray = [];
@@ -31,6 +31,11 @@ export default function LocalFilesTable({ color }) {
const [total, setTotal] = useState(0);
const [current, setCurrent] = useState(1);
const [batch, setBatch] = useState([]);
+ const [activeKey, setActiveKey] = useState('1');
+ const [showFileBlackListModal, setShowFileBlackListModal] = useState(false);
+
+
+
const selectAll = e => {
let fileControl = document.getElementById('fileControl');
@@ -202,6 +207,20 @@ export default function LocalFilesTable({ color }) {
addPath(hash, hash, -1);
};
+ const changeActiveKey = activeKey => {
+ setActiveKey(activeKey);
+ };
+
+ const operations = () => {
+ if (activeKey === '2') {
+ return ;
+ }
+ return null
+ };
+
+
+
+
useEffect(() => {
const set = async function () {
setTimeout(() => {
@@ -223,11 +242,15 @@ export default function LocalFilesTable({ color }) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- console.log('breadcrumbName', breadcrumbName);
return (
<>
-
+
@@ -363,9 +386,10 @@ export default function LocalFilesTable({ color }) {
placement="top"
title={item['Name']}>
- {item['Name']}
+
+ {item['Name']}
+
-
) : (
@@ -454,6 +478,7 @@ export default function LocalFilesTable({ color }) {
data={batch}
/>
+ setShowFileBlackListModal(false)} />
>
diff --git a/src/locale/en.js b/src/locale/en.js
index a28434e..a6f441d 100644
--- a/src/locale/en.js
+++ b/src/locale/en.js
@@ -493,8 +493,21 @@ const en_US = {
upload_success:'Upload Successfully',
download_success:'Download Successfully',
upload_fail:'Upload Failed',
- download_fail:'Download Failed'
-
+ download_fail:'Download Failed',
+
+ //v1.9
+ file_black_list:'文件黑名单',
+ file_blacklist_cancel:'取消',
+ file_blacklist_close:'关闭',
+ file_blacklist_save:'保存',
+ file_blacklist_edit:'编辑',
+ day: 'Day',
+ add_file_blacklist_success:'添加成功',
+ validate_file_blacklist_cid1:'不可输入中文,请使用英文逗号,区分',
+ validate_file_blacklist_cid2:'请输入正确的cid',
+ file_blacklist_title:'黑名单内容',
+ file_blacklist_desc:'请在此处添加需纳入黑名单的内容 CID,每行一个。',
+ file_blacklist_desc2:'被列入黑名单的内容将无法通过 BTFSGateway(8080端口)访问。'
};
diff --git a/src/locale/zh.js b/src/locale/zh.js
index c9c5e56..2c2a18a 100644
--- a/src/locale/zh.js
+++ b/src/locale/zh.js
@@ -479,7 +479,23 @@ const zh_CN = {
upload_success:'上传成功',
download_success:'下载成功',
upload_fail:'上传失败',
- download_fail:'下载失败'
+ download_fail:'下载失败',
+
+
+ //v1.9
+ file_black_list:'文件黑名单',
+ file_blacklist_cancel:'取消',
+ file_blacklist_close:'关闭',
+ file_blacklist_save:'保存',
+ file_blacklist_edit:'编辑',
+ day: '天',
+ add_file_blacklist_success:'添加成功',
+ validate_file_blacklist_cid1:'不可输入中文,请使用英文逗号,区分',
+ validate_file_blacklist_cid2:'请输入正确的cid',
+ file_blacklist_title:'黑名单内容',
+ file_blacklist_desc:'请在此处添加需纳入黑名单的内容 CID,每行一个。',
+ file_blacklist_desc2:'被列入黑名单的内容将无法通过 BTFSGateway(8080端口)访问。'
+
};
diff --git a/src/services/filesService.js b/src/services/filesService.js
index 56654c0..0d70f57 100644
--- a/src/services/filesService.js
+++ b/src/services/filesService.js
@@ -323,3 +323,25 @@ export const decryptUploadFiles = async (cid, hostid, password, t) => {
return false;
}
};
+
+
+export const getFileBlackList = async () => {
+ try {
+ let data = await Client10.getFileBlackList();
+ return data;
+ } catch (e) {
+ console.log(e);
+ }
+};
+
+
+export const addFileBlackList = async (arg,batch) => {
+ try {
+ let data = await Client10.addFileBlackList(arg,batch);
+ return data;
+ } catch (e) {
+ console.log(e);
+ }
+};
+
+