Skip to content

Commit

Permalink
Merge pull request #147 from njzydark/fix-perimission
Browse files Browse the repository at this point in the history
fix(permission): check and request permission should ignore url port
  • Loading branch information
Moustachauve authored Feb 5, 2024
2 parents 16446db + b0df166 commit 65c76b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions interface/lib/permissionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export class PermissionHandler {
const testPermission = {
origins: [url],
};
try {
const { protocol, hostname } = new URL(url);
testPermission.origins = [`${protocol}//${hostname}/*`];
} catch (err) {
console.error(err);
}

// If we don't have access to the permission API, assume we have
// access. Safari devtools can't access the API.
Expand All @@ -70,6 +76,12 @@ export class PermissionHandler {
const permission = {
origins: [url],
};
try {
const { protocol, hostname } = new URL(url);
permission.origins = [`${protocol}//${hostname}/*`];
} catch (err) {
console.error(err);
}
return this.browserDetector.getApi().permissions.request(permission);
}
}

0 comments on commit 65c76b2

Please sign in to comment.