From 7a4356cf98ebb86722bc790d02c618765663ae03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A2=E4=B9=90=E9=A9=AC?= <38058090+SkywalkerSpace@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:51:44 +0800 Subject: [PATCH 1/6] 10.0 update pillow (#5934) --- requirements.txt | 6 +++--- seahub/avatar/settings.py | 2 +- seahub/thumbnail/utils.py | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/requirements.txt b/requirements.txt index b58ff91348..c588b1ce83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ django-statici18n==2.3.* django_webpack_loader==1.7.* django_picklefield==3.1 django_formtools==2.4 -django_simple_captcha==0.5.* +django_simple_captcha==0.5.20 djangosaml2==1.5.* djangorestframework==3.14.* python-dateutil==2.8.* @@ -17,10 +17,10 @@ future==0.18.* gunicorn==20.1.* mysqlclient==2.1.* qrcode==7.3.* -pillow==9.3.* +pillow==10.0.* chardet==5.1.* cffi==1.15.1 -captcha==0.4 +captcha==0.5.* openpyxl==3.0.* Markdown==3.4.* bleach==5.0.* diff --git a/seahub/avatar/settings.py b/seahub/avatar/settings.py index 7fb436230a..5c1ff739ce 100644 --- a/seahub/avatar/settings.py +++ b/seahub/avatar/settings.py @@ -22,7 +22,7 @@ AUTO_GENERATE_GROUP_AVATAR_SIZES = getattr(settings, 'AUTO_GENERATE_GROUP_AVATAR ### Common settings ### AVATAR_FILE_STORAGE = getattr(settings, 'AVATAR_FILE_STORAGE', '') -AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS) +AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.Resampling.LANCZOS) AVATAR_GRAVATAR_BACKUP = getattr(settings, 'AVATAR_GRAVATAR_BACKUP', True) AVATAR_GRAVATAR_DEFAULT = getattr(settings, 'AVATAR_GRAVATAR_DEFAULT', None) AVATAR_MAX_AVATARS_PER_USER = getattr(settings, 'AVATAR_MAX_AVATARS_PER_USER', 42) diff --git a/seahub/thumbnail/utils.py b/seahub/thumbnail/utils.py index d05e9544a1..0e69ba3084 100644 --- a/seahub/thumbnail/utils.py +++ b/seahub/thumbnail/utils.py @@ -54,22 +54,22 @@ def get_rotated_image(image): if orientation == 2: # Vertical image - image = image.transpose(Image.FLIP_LEFT_RIGHT) + image = image.transpose(Image.Transpose.FLIP_LEFT_RIGHT) elif orientation == 3: # Rotation 180 image = image.rotate(180) elif orientation == 4: - image = image.rotate(180).transpose(Image.FLIP_LEFT_RIGHT) + image = image.rotate(180).transpose(Image.Transpose.FLIP_LEFT_RIGHT) # Horizontal image elif orientation == 5: # Horizontal image + Rotation 90 CCW - image = image.rotate(-90, expand=True).transpose(Image.FLIP_LEFT_RIGHT) + image = image.rotate(-90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT) elif orientation == 6: # Rotation 270 image = image.rotate(-90, expand=True) elif orientation == 7: # Horizontal image + Rotation 270 - image = image.rotate(90, expand=True).transpose(Image.FLIP_LEFT_RIGHT) + image = image.rotate(90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT) elif orientation == 8: # Rotation 90 image = image.rotate(90, expand=True) @@ -230,7 +230,7 @@ def _create_thumbnail_common(fp, thumbnail_file, size): image = image.convert("RGB") image = get_rotated_image(image) - image.thumbnail((size, size), Image.ANTIALIAS) + image.thumbnail((size, size), Image.Resampling.LANCZOS) image.save(thumbnail_file, THUMBNAIL_EXTENSION) return (True, 200) From 4bddb2ab572d29fe328115478cd4730d74ec89eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A2=E4=B9=90=E9=A9=AC?= <38058090+SkywalkerSpace@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:36:36 +0800 Subject: [PATCH 2/6] pillow 10.2.* (#5939) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c588b1ce83..791ef49097 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ future==0.18.* gunicorn==20.1.* mysqlclient==2.1.* qrcode==7.3.* -pillow==10.0.* +pillow==10.2.* chardet==5.1.* cffi==1.15.1 captcha==0.5.* From e4429cfabb0c11443d1072e4caa9c022df235c6e Mon Sep 17 00:00:00 2001 From: WJH <40563566+likesclever@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:42:59 +0800 Subject: [PATCH 3/6] update German translation (#5948) --- locale/de/LC_MESSAGES/django.po | 24 ++++++++++++------------ locale/de/LC_MESSAGES/djangojs.po | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index eafe7cc568..803c1427a2 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -3860,7 +3860,7 @@ msgstr "Löschen fehlgeschlagen: Der Benutzer wurde nicht gefunden." #: seahub/institutions/views.py:213 msgid "Failed to delete: the user is system administrator" -msgstr "" +msgstr "Löschen fehlgeschlagen: Der Benutzer ist Systemadministrator" #: seahub/institutions/views.py:217 seahub/views/sysadmin.py:380 #, python-format @@ -3870,7 +3870,7 @@ msgstr "%s ist gelöscht." #: seahub/invitations/models.py:95 #, python-format msgid "You are invited to join %(site_name)s." -msgstr "" +msgstr "Sie sind eingeladen, %(site_name)s beizutreten." #: seahub/invitations/templates/invitations/invitation_email.html:9 #: seahub/invitations/templates/invitations/invitation_revoke_email.html:9 @@ -3897,7 +3897,7 @@ msgstr "Guten Tag," msgid "" "%(inviter_name)s invited you to join %(site_name)s. Please click the link " "below:" -msgstr "" +msgstr "%(inviter_name)s hat Sie eingeladen, %(site_name)s beizutreten. Bitte klicken Sie auf den Link unten:" #: seahub/invitations/templates/invitations/invitation_revoke_email.html:12 #, python-format @@ -4192,11 +4192,11 @@ msgstr "%(user)s hat die Bibliothek %(lib_na msgid "" "Virus detected in library %(repo_name)s during regular scanning: " "%(file_path)s." -msgstr "" +msgstr "Virus entdeckt in der Bibliothek %(repo_name)s während der regulären Scans: %(file_path)s." #: seahub/notifications/templates/notifications/notify_virus.html:20 msgid "Virus is detected on regular scanning:" -msgstr "" +msgstr "Virus während der regelmäßigen Scans entdeckt:" #: seahub/notifications/templates/notifications/user_notification_list_react.html:5 msgid "Notifications" @@ -4365,7 +4365,7 @@ msgstr "erweitert" #: seahub/search/templates/search_results.html:56 msgid "No result found" -msgstr "" +msgstr "Kein Ergebnis gefunden" #: seahub/search/templates/search_results.html:58 #, python-format @@ -4392,15 +4392,15 @@ msgstr "Das Startdatum muss vor dem Enddatum liegen." #: seahub/search/views.py:33 msgid "Invalid argument." -msgstr "" +msgstr "Ungültiges Argument". #: seahub/search/views.py:81 seahub/search/views.py:89 msgid "Invalid date." -msgstr "" +msgstr "Ungültiges Datum". #: seahub/search/views.py:97 seahub/search/views.py:105 msgid "Invalid file size." -msgstr "" +msgstr "Ungültige Dateigröße". #: seahub/search/views.py:112 msgid "Invalid file size range." @@ -4408,12 +4408,12 @@ msgstr "Dateigröße nicht zugelassen." #: seahub/search/views.py:117 msgid "Invalid date range." -msgstr "" +msgstr "Ungültiger Datumsbereich". #: seahub/search/views.py:166 #, python-format msgid "Library %s not found." -msgstr "" +msgstr "Bibliothek %s nicht gefunden." #: seahub/share/forms.py:20 seahub/share/forms.py:33 msgid "Email is required" @@ -4572,7 +4572,7 @@ msgstr "Für" #: seahub/sysadmin_extra/views.py:209 msgid "Folder Path" -msgstr "" +msgstr "Ordnerpfad" #: seahub/sysadmin_extra/views.py:223 msgid "Organization" diff --git a/locale/de/LC_MESSAGES/djangojs.po b/locale/de/LC_MESSAGES/djangojs.po index 4b4b644c35..3045145b15 100644 --- a/locale/de/LC_MESSAGES/djangojs.po +++ b/locale/de/LC_MESSAGES/djangojs.po @@ -3419,25 +3419,25 @@ msgstr "Zeitpunkt des Ablaufens" #: frontend/src/components/share-link-panel/index.js:106 msgid "Link deleted" -msgstr "" +msgstr "Link gelöscht" #: frontend/src/components/share-link-panel/link-creation.js:155 msgid "Please enter an integer bigger than 1 as number of links." -msgstr "" +msgstr "Bitte geben Sie als Anzahl der Links eine ganze Zahl größer als 1 ein." #: frontend/src/components/share-link-panel/link-creation.js:249 #: frontend/src/components/share-link-panel/link-list.js:47 msgid "Generate links in batch" -msgstr "" +msgstr "Mehrere Links auf einmal generieren" #: frontend/src/components/share-link-panel/link-creation.js:249 #: frontend/src/components/share-link-panel/link-list.js:46 msgid "Generate Link" -msgstr "" +msgstr "Link erzeugen" #: frontend/src/components/share-link-panel/link-creation.js:254 msgid "Number of links" -msgstr "" +msgstr "Anzahl an Links" #: frontend/src/components/share-link-panel/link-creation.js:318 msgid "Set permission" @@ -3475,7 +3475,7 @@ msgstr "Nach der Löschung ist über den Link kein Download mehr möglich." #: frontend/src/components/share-link-panel/link-list.js:52 msgid "Export" -msgstr "" +msgstr "Exportieren" #: frontend/src/components/shared-file-view/shared-file-view.js:46 #: frontend/src/pages/markdown-editor/seafile-editor/index.js:149 @@ -5075,7 +5075,7 @@ msgstr "Ändern" #: frontend/src/pages/org-admin/web-settings/web-settings.js:100 msgid "Team name" -msgstr "" +msgstr "Teamname" #: frontend/src/pages/org-admin/web-settings/web-settings.js:122 msgid "File extension white list" @@ -5215,7 +5215,7 @@ msgstr "Aufrufe" #: frontend/src/pages/share-admin/share-links.js:219 #: frontend/src/pages/share-admin/upload-links.js:143 msgid "(deleted)" -msgstr "" +msgstr "(gelöscht)" #: frontend/src/pages/share-admin/share-links.js:246 #: frontend/src/pages/share-admin/share-links.js:280 @@ -5238,16 +5238,16 @@ msgstr "Absteigend nach Ablaufdatum" #: frontend/src/pages/share-admin/share-links.js:439 msgid "Successfully cleaned invalid share links." -msgstr "" +msgstr "Ungültige Freigabelinks erfolgreich gelöscht". #: frontend/src/pages/share-admin/share-links.js:454 #: frontend/src/pages/share-admin/share-links.js:493 msgid "Clean invalid share links" -msgstr "" +msgstr "Ungültige Freigabelinks löschen" #: frontend/src/pages/share-admin/share-links.js:494 msgid "Are you sure you want to clean invalid share links?" -msgstr "" +msgstr "Sind Sie sicher, dass Sie ungültige Freigabelinks löschen wollen?" #: frontend/src/pages/share-admin/upload-links.js:39 msgid "" @@ -5258,16 +5258,16 @@ msgstr "Sie habe noch keine Upload-Links angelegt. Über einen Upload-Link könn #: frontend/src/pages/share-admin/upload-links.js:264 msgid "Successfully cleaned invalid upload links." -msgstr "" +msgstr "Ungültige Upload-Links erfolgreich gelöscht." #: frontend/src/pages/share-admin/upload-links.js:278 #: frontend/src/pages/share-admin/upload-links.js:302 msgid "Clean invalid upload links" -msgstr "" +msgstr "Ungültige Upload-Links löschen" #: frontend/src/pages/share-admin/upload-links.js:303 msgid "Are you sure you want to clean invalid upload links?" -msgstr "" +msgstr "Sind Sie sicher, dass Sie ungültige Upload-Links löschen wollen?" #: frontend/src/pages/share-with-ocm/shared-with-ocm.js:36 msgid "At server" From 263711a49f9f5dee5ff86c0ff528980363dfae6a Mon Sep 17 00:00:00 2001 From: lian Date: Wed, 7 Feb 2024 14:46:02 +0800 Subject: [PATCH 4/6] update onlyoffice (#5946) set `provider` to "seafile" when open Seafile via OnlyOffice desktop editor --- seahub/templates/react_app.html | 2 +- seahub/templates/view_file_onlyoffice.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/seahub/templates/react_app.html b/seahub/templates/react_app.html index 7be753d8d6..342eda4a87 100644 --- a/seahub/templates/react_app.html +++ b/seahub/templates/react_app.html @@ -28,7 +28,7 @@ "displayName": "{{request.user.username|email2nickname|escapejs}}", "email": "{{request.user.username|escapejs}}", "domain": "{{service_url}}", - "provider": "{{site_name}}", + "provider": "seafile", "userId": "{{request.user.username|escapejs}}", }; window.AscDesktopEditor.execCommand('portal:login', JSON.stringify(params)); diff --git a/seahub/templates/view_file_onlyoffice.html b/seahub/templates/view_file_onlyoffice.html index 53c6358dc0..58ffb7ebd3 100644 --- a/seahub/templates/view_file_onlyoffice.html +++ b/seahub/templates/view_file_onlyoffice.html @@ -125,7 +125,7 @@ html, body { padding:0; margin:0; height:100%; } "displayName": "{{request.user.username|email2nickname|escapejs}}", "email": "{{request.user.username|escapejs}}", "domain": "{{service_url}}", - "provider": "{{site_name}}", + "provider": "seafile", "userId": "{{request.user.username|escapejs}}", }; window.AscDesktopEditor.execCommand('portal:login', JSON.stringify(params)); From 0baf465a7b1a60e35da54b13ba0f11ad5a244488 Mon Sep 17 00:00:00 2001 From: WJH <40563566+likesclever@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:02:45 +0800 Subject: [PATCH 5/6] fix translation syntax error (#5952) --- locale/de/LC_MESSAGES/django.po | 8 ++++---- locale/de/LC_MESSAGES/djangojs.po | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 803c1427a2..8d881e0d7e 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -4392,15 +4392,15 @@ msgstr "Das Startdatum muss vor dem Enddatum liegen." #: seahub/search/views.py:33 msgid "Invalid argument." -msgstr "Ungültiges Argument". +msgstr "Ungültiges Argument." #: seahub/search/views.py:81 seahub/search/views.py:89 msgid "Invalid date." -msgstr "Ungültiges Datum". +msgstr "Ungültiges Datum." #: seahub/search/views.py:97 seahub/search/views.py:105 msgid "Invalid file size." -msgstr "Ungültige Dateigröße". +msgstr "Ungültige Dateigröße." #: seahub/search/views.py:112 msgid "Invalid file size range." @@ -4408,7 +4408,7 @@ msgstr "Dateigröße nicht zugelassen." #: seahub/search/views.py:117 msgid "Invalid date range." -msgstr "Ungültiger Datumsbereich". +msgstr "Ungültiger Datumsbereich." #: seahub/search/views.py:166 #, python-format diff --git a/locale/de/LC_MESSAGES/djangojs.po b/locale/de/LC_MESSAGES/djangojs.po index 3045145b15..80a2865008 100644 --- a/locale/de/LC_MESSAGES/djangojs.po +++ b/locale/de/LC_MESSAGES/djangojs.po @@ -5238,7 +5238,7 @@ msgstr "Absteigend nach Ablaufdatum" #: frontend/src/pages/share-admin/share-links.js:439 msgid "Successfully cleaned invalid share links." -msgstr "Ungültige Freigabelinks erfolgreich gelöscht". +msgstr "Ungültige Freigabelinks erfolgreich gelöscht." #: frontend/src/pages/share-admin/share-links.js:454 #: frontend/src/pages/share-admin/share-links.js:493 From f8db39b8e38b1d3e87e02130ff4cefe118351079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= <978987373@qq.com> Date: Wed, 21 Feb 2024 17:39:19 +0800 Subject: [PATCH 6/6] optimize code (#5958) --- .../components/file-chooser/repo-list-item.js | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/file-chooser/repo-list-item.js b/frontend/src/components/file-chooser/repo-list-item.js index c20e0a3c23..04c351fccb 100644 --- a/frontend/src/components/file-chooser/repo-list-item.js +++ b/frontend/src/components/file-chooser/repo-list-item.js @@ -10,6 +10,8 @@ import { Utils } from '../../utils/utils'; import toaster from '../toast'; const propTypes = { + isCurrentRepo: PropTypes.bool, + currentPath: PropTypes.string, isShowFile: PropTypes.bool, selectedPath: PropTypes.string, selectedRepo: PropTypes.object, @@ -28,11 +30,43 @@ class RepoListItem extends React.Component { this.state = { isShowChildren: this.props.initToShowChildren, treeData: treeHelper.buildTree(), + hasLoaded: false, }; } componentDidMount () { - const repoID = this.props.repo.repo_id; + const { isCurrentRepo, currentPath, repo, selectedItemInfo } = this.props; + + // render search result + const { repoID, filePath } = selectedItemInfo || {}; + if (repoID && repoID === repo.repo_id) { + this.loadRepoDirentList(repo); + setTimeout(() => { + this.setState({isShowChildren: true}); + this.loadNodeAndParentsByPath(repoID, filePath); + }, 0); + return; + } + + // the repo is current repo and currentPath is not '/' + if (isCurrentRepo && !repoID) { + this.loadRepoDirentList(repo); + setTimeout(() => { + const repoID = repo.repo_id; + if (isCurrentRepo && currentPath && currentPath != '/') { + const expandNode = true; + this.loadNodeAndParentsByPath(repoID, currentPath, expandNode); + } + }, 0); + } + } + + loadRepoDirentList = (repo) => { + const { hasLoaded } = this.state; + if (hasLoaded) return; + + const repoID = repo.repo_id; + seafileAPI.listDir(repoID, '/').then(res => { let tree = this.state.treeData.clone(); let direntList = []; @@ -43,22 +77,11 @@ class RepoListItem extends React.Component { } this.addResponseListToNode(direntList, tree.root); - this.setState({treeData: tree}, () => { - const { isCurrentRepo, currentPath } = this.props; - if (isCurrentRepo && currentPath && currentPath != '/') { - const expandNode = true; - this.loadNodeAndParentsByPath(repoID, currentPath, expandNode); - } - }); + this.setState({ treeData: tree, hasLoaded: true }); }).catch(error => { let errMessage = Utils.getErrorMsg(error); toaster.danger(errMessage); }); - - if (this.props.selectedItemInfo.repoID === this.props.repo.repo_id) { - this.setState({isShowChildren: true}); - this.loadNodeAndParentsByPath(this.props.selectedItemInfo.repoID, this.props.selectedItemInfo.filePath); - } } addResponseListToNode = (list, node) => { @@ -143,6 +166,8 @@ class RepoListItem extends React.Component { onToggleClick = (e) => { e.stopPropagation(); + let repo = this.props.repo; + this.loadRepoDirentList(repo); this.setState({isShowChildren: !this.state.isShowChildren}); } @@ -152,8 +177,9 @@ class RepoListItem extends React.Component { } onRepoItemClick = (e) => { - if (!this.isCurrentRepo() || this.props.selectedPath !== '') { - this.props.onRepoItemClick(this.props.repo); + const { repo, selectedPath } = this.props; + if (!this.isCurrentRepo() || (selectedPath !== '' && selectedPath !== '/')) { + this.props.onRepoItemClick(repo); } else { this.onToggleClick(e); }