From 10eedadea33778a853375b24fb835fa12108c087 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Sun, 30 Oct 2022 09:42:53 +0800 Subject: [PATCH] feat(source link): create perm source link with shorter url --- config/webpack.config.js | 1 + src/redux/explorer/action.ts | 6 +++++- src/setupProxy.js | 14 +++----------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index bf76442..f4a89b9 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -666,6 +666,7 @@ module.exports = function(webpackEnv) { // a route with query params (e.g. auth callbacks). new RegExp('/[^/?]+\\.[^/]+$'), new RegExp(/^\/api/), + new RegExp(/^\/f/), new RegExp(/^\/custom/), ], }), diff --git a/src/redux/explorer/action.ts b/src/redux/explorer/action.ts index ccdab6a..e0a5ac3 100644 --- a/src/redux/explorer/action.ts +++ b/src/redux/explorer/action.ts @@ -1065,8 +1065,12 @@ export const batchGetSource = (): ThunkAction => { API.post("/file/source", { items: items }) .then((response) => { - console.log(response); dispatch(closeAllModals()); + if (response.data.length == 1 && response.data[0].error) { + dispatch(toggleSnackbar("top", "right", response.data[0].error, "warning")); + return + } + dispatch( openGetSourceDialog( response.data.length == 1 diff --git a/src/setupProxy.js b/src/setupProxy.js index f89a00e..8a2dcbd 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -1,19 +1,11 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const proxy = require("http-proxy-middleware"); module.exports = function (app) { - app.use( - "/api", + ["/api","/custom","/f"].map(p=>app.use( + p, proxy({ target: "http://localhost:5212", changeOrigin: true, }) - ); - - app.use( - "/custom", - proxy({ - target: "http://localhost:5212", - changeOrigin: true, - }) - ); + )) };