From 2db3331729d8b01918057b0e4942448fe7c7b00c Mon Sep 17 00:00:00 2001 From: KernelDeimos <7225168+KernelDeimos@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:37:08 -0500 Subject: [PATCH] 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. --- src/puter-js/src/modules/Perms.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/puter-js/src/modules/Perms.js b/src/puter-js/src/modules/Perms.js index b0f10d03..210d0ee0 100644 --- a/src/puter-js/src/modules/Perms.js +++ b/src/puter-js/src/modules/Perms.js @@ -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