summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/select-file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/scripts/select-file.ts')
-rw-r--r--packages/frontend/src/scripts/select-file.ts29
1 files changed, 17 insertions, 12 deletions
diff --git a/packages/frontend/src/scripts/select-file.ts b/packages/frontend/src/scripts/select-file.ts
index 891da6eb78..53e2cd5b16 100644
--- a/packages/frontend/src/scripts/select-file.ts
+++ b/packages/frontend/src/scripts/select-file.ts
@@ -1,12 +1,17 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and other misskey contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
import { ref } from 'vue';
-import { DriveFile } from 'misskey-js/built/entities';
-import * as os from '@/os';
-import { useStream } from '@/stream';
-import { i18n } from '@/i18n';
-import { defaultStore } from '@/store';
-import { uploadFile } from '@/scripts/upload';
+import * as Misskey from 'misskey-js';
+import * as os from '@/os.js';
+import { useStream } from '@/stream.js';
+import { i18n } from '@/i18n.js';
+import { defaultStore } from '@/store.js';
+import { uploadFile } from '@/scripts/upload.js';
-export function chooseFileFromPc(multiple: boolean, keepOriginal = false): Promise<DriveFile[]> {
+export function chooseFileFromPc(multiple: boolean, keepOriginal = false): Promise<Misskey.entities.DriveFile[]> {
return new Promise((res, rej) => {
const input = document.createElement('input');
input.type = 'file';
@@ -33,7 +38,7 @@ export function chooseFileFromPc(multiple: boolean, keepOriginal = false): Promi
});
}
-export function chooseFileFromDrive(multiple: boolean): Promise<DriveFile[]> {
+export function chooseFileFromDrive(multiple: boolean): Promise<Misskey.entities.DriveFile[]> {
return new Promise((res, rej) => {
os.selectDriveFile(multiple).then(files => {
res(files);
@@ -41,7 +46,7 @@ export function chooseFileFromDrive(multiple: boolean): Promise<DriveFile[]> {
});
}
-export function chooseFileFromUrl(): Promise<DriveFile> {
+export function chooseFileFromUrl(): Promise<Misskey.entities.DriveFile> {
return new Promise((res, rej) => {
os.inputText({
title: i18n.ts.uploadFromUrl,
@@ -74,7 +79,7 @@ export function chooseFileFromUrl(): Promise<DriveFile> {
});
}
-function select(src: any, label: string | null, multiple: boolean): Promise<DriveFile[]> {
+function select(src: any, label: string | null, multiple: boolean): Promise<Misskey.entities.DriveFile[]> {
return new Promise((res, rej) => {
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
@@ -101,10 +106,10 @@ function select(src: any, label: string | null, multiple: boolean): Promise<Driv
});
}
-export function selectFile(src: any, label: string | null = null): Promise<DriveFile> {
+export function selectFile(src: any, label: string | null = null): Promise<Misskey.entities.DriveFile> {
return select(src, label, false).then(files => files[0]);
}
-export function selectFiles(src: any, label: string | null = null): Promise<DriveFile[]> {
+export function selectFiles(src: any, label: string | null = null): Promise<Misskey.entities.DriveFile[]> {
return select(src, label, true);
}