move Notification.requestPermission() entirely to javascript to possibly fix problem with secure context people are having on non-localhost
This commit is contained in:
parent
b0765a6788
commit
3582befdcd
2 changed files with 14 additions and 2 deletions
|
@ -2,7 +2,19 @@
|
||||||
|
|
||||||
let lastHeadImg = null;
|
let lastHeadImg = null;
|
||||||
|
|
||||||
|
notificationButton = null
|
||||||
|
|
||||||
onUiUpdate(function(){
|
onUiUpdate(function(){
|
||||||
|
if(notificationButton == null){
|
||||||
|
notificationButton = gradioApp().getElementById('request_notifications')
|
||||||
|
|
||||||
|
if(notificationButton != null){
|
||||||
|
notificationButton.addEventListener('click', function (evt) {
|
||||||
|
Notification.requestPermission();
|
||||||
|
},true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const galleryPreviews = gradioApp().querySelectorAll('img.h-full.w-full.overflow-hidden');
|
const galleryPreviews = gradioApp().querySelectorAll('img.h-full.w-full.overflow-hidden');
|
||||||
|
|
||||||
if (galleryPreviews == null) return;
|
if (galleryPreviews == null) return;
|
||||||
|
|
|
@ -857,12 +857,12 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
||||||
outputs=[result]
|
outputs=[result]
|
||||||
)
|
)
|
||||||
|
|
||||||
request_notifications = gr.Button(value='Request browser notifications')
|
request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications")
|
||||||
request_notifications.click(
|
request_notifications.click(
|
||||||
fn=lambda: None,
|
fn=lambda: None,
|
||||||
inputs=[],
|
inputs=[],
|
||||||
outputs=[],
|
outputs=[],
|
||||||
_js='() => Notification.requestPermission()'
|
_js='function(){}'
|
||||||
)
|
)
|
||||||
|
|
||||||
interfaces = [
|
interfaces = [
|
||||||
|
|
Loading…
Reference in a new issue