Merge branch 'master' into stable24
commit
a45db626dc
35
src/App.vue
35
src/App.vue
|
@ -92,7 +92,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Mixins } from "vue-property-decorator";
|
import { Component, Mixins, Watch } from "vue-property-decorator";
|
||||||
import {
|
import {
|
||||||
NcContent,
|
NcContent,
|
||||||
NcAppContent,
|
NcAppContent,
|
||||||
|
@ -172,6 +172,15 @@ export default class App extends Mixins(GlobalMixin, UserConfig) {
|
||||||
return this.$route.name !== "folder-share";
|
return this.$route.name !== "folder-share";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Watch("$route")
|
||||||
|
routeChanged() {
|
||||||
|
this.doRouteChecks();
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.doRouteChecks();
|
||||||
|
}
|
||||||
|
|
||||||
async beforeMount() {
|
async beforeMount() {
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
// Use the window load event to keep the page load performant
|
// Use the window load event to keep the page load performant
|
||||||
|
@ -190,6 +199,30 @@ export default class App extends Mixins(GlobalMixin, UserConfig) {
|
||||||
console.debug("Service Worker is not enabled on this browser.");
|
console.debug("Service Worker is not enabled on this browser.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doRouteChecks() {
|
||||||
|
if (this.$route.name === "folder-share") {
|
||||||
|
this.putFolderShareToken(this.$route.params.token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
putFolderShareToken(token: string) {
|
||||||
|
// Viewer looks for an input with ID sharingToken with the value as the token
|
||||||
|
// Create this element or update it otherwise files not gonna open
|
||||||
|
// https://github.com/nextcloud/viewer/blob/a8c46050fb687dcbb48a022a15a5d1275bf54a8e/src/utils/davUtils.js#L61
|
||||||
|
let tokenInput = document.getElementById(
|
||||||
|
"sharingToken"
|
||||||
|
) as HTMLInputElement;
|
||||||
|
if (!tokenInput) {
|
||||||
|
tokenInput = document.createElement("input");
|
||||||
|
tokenInput.id = "sharingToken";
|
||||||
|
tokenInput.type = "hidden";
|
||||||
|
tokenInput.style.display = "none";
|
||||||
|
document.body.appendChild(tokenInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
tokenInput.value = token;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,10 @@ export async function getFiles(photos: IPhoto[]): Promise<IFileInfo[]> {
|
||||||
const photosWithFilename = photos.filter((photo) => photo.filename);
|
const photosWithFilename = photos.filter((photo) => photo.filename);
|
||||||
fileInfos = fileInfos.concat(
|
fileInfos = fileInfos.concat(
|
||||||
photosWithFilename.map((photo) => {
|
photosWithFilename.map((photo) => {
|
||||||
|
const prefixPath = `/files/${getCurrentUser()?.uid}`;
|
||||||
return {
|
return {
|
||||||
fileid: photo.fileid,
|
fileid: photo.fileid,
|
||||||
filename: photo.filename.split("/").slice(3).join("/"),
|
filename: photo.filename.replace(prefixPath, ""),
|
||||||
originalFilename: photo.filename,
|
originalFilename: photo.filename,
|
||||||
basename: photo.basename,
|
basename: photo.basename,
|
||||||
mime: photo.mimetype,
|
mime: photo.mimetype,
|
||||||
|
|
Loading…
Reference in New Issue