share: hide download button if needed (fix #273)
parent
0e17ef69a9
commit
6b1cb41c25
|
@ -109,6 +109,9 @@ class PublicController extends AuthPublicShareController
|
||||||
// Video configuration
|
// Video configuration
|
||||||
$this->initialState->provideInitialState('notranscode', $this->config->getSystemValue('memories.no_transcode', 'UNSET'));
|
$this->initialState->provideInitialState('notranscode', $this->config->getSystemValue('memories.no_transcode', 'UNSET'));
|
||||||
|
|
||||||
|
// Share info
|
||||||
|
$this->initialState->provideInitialState('no_download', $share->getHideDownload());
|
||||||
|
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedWorkerSrcDomain("'self'");
|
$policy->addAllowedWorkerSrcDomain("'self'");
|
||||||
$policy->addAllowedScriptDomain("'self'");
|
$policy->addAllowedScriptDomain("'self'");
|
||||||
|
|
|
@ -157,6 +157,7 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) {
|
||||||
icon: DownloadIcon,
|
icon: DownloadIcon,
|
||||||
callback: this.downloadSelection.bind(this),
|
callback: this.downloadSelection.bind(this),
|
||||||
allowPublic: true,
|
allowPublic: true,
|
||||||
|
if: () => !this.allowDownload(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t("memories", "Favorite"),
|
name: t("memories", "Favorite"),
|
||||||
|
@ -216,6 +217,11 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Download is not allowed on some public shares */
|
||||||
|
private allowDownload(): boolean {
|
||||||
|
return this.state_noDownload;
|
||||||
|
}
|
||||||
|
|
||||||
/** Archive is not allowed only on folder routes */
|
/** Archive is not allowed only on folder routes */
|
||||||
private allowArchive() {
|
private allowArchive() {
|
||||||
return this.$route.name !== "folders";
|
return this.$route.name !== "folders";
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
:aria-label="t('memories', 'Download')"
|
:aria-label="t('memories', 'Download')"
|
||||||
@click="downloadCurrent"
|
@click="downloadCurrent"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
|
v-if="!this.state_noDownload"
|
||||||
>
|
>
|
||||||
{{ t("memories", "Download") }}
|
{{ t("memories", "Download") }}
|
||||||
<template #icon>
|
<template #icon>
|
||||||
|
@ -89,7 +90,7 @@
|
||||||
</template>
|
</template>
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
<NcActionButton
|
<NcActionButton
|
||||||
v-if="currentPhoto?.liveid"
|
v-if="!this.state_noDownload && currentPhoto?.liveid"
|
||||||
:aria-label="t('memories', 'Download Video')"
|
:aria-label="t('memories', 'Download Video')"
|
||||||
@click="downloadCurrentLiveVideo"
|
@click="downloadCurrentLiveVideo"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import { translate as t, translatePlural as n } from "@nextcloud/l10n";
|
import { translate as t, translatePlural as n } from "@nextcloud/l10n";
|
||||||
import { constants } from "../services/Utils";
|
import { constants } from "../services/Utils";
|
||||||
|
import { loadState } from "@nextcloud/initial-state";
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class GlobalMixin extends Vue {
|
export default class GlobalMixin extends Vue {
|
||||||
|
@ -10,4 +11,7 @@ export default class GlobalMixin extends Vue {
|
||||||
public readonly c = constants.c;
|
public readonly c = constants.c;
|
||||||
public readonly TagDayID = constants.TagDayID;
|
public readonly TagDayID = constants.TagDayID;
|
||||||
public readonly TagDayIDValueSet = constants.TagDayIDValueSet;
|
public readonly TagDayIDValueSet = constants.TagDayIDValueSet;
|
||||||
|
|
||||||
|
public readonly state_noDownload =
|
||||||
|
loadState("memories", "no_download", false) !== false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue