mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Introduce canvasPixelTest() intended to validate canvas functionality
Browsers and plugins that spoof canvas data produce corrupt images. In attempt to mitigate: * Add canvasPixelTest() to test a single pixel and test the RGB values * Test canvasPixelTest() inside generateInitialsImage() and use default `/user.png` if failure detected * Call canvasPixelTest() directly within settings to avoid setting an invalid image * Use toast.error() with 10 second autoClose
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { WEBUI_NAME, config, user } from '$lib/stores';
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { generateInitialsImage } from '$lib/utils';
|
||||
import { generateInitialsImage, canvasPixelTest } from '$lib/utils';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
}
|
||||
);
|
||||
|
||||
if (!canvasPixelTest()) {
|
||||
toast.error("Canvas pixel test failed, fingerprint evasion likely. Default image used.", {
|
||||
autoClose: 1000 * 10,
|
||||
});
|
||||
}
|
||||
|
||||
await setSessionUser(sessionUser);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user