merge: upstream

This commit is contained in:
Marie 2023-12-23 02:09:23 +01:00
commit 5db583a3eb
701 changed files with 50809 additions and 13660 deletions

View file

@ -67,7 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { computed, ref } from 'vue';
import MkButton from '@/components/MkButton.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkObjectView from '@/components/MkObjectView.vue';
@ -82,19 +82,19 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { iAmAdmin, iAmModerator } from '@/account.js';
let tab = $ref('overview');
let file: any = $ref(null);
let info: any = $ref(null);
let isSensitive: boolean = $ref(false);
const tab = ref('overview');
const file = ref<any>(null);
const info = ref<any>(null);
const isSensitive = ref<boolean>(false);
const props = defineProps<{
fileId: string,
}>();
async function fetch() {
file = await os.api('drive/files/show', { fileId: props.fileId });
info = await os.api('admin/drive/show-file', { fileId: props.fileId });
isSensitive = file.isSensitive;
file.value = await os.api('drive/files/show', { fileId: props.fileId });
info.value = await os.api('admin/drive/show-file', { fileId: props.fileId });
isSensitive.value = file.value.isSensitive;
}
fetch();
@ -102,29 +102,29 @@ fetch();
async function del() {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.t('removeAreYouSure', { x: file.name }),
text: i18n.t('removeAreYouSure', { x: file.value.name }),
});
if (canceled) return;
os.apiWithDialog('drive/files/delete', {
fileId: file.id,
fileId: file.value.id,
});
}
async function toggleIsSensitive(v) {
await os.api('drive/files/update', { fileId: props.fileId, isSensitive: v });
isSensitive = v;
isSensitive.value = v;
}
const headerActions = $computed(() => [{
const headerActions = computed(() => [{
text: i18n.ts.openInNewTab,
icon: 'ph-arrow-square-out ph-bold ph-lg',
handler: () => {
window.open(file.url, '_blank');
window.open(file.value.url, '_blank', 'noopener');
},
}]);
const headerTabs = $computed(() => [{
const headerTabs = computed(() => [{
key: 'overview',
title: i18n.ts.overview,
icon: 'ph-info ph-bold ph-lg',
@ -139,7 +139,7 @@ const headerTabs = $computed(() => [{
}]);
definePageMetadata(computed(() => ({
title: file ? i18n.ts.file + ': ' + file.name : i18n.ts.file,
title: file.value ? i18n.ts.file + ': ' + file.value.name : i18n.ts.file,
icon: 'ph-file ph-bold ph-lg',
})));
</script>