mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 20:07:33 -07:00
Fix #7576
This commit is contained in:
parent
8e5c216756
commit
cc89b21901
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import * as os from '@client/os';
|
import * as os from '@client/os';
|
||||||
import { i18n } from '@client/i18n';
|
import { i18n } from '@client/i18n';
|
||||||
|
import { defaultStore } from '@client/store';
|
||||||
|
|
||||||
export function selectFile(src: any, label: string | null, multiple = false) {
|
export function selectFile(src: any, label: string | null, multiple = false) {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
|
@ -8,7 +9,7 @@ export function selectFile(src: any, label: string | null, multiple = false) {
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
input.multiple = multiple;
|
input.multiple = multiple;
|
||||||
input.onchange = () => {
|
input.onchange = () => {
|
||||||
const promises = Array.from(input.files).map(file => os.upload(file));
|
const promises = Array.from(input.files).map(file => os.upload(file, defaultStore.state.uploadFolder));
|
||||||
|
|
||||||
Promise.all(promises).then(driveFiles => {
|
Promise.all(promises).then(driveFiles => {
|
||||||
res(multiple ? driveFiles : driveFiles[0]);
|
res(multiple ? driveFiles : driveFiles[0]);
|
||||||
|
@ -57,6 +58,7 @@ export function selectFile(src: any, label: string | null, multiple = false) {
|
||||||
|
|
||||||
os.api('drive/files/upload-from-url', {
|
os.api('drive/files/upload-from-url', {
|
||||||
url: url,
|
url: url,
|
||||||
|
folderId: defaultStore.state.uploadFolder,
|
||||||
marker
|
marker
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue