mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-30 09:40:00 -06:00
tweak: add puter.perms.requestPermission
It calls requestPermission on the UI module. The method on the UI model needs to still exist because the UI module is tightly-coupled with IPC. A refactor of the IPC mechanism on the puter.js side could solve this.
This commit is contained in:
@@ -112,6 +112,19 @@ export default class Perms {
|
||||
return await this.req_('/group/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a specific permission string to be granted. Note that some
|
||||
* permission strings are not supported and will be denied silently.
|
||||
* @param {string} permission - permission string to request
|
||||
* @returns {boolean} true if permission was granted, false otherwise
|
||||
*/
|
||||
async requestPermission (permission) {
|
||||
// note: we cannot move this fully from "puter.ui" without
|
||||
// a significant refactor because the UI module contains
|
||||
// all of the IPC communication logic.
|
||||
return await this.puter.ui.requestPermission({ permission });
|
||||
};
|
||||
|
||||
// #region shorthand functions
|
||||
/**
|
||||
* Request to see a user's email. If the user has already granted this
|
||||
|
||||
Reference in New Issue
Block a user