domain/permissions/site-permissions
Type Aliases
Section titled “Type Aliases”PermissionDecision
Section titled “PermissionDecision”PermissionDecision =
"allow"|"block"
Defined in: app/src/domain/permissions/site-permissions.ts:14
What the user decided about a permission for a site.
RequestAnswer
Section titled “RequestAnswer”RequestAnswer = {
kind:"allow"; } | {kind:"block"; } | {kind:"ask";permissions: readonlySitePermission[]; }
Defined in: app/src/domain/permissions/site-permissions.ts:81
The answer to a request: given, refused, or a question about what is not decided.
SiteDecisions
Section titled “SiteDecisions”SiteDecisions =
Readonly<Partial<Record<SitePermission,PermissionDecision>>>
Defined in: app/src/domain/permissions/site-permissions.ts:17
The decisions of one site.
SitePermission
Section titled “SitePermission”SitePermission =
"camera"|"microphone"|"location"|"notifications"|"clipboard"
Defined in: app/src/domain/permissions/site-permissions.ts:2
A permission that a site asks for, and that the user gives or refuses for the site.
SitePermissions
Section titled “SitePermissions”SitePermissions =
Readonly<Record<string,SiteDecisions>>
Defined in: app/src/domain/permissions/site-permissions.ts:20
The decisions of all sites, by origin, such as https://meet.example.
Variables
Section titled “Variables”maxSites
Section titled “maxSites”
constmaxSites:10000=10_000
Defined in: app/src/domain/permissions/site-permissions.ts:23
Most sites with decisions, so the setting stays small.
sitePermissions
Section titled “sitePermissions”
constsitePermissions: readonlySitePermission[]
Defined in: app/src/domain/permissions/site-permissions.ts:5
The permissions in the order in which prompts and the settings page name them.
Functions
Section titled “Functions”answer()
Section titled “answer()”answer(
sites,origin,needed):RequestAnswer
Defined in: app/src/domain/permissions/site-permissions.ts:93
Answers a request from what was decided for the site: one refused permission refuses it, and it is given when every permission is allowed.
Parameters
Section titled “Parameters”The decisions of all sites.
origin
Section titled “origin”string
The origin of the page.
needed
Section titled “needed”readonly SitePermission[]
The permissions that the request needs.
Returns
Section titled “Returns”decide()
Section titled “decide()”decide(
sites,origin,permissions,decision):SitePermissions
Defined in: app/src/domain/permissions/site-permissions.ts:131
Records a decision of the user for some permissions of a site.
Parameters
Section titled “Parameters”The decisions of all sites.
origin
Section titled “origin”string
The origin of the page.
permissions
Section titled “permissions”readonly SitePermission[]
The permissions that were asked for.
decision
Section titled “decision”The answer.
Returns
Section titled “Returns”The new decisions, or the old ones when no further site fits.
forget()
Section titled “forget()”forget(
sites,origin,permission):SitePermissions
Defined in: app/src/domain/permissions/site-permissions.ts:153
Forgets the decision about a permission of a site, so the site asks again; a site without decisions leaves the list.
Parameters
Section titled “Parameters”The decisions of all sites.
origin
Section titled “origin”string
The origin.
permission
Section titled “permission”The permission.
Returns
Section titled “Returns”isGranted()
Section titled “isGranted()”isGranted(
sites,origin,permission,mediaType?):boolean
Defined in: app/src/domain/permissions/site-permissions.ts:112
Whether a site has a permission, for the checks of Chromium, such as the one behind
Notification.permission.
Parameters
Section titled “Parameters”The decisions of all sites.
origin
Section titled “origin”string
The origin of the page.
permission
Section titled “permission”string
Electron’s name of the permission.
mediaType?
Section titled “mediaType?”string
For media, the device: video or audio.
Returns
Section titled “Returns”boolean
mayAsk()
Section titled “mayAsk()”mayAsk(
permission,origin,requesting):boolean
Defined in: app/src/domain/permissions/site-permissions.ts:172
Whether a frame may use what its page decides. A page lets the frames of other sites use its camera, microphone and location through its permissions policy, which Chromium applies; no such policy covers notifications, so only the page’s own site gets them.
Parameters
Section titled “Parameters”permission
Section titled “permission”string
Electron’s name of the permission.
origin
Section titled “origin”string
The origin of the page.
requesting
Section titled “requesting”string
The address or origin of the frame that asks.
Returns
Section titled “Returns”boolean
originOf()
Section titled “originOf()”originOf(
url):string|undefined
Defined in: app/src/domain/permissions/site-permissions.ts:71
The origin under which a page’s decisions are kept: the scheme, host and port of a web address, without the usual port of the scheme. Other addresses have none, and their pages get no permissions.
Parameters
Section titled “Parameters”string
The address of the page, as Chromium reports it.
Returns
Section titled “Returns”string | undefined
permissionsFor()
Section titled “permissionsFor()”permissionsFor(
permission,mediaTypes?): readonlySitePermission[] |"grant"|"refuse"
Defined in: app/src/domain/permissions/site-permissions.ts:34
What a request of Chromium needs: nothing, because it is granted without asking or always refused, or the permissions of the site to check, and to ask for when they are not decided. Full screen, pointer lock and writing to the clipboard are granted, as in other browsers; so is sharing the screen, whose picker asks for every request. Everything else that has no prompt is refused.
Parameters
Section titled “Parameters”permission
Section titled “permission”string
Electron’s name of the permission, such as media.
mediaTypes?
Section titled “mediaTypes?”readonly string[] = []
For media, the devices that the page wants: video, audio or both.
Returns
Section titled “Returns”readonly SitePermission[] | "grant" | "refuse"