mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-27 08:27:43 +00:00
Restrict the permission popup flow to third-party websites
requestPermission's new web path ran in every environment with a window, including env='gui' — so a permission_denied driver retry inside the Puter GUI would open a popup to the Puter origin from the desktop itself and try to grant the permission to a phantom app for Puter's own origin. Resolve false everywhere except env='web', the previous behavior.
This commit is contained in:
@@ -1119,8 +1119,15 @@ class UI extends EventListener {
|
||||
return result.granted === true;
|
||||
}
|
||||
|
||||
// Web environment: open the GUI's permission popup. Not available in
|
||||
// workers (no window to open a popup from).
|
||||
// The popup flow is for third-party websites only. In every other
|
||||
// environment it either can't work (workers and node have no window
|
||||
// to open a popup from) or makes no sense — inside the Puter GUI
|
||||
// itself ('gui') the popup would prompt the user to grant this
|
||||
// permission to Puter's own origin. Those callers keep the previous
|
||||
// behavior of resolving false.
|
||||
if ( this.env !== 'web' ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! globalThis.open || ! globalThis.document ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user