1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-21 11:27:18 +00:00

Fix media url and thumbnail center (#6809)

* 01 change generate thumbnail

* fix mediaUrl

* fix mediaUrl
This commit is contained in:
Michael An
2024-09-20 16:05:24 +08:00
committed by GitHub
parent e62d59fc55
commit da6de8ca8f
3 changed files with 28 additions and 19 deletions

View File

@@ -5,12 +5,12 @@ class ThumbnailCenter {
constructor() {
this.waitingQuery = [];
this.isStartQuery = false;
this.queryStart = false;
}
createThumbnail = ({ repoID, path, callback }) => {
this.waitingQuery.push({ repoID, path, callback });
if (!this.isStartQuery) {
if (!this.queryStart) {
this.startQuery();
}
};
@@ -20,17 +20,14 @@ class ThumbnailCenter {
if (index > -1) {
this.waitingQuery.splice(index, 1);
}
if (this.waitingQuery.length === 0) {
this.isStartQuery = false;
}
};
startQuery = () => {
if (this.waitingQuery.length === 0) {
this.isStartQuery = false;
this.queryStart = false;
return;
}
this.isStartQuery = true;
this.queryStart = true;
let { repoID, path, callback } = this.waitingQuery[0];
seafileAPI.createThumbnail(repoID, path, thumbnailDefaultSize).then((res) => {
callback && callback(res.data.encoded_thumbnail_src);