Fix shared album list

old-stable24^2
Varun Patil 2022-10-28 12:20:22 -07:00
parent e2edec46ae
commit 428e22dc19
4 changed files with 27 additions and 6 deletions

View File

@ -43,7 +43,7 @@
import { Component, Prop, Emit, Mixins, Watch } from "vue-property-decorator"; import { Component, Prop, Emit, Mixins, Watch } from "vue-property-decorator";
import { IDay, IPhoto } from "../../types"; import { IDay, IPhoto } from "../../types";
import { getPreviewUrl } from "../../services/FileUtils"; import { getPhotosPreviewUrl, getPreviewUrl } from "../../services/FileUtils";
import errorsvg from "../../assets/error.svg"; import errorsvg from "../../assets/error.svg";
import GlobalMixin from "../../mixins/GlobalMixin"; import GlobalMixin from "../../mixins/GlobalMixin";
@ -122,7 +122,9 @@ export default class Photo extends Mixins(GlobalMixin) {
) - 1; ) - 1;
} }
return getPreviewUrl(this.data.fileid, this.data.etag, false, size); const fun =
this.$route.name === "albums" ? getPhotosPreviewUrl : getPreviewUrl;
return fun(this.data.fileid, this.data.etag, false, size);
} }
/** Set src with overlay face rect */ /** Set src with overlay face rect */

View File

@ -36,7 +36,7 @@
import { Component, Prop, Watch, Mixins, Emit } from "vue-property-decorator"; import { Component, Prop, Watch, Mixins, Emit } from "vue-property-decorator";
import { IAlbum, IPhoto, ITag } from "../../types"; import { IAlbum, IPhoto, ITag } from "../../types";
import { generateUrl } from "@nextcloud/router"; import { generateUrl } from "@nextcloud/router";
import { getPreviewUrl } from "../../services/FileUtils"; import { getPhotosPreviewUrl, getPreviewUrl } from "../../services/FileUtils";
import { getCurrentUser } from "@nextcloud/auth"; import { getCurrentUser } from "@nextcloud/auth";
import { NcCounterBubble } from "@nextcloud/vue"; import { NcCounterBubble } from "@nextcloud/vue";
@ -86,6 +86,11 @@ export default class Tag extends Mixins(GlobalMixin) {
"/apps/memories/api/faces/preview/" + this.data.fileid "/apps/memories/api/faces/preview/" + this.data.fileid
); );
} }
if (this.isAlbum) {
return getPhotosPreviewUrl(fileid, etag, true, 256);
}
return getPreviewUrl(fileid, etag, true, 256); return getPreviewUrl(fileid, etag, true, 256);
} }

View File

@ -88,6 +88,7 @@ import ImageMultiple from "vue-material-design-icons/ImageMultiple.vue";
import { NcButton, NcListItem, NcLoadingIcon } from "@nextcloud/vue"; import { NcButton, NcListItem, NcLoadingIcon } from "@nextcloud/vue";
import { generateUrl } from "@nextcloud/router"; import { generateUrl } from "@nextcloud/router";
import { getPhotosPreviewUrl } from "../../services/FileUtils";
import { IAlbum } from "../../types"; import { IAlbum } from "../../types";
import axios from "@nextcloud/axios"; import axios from "@nextcloud/axios";
@ -102,9 +103,7 @@ import axios from "@nextcloud/axios";
}, },
filters: { filters: {
toCoverUrl(fileId: string) { toCoverUrl(fileId: string) {
return generateUrl( return getPhotosPreviewUrl(Number(fileId), "unknown", true, 256);
`/apps/photos/api/v1/preview/${fileId}?x=${256}&y=${256}`
);
}, },
}, },
}) })

View File

@ -133,6 +133,7 @@ const genFileInfo = function (obj) {
return fileInfo; return fileInfo;
}; };
/** Get preview URL from Nextcloud core */
const getPreviewUrl = function ( const getPreviewUrl = function (
fileid: number, fileid: number,
etag: string, etag: string,
@ -145,10 +146,24 @@ const getPreviewUrl = function (
); );
}; };
/** Get the preview URL from the photos app */
const getPhotosPreviewUrl = function (
fileid: number,
etag: string,
square: boolean,
size: number
): string {
const a = square ? "0" : "1";
return generateUrl(
`/apps/photos/api/v1/preview/${fileid}?c=${etag}&x=${size}&y=${size}&forceIcon=0&a=${a}`
);
};
export { export {
encodeFilePath, encodeFilePath,
extractFilePaths, extractFilePaths,
sortCompare, sortCompare,
genFileInfo, genFileInfo,
getPreviewUrl, getPreviewUrl,
getPhotosPreviewUrl,
}; };