Support multiple file upload, rename Dav password
This commit is contained in:
@@ -54,18 +54,21 @@ export default function MainFiles({ initialDirectories, initialFiles, initialPat
|
|||||||
function onClickUploadFile() {
|
function onClickUploadFile() {
|
||||||
const fileInput = document.createElement('input');
|
const fileInput = document.createElement('input');
|
||||||
fileInput.type = 'file';
|
fileInput.type = 'file';
|
||||||
|
fileInput.multiple = true;
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
|
|
||||||
fileInput.onchange = async (event) => {
|
fileInput.onchange = async (event) => {
|
||||||
const chosenFiles = (event.target as HTMLInputElement)?.files!;
|
const chosenFilesList = (event.target as HTMLInputElement)?.files!;
|
||||||
const chosenFile = chosenFiles[0];
|
|
||||||
|
|
||||||
if (!chosenFile) {
|
const chosenFiles = Array.from(chosenFilesList);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isUploading.value = true;
|
isUploading.value = true;
|
||||||
|
|
||||||
|
for (const chosenFile of chosenFiles) {
|
||||||
|
if (!chosenFile) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
areNewOptionsOption.value = false;
|
areNewOptionsOption.value = false;
|
||||||
|
|
||||||
const requestBody = new FormData();
|
const requestBody = new FormData();
|
||||||
@@ -88,6 +91,7 @@ export default function MainFiles({ initialDirectories, initialFiles, initialPat
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isUploading.value = false;
|
isUploading.value = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const actionWords = new Map<Action, string>([
|
|||||||
['change-email', 'change email'],
|
['change-email', 'change email'],
|
||||||
['verify-change-email', 'change email'],
|
['verify-change-email', 'change email'],
|
||||||
['change-password', 'change password'],
|
['change-password', 'change password'],
|
||||||
['change-dav-password', 'change DAV password'],
|
['change-dav-password', 'change Sync password'],
|
||||||
['delete-account', 'delete account'],
|
['delete-account', 'delete account'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -83,11 +83,11 @@ function formFields(action: Action, formData: FormData) {
|
|||||||
} else if (action === 'change-dav-password') {
|
} else if (action === 'change-dav-password') {
|
||||||
fields.push({
|
fields.push({
|
||||||
name: 'new-dav-password',
|
name: 'new-dav-password',
|
||||||
label: 'New DAV Password',
|
label: 'New Sync Password',
|
||||||
type: 'password',
|
type: 'password',
|
||||||
placeholder: 'super-SECRET-passphrase',
|
placeholder: 'super-SECRET-passphrase',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'Alternative password used for DAV access and/or HTTP Basic Auth.',
|
description: 'Alternative password used for Sync access and/or HTTP Basic Auth.',
|
||||||
});
|
});
|
||||||
} else if (action === 'delete-account') {
|
} else if (action === 'delete-account') {
|
||||||
fields.push({
|
fields.push({
|
||||||
@@ -148,12 +148,12 @@ export default function Settings({ formData: formDataObject, error, notice }: Se
|
|||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2 class='text-2xl mb-4 text-left px-4 max-w-screen-md mx-auto lg:min-w-96'>Change your DAV password</h2>
|
<h2 class='text-2xl mb-4 text-left px-4 max-w-screen-md mx-auto lg:min-w-96'>Change your Sync password</h2>
|
||||||
|
|
||||||
<form method='POST' class='mb-12'>
|
<form method='POST' class='mb-12'>
|
||||||
{formFields('change-dav-password', formData).map((field) => generateFieldHtml(field, formData))}
|
{formFields('change-dav-password', formData).map((field) => generateFieldHtml(field, formData))}
|
||||||
<section class='flex justify-end mt-8 mb-4'>
|
<section class='flex justify-end mt-8 mb-4'>
|
||||||
<button class='button-secondary' type='submit'>Change DAV password</button>
|
<button class='button-secondary' type='submit'>Change Sync password</button>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user