mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-09 17:04:30 +08:00
impr(settings): Allow webp format for background images (@fehmer) (#6896)
This commit is contained in:
parent
4aeadb9a85
commit
76597e6a08
5 changed files with 5 additions and 5 deletions
|
|
@ -751,7 +751,7 @@ describe("Config", () => {
|
|||
Config.setCustomBackground(" http://example.com/test.png ")
|
||||
).toBe(true);
|
||||
|
||||
expect(Config.setCustomBackground("http://www.example.com/test.webp")).toBe(
|
||||
expect(Config.setCustomBackground("http://www.example.com/test.tiff")).toBe(
|
||||
false
|
||||
);
|
||||
expect(
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,7 @@
|
|||
<input
|
||||
type="file"
|
||||
id="customBackgroundUpload"
|
||||
accept="image/png,image/jpeg,image/jpg,image/gif"
|
||||
accept="image/png,image/jpeg,image/jpg,image/gif,image/webp"
|
||||
style="display: none"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const customBackgroundCommand: Command = {
|
|||
}
|
||||
|
||||
// check type
|
||||
if (!file.type.match(/image\/(jpeg|jpg|png|gif)/)) {
|
||||
if (!file.type.match(/image\/(jpeg|jpg|png|gif|webp)/)) {
|
||||
Notifications.add("Unsupported image format", 0);
|
||||
cleanup();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ uploadContainerEl
|
|||
}
|
||||
|
||||
// check type
|
||||
if (!file.type.match(/image\/(jpeg|jpg|png|gif)/)) {
|
||||
if (!file.type.match(/image\/(jpeg|jpg|png|gif|webp)/)) {
|
||||
Notifications.add("Unsupported image format", 0);
|
||||
fileInput.value = "";
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ export const CustomBackgroundSchema = z
|
|||
.url("Needs to be an URI.")
|
||||
.regex(/^(https|http):\/\/.*/, "Unsupported protocol.")
|
||||
.regex(/^[^`'"]*$/, "May not contain quotes.")
|
||||
.regex(/.+(\.png|\.gif|\.jpeg|\.jpg)/gi, "Unsupported image format.")
|
||||
.regex(/.+(\.png|\.gif|\.jpeg|\.jpg|\.webp)/gi, "Unsupported image format.")
|
||||
.max(2048, "URL is too long.")
|
||||
.or(z.literal(""));
|
||||
export type CustomBackground = z.infer<typeof CustomBackgroundSchema>;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue