forked from open-webui/open-webui
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:
parent
c8f7bb990c
commit
ac9308dbed
3 changed files with 55 additions and 3 deletions
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue