From 8cf3f74aff9a3db3725cd85b12946e6b9b18082d Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Tue, 27 Dec 2022 13:45:47 +0300 Subject: [PATCH 1/4] Fix Bug 60353 - Accounts: Sign Up. Portal registration fails. (@self.json 401) --- packages/common/store/AuthStore.js | 15 ++++++++------- packages/common/store/UserStore.js | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/common/store/AuthStore.js b/packages/common/store/AuthStore.js index 27ddea25f9..dd14581dc0 100644 --- a/packages/common/store/AuthStore.js +++ b/packages/common/store/AuthStore.js @@ -53,14 +53,15 @@ class AuthStore { this.skipRequest = skipRequest; - try { - await this.userStore.init(); - } catch (e) { - console.error(e); - } + await this.settingsStore.init(); const requests = []; - requests.push(this.settingsStore.init()); + + if (this.settingsStore.isLoaded && this.settingsStore.socketUrl) { + requests.push(this.userStore.init()); + } else { + this.userStore.setIsLoaded(true); + } if (this.isAuthenticated && !skipRequest) { requests.push( @@ -222,7 +223,7 @@ class AuthStore { get isAuthenticated() { return ( - this.userStore.isAuthenticated || + (this.settingsStore.isLoaded && this.settingsStore.socketUrl) || //this.userStore.isAuthenticated || this.settingsStore.tenantStatus === TenantStatus.PortalRestore ); } diff --git a/packages/common/store/UserStore.js b/packages/common/store/UserStore.js index 7648bac332..3c439bb23b 100644 --- a/packages/common/store/UserStore.js +++ b/packages/common/store/UserStore.js @@ -31,7 +31,11 @@ class UserStore { this.setIsLoading(true); - await this.loadCurrentUser(); + try { + await this.loadCurrentUser(); + } catch (e) { + console.error(e); + } this.setIsLoading(false); this.setIsLoaded(true); From 5c828d4124ff7aed5241332349166b7829264720 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Tue, 27 Dec 2022 13:49:07 +0300 Subject: [PATCH 2/4] upload .ico for favicon --- .../Api/Settings/WhitelabelController.cs | 10 ++++++++-- web/ASC.Web.Core/LogoUploader.cs | 9 +++++++-- web/ASC.Web.Core/Users/UserPhotoManager.cs | 4 ++-- .../WhiteLabel/TenantWhiteLabelSettings.cs | 13 +++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs b/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs index c118c71297..80f7ccb491 100644 --- a/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs +++ b/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs @@ -81,8 +81,14 @@ public class WhitelabelController : BaseSettingsController var logoDict = new Dictionary>(); foreach (var l in inDto.Logo) - { - logoDict.Add(Int32.Parse(l.Key), new KeyValuePair(l.Value.Light, l.Value.Dark)); + { + var key = Int32.Parse(l.Key); + if (key == (int)WhiteLabelLogoTypeEnum.Favicon && !(l.Value.Light.EndsWith("ico") || l.Value.Light.EndsWith("svg"))) + { + throw new InvalidOperationException("Favicon must have .ico or .svg extension"); + } + + logoDict.Add(key, new KeyValuePair(l.Value.Light, l.Value.Dark)); } await _tenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, null); diff --git a/web/ASC.Web.Core/LogoUploader.cs b/web/ASC.Web.Core/LogoUploader.cs index 9fe167201e..308e9febb1 100644 --- a/web/ASC.Web.Core/LogoUploader.cs +++ b/web/ASC.Web.Core/LogoUploader.cs @@ -64,10 +64,15 @@ public class LogoUploader reader.Read(data, 0, (int)logo.Length); reader.Close(); - if (logo.ContentType.Contains("svg")) + if (logo.ContentType.Contains("image/x-icon")) { result.Success = true; - result.Message = await userPhotoManager.SaveTempSvg(data, setupInfo.MaxImageUploadSize); + result.Message = await userPhotoManager.SaveTempPhoto(data, setupInfo.MaxImageUploadSize, "ico"); + } + else if (logo.ContentType.Contains("image/svg+xml")) + { + result.Success = true; + result.Message = await userPhotoManager.SaveTempPhoto(data, setupInfo.MaxImageUploadSize, "svg"); } else { diff --git a/web/ASC.Web.Core/Users/UserPhotoManager.cs b/web/ASC.Web.Core/Users/UserPhotoManager.cs index cc8ba6ff90..ab88be1751 100644 --- a/web/ASC.Web.Core/Users/UserPhotoManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoManager.cs @@ -768,7 +768,7 @@ public class UserPhotoManager return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString(); } - public async Task SaveTempSvg(byte[] data, long maxFileSize) + public async Task SaveTempPhoto(byte[] data, long maxFileSize, string ext) { if (maxFileSize != -1 && data.Length > maxFileSize) { @@ -776,7 +776,7 @@ public class UserPhotoManager } using var stream = new MemoryStream(data); - var fileName = Guid.NewGuid() + ".svg"; + var fileName = Guid.NewGuid() + $".{ext}"; var store = GetDataStore(); return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString(); } diff --git a/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs b/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs index 3657c8a212..e51e1dfb17 100644 --- a/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs +++ b/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs @@ -562,7 +562,13 @@ public class TenantWhiteLabelSettingsHelper return partnerLogoPath; } - return _webImageSupplier.GetAbsoluteWebPath($"logo/" + BuildLogoFileName(type, "svg", dark)); + var ext = type switch + { + WhiteLabelLogoTypeEnum.Favicon => "ico", + _ => "svg" + }; + + return _webImageSupplier.GetAbsoluteWebPath($"logo/" + BuildLogoFileName(type, ext, dark)); } private async Task GetPartnerStorageLogoPath(WhiteLabelLogoTypeEnum type, bool dark) @@ -647,11 +653,6 @@ public class TenantWhiteLabelSettingsHelper return $"{(dark ? "dark_" : "")}{type.ToString().ToLowerInvariant()}.{fileExt}"; } - if (type == WhiteLabelLogoTypeEnum.Favicon) - { - return "favicon.ico"; - } - return $"{type.ToString().ToLowerInvariant()}.{fileExt}"; } From fc1d235166ede4bc9ab86d4494b005f27a5377da Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Tue, 27 Dec 2022 14:06:51 +0300 Subject: [PATCH 3/4] =?UTF-8?q?Fixed=20Bug=2060346=20-=20Rooms.=20?= =?UTF-8?q?=E2=80=98Uncaught=20(in=20promise)=20TypeError:=20r=20is=20not?= =?UTF-8?q?=20a=20function=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/store/ContextOptionsStore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/store/ContextOptionsStore.js b/packages/client/src/store/ContextOptionsStore.js index fca9db95d8..a3cc57f531 100644 --- a/packages/client/src/store/ContextOptionsStore.js +++ b/packages/client/src/store/ContextOptionsStore.js @@ -1035,14 +1035,14 @@ class ContextOptionsStore { key: "pin-room", label: t("PinToTop"), icon: "/static/images/pin.react.svg", - onClick: pinRooms, + onClick: () => pinRooms(t), disabled: false, } : { key: "unpin-room", label: t("Unpin"), icon: "/static/images/unpin.react.svg", - onClick: unpinRooms, + onClick: () => unpinRooms(t), disabled: false, }; From 26b1de6d974d3931abd93af27e6caaec32d6b71c Mon Sep 17 00:00:00 2001 From: Akmal Isomadinov Date: Tue, 27 Dec 2022 16:23:53 +0500 Subject: [PATCH 4/4] Web:Client: Fixed bug(60349) the file opens in the same tab --- .../src/components/panels/UploadPanel/FileRow.js | 13 ++++++++----- packages/client/src/store/SettingsStore.js | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/panels/UploadPanel/FileRow.js b/packages/client/src/components/panels/UploadPanel/FileRow.js index a914ea4a14..28e81284f1 100644 --- a/packages/client/src/components/panels/UploadPanel/FileRow.js +++ b/packages/client/src/components/panels/UploadPanel/FileRow.js @@ -359,7 +359,12 @@ export default inject( name = splitted[0]; } const { personal, theme } = auth.settingsStore; - const { getIconSrc, isArchive } = settingsStore; + const { + canViewedDocs, + isMediaOrImage, + getIconSrc, + isArchive, + } = settingsStore; const { uploaded, primaryProgressDataStore, @@ -377,8 +382,7 @@ export default inject( setCurrentItem, } = mediaViewerDataStore; const { loadingFile: file } = primaryProgressDataStore; - const isMedia = - item.viewAccessability?.ImageView || item.viewAccessability?.MediaView; + const isMedia = isMediaOrImage(ext); const isMediaActive = playlist.findIndex((el) => el.fileId === item.fileId) !== -1; @@ -391,8 +395,7 @@ export default inject( ? loadingFile.percent : null; - const downloadInCurrentTab = - isArchive(ext) || !item.viewAccessability?.WebView; + const downloadInCurrentTab = isArchive(ext) || !canViewedDocs(ext); return { isPersonal: personal, diff --git a/packages/client/src/store/SettingsStore.js b/packages/client/src/store/SettingsStore.js index be229269bf..e4f8c5ba6f 100644 --- a/packages/client/src/store/SettingsStore.js +++ b/packages/client/src/store/SettingsStore.js @@ -194,8 +194,22 @@ class SettingsStore { this.hideConfirmConvertSave = hideConfirmConvertSave; }; + canViewedDocs = (extension) => + presentInArray(this.extsWebPreviewed, extension); + canConvert = (extension) => presentInArray(this.extsMustConvert, extension); + isMediaOrImage = (fileExst) => { + if ( + this.extsVideo.includes(fileExst) || + this.extsImage.includes(fileExst) || + this.extsAudio.includes(fileExst) + ) { + return true; + } + return false; + }; + isArchive = (extension) => presentInArray(this.extsArchive, extension); isImage = (extension) => presentInArray(this.extsImage, extension);