diff --git a/packages/asc-web-common/package.json b/packages/asc-web-common/package.json index 6a80ad2a68..8d0c59d56b 100644 --- a/packages/asc-web-common/package.json +++ b/packages/asc-web-common/package.json @@ -13,6 +13,6 @@ "timeout": "30000" }, "proxy": { - "url": "/appserver" + "url": "" } } diff --git a/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js b/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js index 63ed5e9d95..a9b2f69e8c 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js +++ b/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js @@ -6,6 +6,9 @@ import { isMobile } from "react-device-detect"; import { inject, observer } from "mobx-react"; import { withRouter } from "react-router"; +import { combineUrl } from "@appserver/common/utils"; +import { AppServerConfig } from "@appserver/common/constants"; +import config from "../../../../package.json"; const StyledThirdParty = styled.div` margin-top: 42px; @@ -103,11 +106,13 @@ const PureThirdPartyListContainer = ({ history, }) => { const redirectAction = () => { - const thirdPartyUrl = "/products/files/settings/thirdParty"; - if (history.location.pathname !== thirdPartyUrl) { + const thirdPartyUrl = "/settings/thirdParty"; + if (history.location.pathname.indexOf(thirdPartyUrl) === -1) { setSelectedNode(["thirdParty"]); setSelectedFolder(null); - return history.push(thirdPartyUrl); + return history.push( + combineUrl(AppServerConfig.proxyURL, config.homepage, thirdPartyUrl) + ); } }; diff --git a/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js b/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js index b71efaddc6..ac6af34e8c 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js +++ b/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js @@ -9,6 +9,9 @@ import SettingsIcon from "../../../../../../../public/images/settings.react.svg" import ExpanderDownIcon from "../../../../../../../public/images/expander-down.react.svg"; import ExpanderRightIcon from "../../../../../../../public/images/expander-right.react.svg"; import commonIconsStyles from "@appserver/components/utils/common-icons-style"; +import config from "../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; +import { AppServerConfig } from "@appserver/common/constants"; const StyledTreeMenu = styled(TreeMenu)` margin-top: 18px !important; @@ -115,12 +118,24 @@ const PureTreeSettings = ({ setSelectedNode(["common"]); if (!expandedSetting || expandedSetting[0] !== "settings") setExpandSettingsTree(section); - return history.push("/products/files/settings/common"); + return history.push( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + "/settings/common" + ) + ); } if (selectedTreeNode[0] !== path) { setSelectedNode(section); - return history.push(`/products/files/settings/${path}`); + return history.push( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/settings/${path}` + ) + ); } }; diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index 864369c0f2..cf5c0fedbe 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -11,6 +11,8 @@ import ThirdPartyList from "./ThirdPartyList"; import { inject, observer } from "mobx-react"; import { withRouter } from "react-router-dom"; import config from "../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; +import { AppServerConfig } from "@appserver/common/constants"; class ArticleBodyContent extends React.Component { constructor(props) { @@ -51,6 +53,7 @@ class ArticleBodyContent extends React.Component { const newFilter = filter.clone(); newFilter.page = 0; newFilter.startIndex = 0; + newFilter.folder = data[0]; const selectedFolderTitle = (e.node && e.node.props && e.node.props.title) || null; @@ -59,14 +62,16 @@ class ArticleBodyContent extends React.Component { ? setDocumentTitle(selectedFolderTitle) : setDocumentTitle(); - if (window.location.pathname.indexOf("/files/filter") > 0) { + if (window.location.pathname.indexOf("/filter") > 0) { fetchFiles(data[0], newFilter) .catch((err) => toastr.error(err)) .finally(() => setIsLoading(false)); } else { newFilter.startIndex = 0; const urlFilter = newFilter.toUrlParams(); - history.push(`${homepage}/filter?${urlFilter}`); + history.push( + combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`) + ); } } }; diff --git a/products/ASC.Files/Client/src/components/Article/MainButton/index.js b/products/ASC.Files/Client/src/components/Article/MainButton/index.js index 409fade77e..83310a1c84 100644 --- a/products/ASC.Files/Client/src/components/Article/MainButton/index.js +++ b/products/ASC.Files/Client/src/components/Article/MainButton/index.js @@ -6,10 +6,12 @@ import DropDownItem from "@appserver/components/drop-down-item"; import { withTranslation } from "react-i18next"; import { isMobile } from "react-device-detect"; import Loaders from "@appserver/common/components/Loaders"; -import { FileAction } from "@appserver/common/constants"; +import { FileAction, AppServerConfig } from "@appserver/common/constants"; import { encryptionUploadDialog } from "../../../helpers/desktop"; import { inject, observer } from "mobx-react"; import config from "../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; + class PureArticleMainButtonContent extends React.Component { onCreate = (e) => { // this.goToHomePage(); @@ -39,7 +41,9 @@ class PureArticleMainButtonContent extends React.Component { goToHomePage = () => { const { homepage, history, filter } = this.props; const urlFilter = filter.toUrlParams(); - history.push(`${homepage}/filter?${urlFilter}`); + history.push( + combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`) + ); }; onFileChange = (e) => { diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/FilesRowContent.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/FilesRowContent.js index 436f32d82c..0438dc365e 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/FilesRowContent.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/FilesRowContent.js @@ -12,7 +12,11 @@ import { convertFile, getFileConversationProgress, } from "@appserver/common/api/files"; -import { FileAction, ShareAccessRights } from "@appserver/common/constants"; +import { + AppServerConfig, + FileAction, + ShareAccessRights, +} from "@appserver/common/constants"; import toastr from "studio/toastr"; import FavoriteIcon from "../../../../../../../public/images/favorite.react.svg"; import FileActionsConvertEditDocIcon from "../../../../../../../public/images/file.actions.convert.edit.doc.react.svg"; @@ -27,6 +31,7 @@ import EditingWrapperComponent from "../EditingWrapperComponent"; import { isMobile } from "react-device-detect"; import { observer, inject } from "mobx-react"; import config from "../../../../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; const sideColor = "#A3A9AE"; const StyledCheckIcon = styled(CheckIcon)` @@ -187,7 +192,14 @@ class FilesRowContent extends React.PureComponent { let tab = !isDesktop && item.fileExst - ? window.open("/products/files/doceditor", "_blank") + ? window.open( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + "/products/files/doceditor" + ), + "_blank" + ) : null; !item.fileExst @@ -381,7 +393,9 @@ class FilesRowContent extends React.PureComponent { fetchFileVersions(item.id + ""); setIsVerHistoryPanel(true); } else { - history.push(`${homepage}/${item.id}/history`); + history.push( + combineUrl(AppServerConfig.proxyURL, homepage, `/${item.id}/history`) + ); } }; diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/SimpleFilesRow.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/SimpleFilesRow.js index d9a0a31cd0..f2d3dbff70 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/SimpleFilesRow.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRow/SimpleFilesRow.js @@ -10,9 +10,10 @@ import Row from "@appserver/components/row"; import FilesRowContent from "./FilesRowContent"; import { withRouter } from "react-router-dom"; import toastr from "studio/toastr"; -import { FileAction } from "@appserver/common/constants"; +import { FileAction, AppServerConfig } from "@appserver/common/constants"; import copy from "copy-to-clipboard"; import config from "../../../../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; const StyledSimpleFilesRow = styled(Row)` margin-top: -2px; @@ -190,7 +191,9 @@ const SimpleFilesRow = (props) => { fetchFileVersions(id + ""); setIsVerHistoryPanel(true); } else { - history.push(`${homepage}/${id}/history`); + history.push( + combineUrl(AppServerConfig.proxyURL, homepage, `/${id}/history`) + ); } }; diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesTileContent.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesTileContent.js index f3893694b7..5c60010bc4 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesTileContent.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesTileContent.js @@ -6,7 +6,7 @@ import Badge from "@appserver/components/badge"; import Link from "@appserver/components/link"; import Text from "@appserver/components/text"; import { markAsRead } from "@appserver/common/api/files"; -import { FileAction } from "@appserver/common/constants"; +import { FileAction, AppServerConfig } from "@appserver/common/constants"; import toastr from "studio/toastr"; import { getTitleWithoutExst } from "../../../../../helpers/files-helpers"; import { NewFilesPanel } from "../../../../panels"; @@ -17,6 +17,7 @@ import { inject, observer } from "mobx-react"; import CheckIcon from "../../../../../../public/images/check.react.svg"; import CrossIcon from "../../../../../../../../../public/images/cross.react.svg"; import config from "../../../../../../package.json"; +import { combineUrl } from "@appserver/common/utils"; const SimpleFilesTileContent = styled(TileContent)` .rowMainContainer { @@ -282,7 +283,9 @@ class FilesTileContent extends React.PureComponent { const { homepage, history } = this.props; const fileId = e.currentTarget.dataset.id; - history.push(`${homepage}/${fileId}/history`); + history.push( + combineUrl(AppServerConfig.proxyURL, homepage, `/${fileId}/history`) + ); }; onBadgeClick = () => { diff --git a/products/ASC.Files/Client/src/components/panels/NewFilesPanel/index.js b/products/ASC.Files/Client/src/components/panels/NewFilesPanel/index.js index fd114a7577..af9468ff82 100644 --- a/products/ASC.Files/Client/src/components/panels/NewFilesPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/NewFilesPanel/index.js @@ -21,7 +21,9 @@ import { StyledFooter, } from "../StyledPanels"; import { inject, observer } from "mobx-react"; - +import { combineUrl } from "@appserver/common/utils"; +import { AppServerConfig } from "@appserver/common/constants"; +import config from "../../../../package.json"; class NewFilesPanelComponent extends React.Component { constructor(props) { super(props); @@ -122,7 +124,16 @@ class NewFilesPanelComponent extends React.Component { return addFileToRecentlyViewed(id) .then(() => console.log("Pushed to recently viewed")) .catch((e) => console.error(e)) - .finally(window.open(`./doceditor?fileId=${id}`, "_blank")); + .finally( + window.open( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/doceditor?fileId=${id}` + ), + "_blank" + ) + ); } if (isMedia) { diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index f3a1b98456..8f29c5a36b 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -6,6 +6,7 @@ import { FilterType, FileType, FileAction, + AppServerConfig, } from "@appserver/common/constants"; import history from "@appserver/common/history"; import FileActionStore from "./FileActionStore"; @@ -14,6 +15,7 @@ import formatsStore from "./FormatsStore"; import treeFoldersStore from "./TreeFoldersStore"; import { createTreeFolders } from "../helpers/files-helpers"; import config from "../../package.json"; +import { combineUrl } from "@appserver/common/utils"; const { FilesFilter } = api; @@ -187,7 +189,13 @@ class FilesStore { setFilterUrl = (filter) => { const urlFilter = filter.toUrlParams(); - history.push(`${config.homepage}/filter?${urlFilter}`); + history.push( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/filter?${urlFilter}` + ) + ); }; fetchFiles = (folderId, filter, clearFilter = true) => { @@ -938,7 +946,14 @@ class FilesStore { if (providerKey) { tab ? (tab.location = url) - : window.open(`./doceditor?fileId=${id}`, "_blank"); + : window.open( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/doceditor?fileId=${id}` + ), + "_blank" + ); } else { return this.addFileToRecentlyViewed(id) .then(() => console.log("Pushed to recently viewed")) @@ -946,7 +961,14 @@ class FilesStore { .finally( tab ? (tab.location = url) - : window.open(`./doceditor?fileId=${id}`, "_blank") + : window.open( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/doceditor?fileId=${id}` + ), + "_blank" + ) ); } }; diff --git a/web/ASC.Web.Client/src/Shell.jsx b/web/ASC.Web.Client/src/Shell.jsx index 66319dc511..b33ccedb4f 100644 --- a/web/ASC.Web.Client/src/Shell.jsx +++ b/web/ASC.Web.Client/src/Shell.jsx @@ -57,23 +57,6 @@ const PAYMENTS_URL = combineUrl(PROXY_HOMEPAGE_URL, "/payments"); const SETTINGS_URL = combineUrl(PROXY_HOMEPAGE_URL, "/settings"); const ERROR_401_URL = combineUrl(PROXY_HOMEPAGE_URL, "/error401"); -if (!window.AppServer) { - window.AppServer = {}; -} - -window.AppServer.studio = { - HOME_URLS, - WIZARD_URL, - ABOUT_URL, - LOGIN_URLS, - CONFIRM_URL, - COMING_SOON_URLS, - THIRD_PARTY_RESPONSE_URL, - PAYMENTS_URL, - SETTINGS_URL, - ERROR_401_URL, -}; - const Payments = React.lazy(() => import("./components/pages/Payments")); const Error404 = React.lazy(() => import("studio/Error404")); const Error401 = React.lazy(() => import("studio/Error401")); @@ -175,10 +158,28 @@ const ThirdPartyResponseRoute = (props) => ( ); const Shell = ({ items = [], page = "home", ...rest }) => { - const { isLoaded, loadBaseInfo, isThirdPartyResponse, modules } = rest; + const { isLoaded, loadBaseInfo, modules } = rest; useEffect(() => { try { + if (!window.AppServer) { + window.AppServer = {}; + } + + //TEMP object, will be removed!!! + window.AppServer.studio = { + HOME_URLS, + WIZARD_URL, + ABOUT_URL, + LOGIN_URLS, + CONFIRM_URL, + COMING_SOON_URLS, + THIRD_PARTY_RESPONSE_URL, + PAYMENTS_URL, + SETTINGS_URL, + ERROR_401_URL, + }; + loadBaseInfo(); } catch (err) { toastr.error(err); @@ -231,6 +232,8 @@ const Shell = ({ items = [], page = "home", ...rest }) => { ); }); + //console.log("Shell ", history); + return ( @@ -272,7 +275,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => { const ShellWrapper = inject(({ auth }) => { const { init, isLoaded } = auth; const pathname = window.location.pathname.toLowerCase(); - const isThirdPartyResponse = pathname.indexOf("thirdparty") !== -1; + //const isThirdPartyResponse = pathname.indexOf("thirdparty") !== -1; return { loadBaseInfo: () => { @@ -280,7 +283,7 @@ const ShellWrapper = inject(({ auth }) => { auth.settingsStore.setModuleInfo(config.homepage, "home"); auth.setProductVersion(config.version); }, - isThirdPartyResponse, + //isThirdPartyResponse, isLoaded, modules: auth.moduleStore.modules, }; diff --git a/web/ASC.Web.Login/src/Login.jsx b/web/ASC.Web.Login/src/Login.jsx index 3b49fa23dd..46d208854f 100644 --- a/web/ASC.Web.Login/src/Login.jsx +++ b/web/ASC.Web.Login/src/Login.jsx @@ -20,7 +20,6 @@ import { createPasswordHash, tryRedirectTo } from "@appserver/common/utils"; import { inject, observer } from "mobx-react"; import i18n from "./i18n"; import { I18nextProvider, useTranslation } from "react-i18next"; -import throttle from "lodash/throttle"; const LoginContainer = styled.div` display: flex; @@ -153,6 +152,7 @@ const Form = (props) => { match, organizationName, greetingTitle, + history, } = props; const { error, confirmedEmail } = match.params; @@ -247,7 +247,7 @@ const Form = (props) => { isDesktop && checkPwd(); login(userName, hash) - .then(() => tryRedirectTo(defaultPage)) + .then(() => history.push(defaultPage)) .catch((error) => { setErrorText(error); setIdentifierValid(!error);