Skip to content

domain/permissions/site-permissions

PermissionDecision = "allow" | "block"

Defined in: app/src/domain/permissions/site-permissions.ts:14

What the user decided about a permission for a site.


RequestAnswer = { kind: "allow"; } | { kind: "block"; } | { kind: "ask"; permissions: readonly SitePermission[]; }

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 = Readonly<Partial<Record<SitePermission, PermissionDecision>>>

Defined in: app/src/domain/permissions/site-permissions.ts:17

The decisions of one site.


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 = 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.

const maxSites: 10000 = 10_000

Defined in: app/src/domain/permissions/site-permissions.ts:23

Most sites with decisions, so the setting stays small.


const sitePermissions: readonly SitePermission[]

Defined in: app/src/domain/permissions/site-permissions.ts:5

The permissions in the order in which prompts and the settings page name them.

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.

SitePermissions

The decisions of all sites.

string

The origin of the page.

readonly SitePermission[]

The permissions that the request needs.

RequestAnswer


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.

SitePermissions

The decisions of all sites.

string

The origin of the page.

readonly SitePermission[]

The permissions that were asked for.

PermissionDecision

The answer.

SitePermissions

The new decisions, or the old ones when no further site fits.


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.

SitePermissions

The decisions of all sites.

string

The origin.

SitePermission

The permission.

SitePermissions


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.

SitePermissions

The decisions of all sites.

string

The origin of the page.

string

Electron’s name of the permission.

string

For media, the device: video or audio.

boolean


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.

string

Electron’s name of the permission.

string

The origin of the page.

string

The address or origin of the frame that asks.

boolean


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.

string

The address of the page, as Chromium reports it.

string | undefined


permissionsFor(permission, mediaTypes?): readonly SitePermission[] | "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.

string

Electron’s name of the permission, such as media.

readonly string[] = []

For media, the devices that the page wants: video, audio or both.

readonly SitePermission[] | "grant" | "refuse"