fix some safety problem and add copy share feature

This commit is contained in:
seaheart
2023-11-09 23:40:44 +08:00
parent 59a4bfcbb3
commit 1809bc4e09
4 changed files with 16 additions and 11 deletions
+6 -5
View File
@@ -9,20 +9,21 @@ module.exports = {
target: 'http://localhost:6010',
changeOrigin: true,
pathRewrite: {
'^/api': '/api'
}
}
'^/api': '/api',
},
},
},
},
plugins: [
{
// less loader.
plugin: CracoLessPlugin,
options: {
// resolve-url-loader只对sass生效,craco-less默认使用sass配置,所以这里手动过滤掉resolve-url-loader
modifyLessRule: (lessRule) => {
lessRule.use = lessRule.use.filter(i => !i.loader.includes('resolve-url-loader'));
lessRule.use = lessRule.use.filter(
(i) => !i.loader.includes('resolve-url-loader')
);
return lessRule;
},
lessLoaderOptions: {
+5 -1
View File
@@ -59,7 +59,11 @@ export default class Detail extends TankComponent<IProps, IState> {
this.share.uuid = this.props.match.params.uuid;
this.pager.urlPage = Share.URL_MATTER_PAGE;
if (this.user.hasLogin()) {
if (!!BrowserUtil.getQueryByName('code')) {
this.getFiles(BrowserUtil.getQueryByName('code')!);
// 去除url中的code query
window.history.replaceState({}, '', window.location.pathname);
} else if (this.user.hasLogin()) {
this.pager.enableHistory();
this.refresh();
}
+2
View File
@@ -9,6 +9,7 @@ import ShareBar from './widget/ShareBar';
import './List.less';
import Lang from '../../common/model/global/Lang';
import SortDirection from '../../common/model/base/SortDirection';
interface IProps extends RouteComponentProps {}
@@ -23,6 +24,7 @@ export default class List extends TankComponent<IProps, IState> {
componentDidMount() {
this.pager.enableHistory();
this.pager.setFilterValue('orderCreateTime', SortDirection.DESC);
this.refresh();
}
+2 -4
View File
@@ -30,10 +30,8 @@ export default class ShareDialogModal extends TankComponent<IProps, IState> {
copyAll() {
const { share } = this.props;
const text = `${Lang.t('share.link')}:${share.getLink()} ${Lang.t(
'share.code'
)}:${share.code}`;
this.clipboard(text);
const url = `${share.getLink()}?code=${share.code}`;
this.clipboard(url);
}
static open = (share: Share) => {