fix: ability to gen with original-name
This commit is contained in:
parent
4ea1775f2c
commit
9117a9d779
4 changed files with 45 additions and 11 deletions
|
@ -55,6 +55,12 @@ export default function Flameshot({ user, open, setOpen }) {
|
||||||
delete extraHeaders['No-JSON'];
|
delete extraHeaders['No-JSON'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.originalName && values.type === 'upload-file') {
|
||||||
|
extraHeaders['Original-Name'] = 'true';
|
||||||
|
} else {
|
||||||
|
delete extraHeaders['Original-Name'];
|
||||||
|
}
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(extraHeaders)) {
|
for (const [key, value] of Object.entries(extraHeaders)) {
|
||||||
curl.push('-H');
|
curl.push('-H');
|
||||||
curl.push(`"${key}: ${value}"`);
|
curl.push(`"${key}: ${value}"`);
|
||||||
|
|
|
@ -1,4 +1,17 @@
|
||||||
import { Box, Button, Checkbox, Code, Group, Modal, NumberInput, Select, Text, Title } from '@mantine/core';
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
Code,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
NumberInput,
|
||||||
|
Select,
|
||||||
|
Stack,
|
||||||
|
Switch,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from '@mantine/core';
|
||||||
import { useForm } from '@mantine/form';
|
import { useForm } from '@mantine/form';
|
||||||
import { DownloadIcon } from 'components/icons';
|
import { DownloadIcon } from 'components/icons';
|
||||||
import Link from 'components/Link';
|
import Link from 'components/Link';
|
||||||
|
@ -16,6 +29,7 @@ export function GeneratorModal({ opened, onClose, title, onSubmit, ...other }) {
|
||||||
wlCompatibility: false,
|
wlCompatibility: false,
|
||||||
wlCompositorNotSupported: false,
|
wlCompositorNotSupported: false,
|
||||||
noJSON: false,
|
noJSON: false,
|
||||||
|
originalName: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,27 +85,34 @@ export function GeneratorModal({ opened, onClose, title, onSubmit, ...other }) {
|
||||||
{...form.getInputProps('imageCompression')}
|
{...form.getInputProps('imageCompression')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Group grow my='md'>
|
<Stack my='md'>
|
||||||
<Checkbox
|
<Switch
|
||||||
label='Zero Width Space'
|
label='Zero Width Space'
|
||||||
description='Use zero width spaces as the file name'
|
description='Use zero width spaces as the file name'
|
||||||
id='zeroWidthSpace'
|
id='zeroWidthSpace'
|
||||||
{...form.getInputProps('zeroWidthSpace', { type: 'checkbox' })}
|
{...form.getInputProps('zeroWidthSpace', { type: 'checkbox' })}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Switch
|
||||||
|
description='Return response as plain text instead of JSON'
|
||||||
|
label='No JSON'
|
||||||
|
id='noJSON'
|
||||||
|
{...form.getInputProps('noJSON', { type: 'checkbox' })}
|
||||||
|
/>
|
||||||
|
<Switch
|
||||||
description='Image will display with embedded metadata'
|
description='Image will display with embedded metadata'
|
||||||
label='Embed'
|
label='Embed'
|
||||||
id='embed'
|
id='embed'
|
||||||
disabled={!isUploadFile}
|
disabled={!isUploadFile}
|
||||||
{...form.getInputProps('embed', { type: 'checkbox' })}
|
{...form.getInputProps('embed', { type: 'checkbox' })}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Switch
|
||||||
description='Return response as plain text instead of JSON'
|
description='Whether or not to show the original name when downloading this specific file. This will not change the name format in the URL.'
|
||||||
label='No JSON'
|
label='Original Name'
|
||||||
id='noJSON'
|
id='originalName'
|
||||||
{...form.getInputProps('noJSON', { type: 'checkbox' })}
|
disabled={!isUploadFile}
|
||||||
|
{...form.getInputProps('originalName', { type: 'checkbox' })}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Stack>
|
||||||
|
|
||||||
{title === 'Flameshot' && (
|
{title === 'Flameshot' && (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -82,6 +82,14 @@ export default function ShareX({ user, open, setOpen }) {
|
||||||
setConfig(config);
|
setConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.originalName && values.type === 'upload-file') {
|
||||||
|
config.Headers['Original-Name'] = 'true';
|
||||||
|
setConfig(config);
|
||||||
|
} else {
|
||||||
|
delete config.Headers['Original-Name'];
|
||||||
|
setConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
const pseudoElement = document.createElement('a');
|
const pseudoElement = document.createElement('a');
|
||||||
pseudoElement.setAttribute(
|
pseudoElement.setAttribute(
|
||||||
'href',
|
'href',
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
NumberInput,
|
NumberInput,
|
||||||
PasswordInput,
|
PasswordInput,
|
||||||
Select,
|
Select,
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
Stack,
|
||||||
Switch,
|
Switch,
|
||||||
Title,
|
Title,
|
||||||
|
|
Loading…
Add table
Reference in a new issue