MCPcopy Index your code
hub / github.com/MALSync/MALSync / testPermission

Method testPermission

src/utils/permissions.ts:99–126  ·  view source on GitHub ↗
(
    element: tempPermissionElement,
    permissions: chrome.permissions.Permissions,
  )

Source from the content-addressed store, hash-verified

97 }
98
99 protected async testPermission(
100 element: tempPermissionElement,
101 permissions: chrome.permissions.Permissions,
102 ): Promise<permissionElement> {
103 if (!element.match.every(permission => permissions.origins!.includes(permission))) {
104 if (
105 element.match.length &&
106 !(await chrome.permissions.contains({ origins: element.match }))
107 ) {
108 return {
109 ...element,
110 permission: 'denied',
111 };
112 }
113 }
114
115 if (element.api?.length && !(await chrome.permissions.contains({ origins: element.api }))) {
116 return {
117 ...element,
118 permission: 'denied',
119 };
120 }
121
122 return {
123 ...element,
124 permission: 'granted',
125 };
126 }
127
128 public async requestPermissions() {
129 const permissions = {

Callers 1

initMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected