fix: update docs for protocol API (#16601)
* fix: update docs for protocol API * upddate source for new attribute name * update electron-typescript-definitions package
This commit is contained in:
parent
641b47f384
commit
bd4e14dcee
6 changed files with 32 additions and 29 deletions
|
@ -59,7 +59,7 @@ struct Converter<CustomScheme> {
|
||||||
return false;
|
return false;
|
||||||
mate::Dictionary opt;
|
mate::Dictionary opt;
|
||||||
// options are optional. Default values specified in SchemeOptions are used
|
// options are optional. Default values specified in SchemeOptions are used
|
||||||
if (dict.Get("options", &opt)) {
|
if (dict.Get("privileges", &opt)) {
|
||||||
opt.Get("standard", &(out->options.standard));
|
opt.Get("standard", &(out->options.standard));
|
||||||
opt.Get("supportFetchAPI", &(out->options.supportFetchAPI));
|
opt.Get("supportFetchAPI", &(out->options.supportFetchAPI));
|
||||||
opt.Get("secure", &(out->options.secure));
|
opt.Get("secure", &(out->options.secure));
|
||||||
|
|
|
@ -28,9 +28,9 @@ of the `app` module gets emitted.
|
||||||
|
|
||||||
The `protocol` module has the following methods:
|
The `protocol` module has the following methods:
|
||||||
|
|
||||||
### `protocol.registerSchemesAsPrivileged(schemes[, options])`
|
### `protocol.registerSchemesAsPrivileged(customSchemes)`
|
||||||
|
|
||||||
* `custom_schemes` [CustomScheme[]](structures/custom-scheme.md)
|
* `customSchemes` [CustomScheme[]](structures/custom-scheme.md)
|
||||||
|
|
||||||
|
|
||||||
**Note:** This method can only be used before the `ready` event of the `app`
|
**Note:** This method can only be used before the `ready` event of the `app`
|
||||||
|
@ -39,13 +39,13 @@ module gets emitted and can be called only once.
|
||||||
Registers the `scheme` as standard, secure, bypasses content security policy for resources,
|
Registers the `scheme` as standard, secure, bypasses content security policy for resources,
|
||||||
allows registering ServiceWorker and supports fetch API.
|
allows registering ServiceWorker and supports fetch API.
|
||||||
|
|
||||||
Specify an option with the value of `true` to enable the capability.
|
Specify a privilege with the value of `true` to enable the capability.
|
||||||
An example of registering a privileged scheme, with bypassing Content Security Policy:
|
An example of registering a privileged scheme, with bypassing Content Security Policy:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const { protocol } = require('electron')
|
const { protocol } = require('electron')
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
{ scheme: 'foo', options: { bypassCSP: true } }
|
{ scheme: 'foo', privileges: { bypassCSP: true } }
|
||||||
])
|
])
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# CustomScheme Object
|
# CustomScheme Object
|
||||||
|
|
||||||
* `scheme` String - Custom schemes to be registered with options.
|
* `scheme` String - Custom schemes to be registered with options.
|
||||||
* `options` Object (optional)
|
* `privileges` Object (optional)
|
||||||
* `standard` Boolean (optional) - Default false.
|
* `standard` Boolean (optional) - Default false.
|
||||||
* `secure` Boolean (optional) - Default false.
|
* `secure` Boolean (optional) - Default false.
|
||||||
* `bypassCSP` Boolean (optional) - Default false.
|
* `bypassCSP` Boolean (optional) - Default false.
|
||||||
|
|
31
package-lock.json
generated
31
package-lock.json
generated
|
@ -313,6 +313,7 @@
|
||||||
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
|
||||||
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
|
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"kind-of": "^3.0.2",
|
"kind-of": "^3.0.2",
|
||||||
"longest": "^1.0.1",
|
"longest": "^1.0.1",
|
||||||
|
@ -1550,7 +1551,7 @@
|
||||||
"circular-json": {
|
"circular-json": {
|
||||||
"version": "0.3.3",
|
"version": "0.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
|
||||||
"integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
|
"integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"clang-format": {
|
"clang-format": {
|
||||||
|
@ -2270,7 +2271,8 @@
|
||||||
"version": "0.3.4",
|
"version": "0.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz",
|
||||||
"integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==",
|
"integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"cssstyle": {
|
"cssstyle": {
|
||||||
"version": "0.2.37",
|
"version": "0.2.37",
|
||||||
|
@ -2932,9 +2934,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron-typescript-definitions": {
|
"electron-typescript-definitions": {
|
||||||
"version": "4.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron-typescript-definitions/-/electron-typescript-definitions-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron-typescript-definitions/-/electron-typescript-definitions-6.0.0.tgz",
|
||||||
"integrity": "sha512-UekaKgK8omivfj37xs1G09j5MctHCFSyPYvW67j30xYHVCvgjDLur1Vqd7CaaJCDuaYLsHjsmms4QjG8uOFb4A==",
|
"integrity": "sha512-W2CHJ1bUtbDXXzIAEbQ+s2XewpSdUUqNECJmhniV0GbPoIhwjAg90++BkMxH6wPBxHWOxesvUMipUEeJN9+wlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "^7.0.18",
|
"@types/node": "^7.0.18",
|
||||||
|
@ -4147,7 +4149,7 @@
|
||||||
"find-root": {
|
"find-root": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
|
||||||
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
|
"integrity": "sha1-q8/Iunb3CMQql7PWhbfpRQv7nOQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"find-up": {
|
"find-up": {
|
||||||
|
@ -5235,7 +5237,7 @@
|
||||||
"gunzip-maybe": {
|
"gunzip-maybe": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.1.tgz",
|
||||||
"integrity": "sha1-Occu2J0bSbpwjhh3ZQBIiQKlICc=",
|
"integrity": "sha512-qtutIKMthNJJgeHQS7kZ9FqDq59/Wn0G2HYCRNjpup7yKfVI6/eqwpmroyZGFoCYaG+sW6psNVb4zoLADHpp2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"browserify-zlib": "^0.1.4",
|
"browserify-zlib": "^0.1.4",
|
||||||
|
@ -7398,7 +7400,8 @@
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
|
||||||
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
|
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"longest-streak": {
|
"longest-streak": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
|
@ -10287,7 +10290,7 @@
|
||||||
"sax": {
|
"sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
"integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=",
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -10793,7 +10796,7 @@
|
||||||
"split": {
|
"split": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
||||||
"integrity": "sha1-YFvZvjA6pZ+zX5Ip++oN3snqB9k=",
|
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"through": "2"
|
"through": "2"
|
||||||
|
@ -10811,7 +10814,7 @@
|
||||||
"split2": {
|
"split2": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz",
|
||||||
"integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=",
|
"integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"through2": "^2.0.2"
|
"through2": "^2.0.2"
|
||||||
|
@ -13070,9 +13073,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"write-file-atomic": {
|
"write-file-atomic": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz",
|
||||||
"integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==",
|
"integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.11",
|
"graceful-fs": "^4.1.11",
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"dotenv-safe": "^4.0.4",
|
"dotenv-safe": "^4.0.4",
|
||||||
"dugite": "^1.45.0",
|
"dugite": "^1.45.0",
|
||||||
"electron-docs-linter": "^2.4.0",
|
"electron-docs-linter": "^2.4.0",
|
||||||
"electron-typescript-definitions": "^4.0.0",
|
"electron-typescript-definitions": "^6.0.0",
|
||||||
"eslint": "^5.6.0",
|
"eslint": "^5.6.0",
|
||||||
"eslint-config-standard": "^12.0.0",
|
"eslint-config-standard": "^12.0.0",
|
||||||
"eslint-plugin-mocha": "^5.2.0",
|
"eslint-plugin-mocha": "^5.2.0",
|
||||||
|
|
|
@ -98,12 +98,12 @@ global.nativeModulesEnabled = !process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS
|
||||||
global.standardScheme = 'app'
|
global.standardScheme = 'app'
|
||||||
global.zoomScheme = 'zoom'
|
global.zoomScheme = 'zoom'
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
{ scheme: global.standardScheme, options: { standard: true, secure: true } },
|
{ scheme: global.standardScheme, privileges: { standard: true, secure: true } },
|
||||||
{ scheme: global.zoomScheme, options: { standard: true, secure: true } },
|
{ scheme: global.zoomScheme, privileges: { standard: true, secure: true } },
|
||||||
{ scheme: 'cors', options: { corsEnabled: true, supportFetchAPI: true } },
|
{ scheme: 'cors', privileges: { corsEnabled: true, supportFetchAPI: true } },
|
||||||
{ scheme: 'cors-blob', options: { corsEnabled: true, supportFetchAPI: true } },
|
{ scheme: 'cors-blob', privileges: { corsEnabled: true, supportFetchAPI: true } },
|
||||||
{ scheme: 'no-cors', options: { supportFetchAPI: true } },
|
{ scheme: 'no-cors', privileges: { supportFetchAPI: true } },
|
||||||
{ scheme: 'no-fetch', options: { corsEnabled: true } }
|
{ scheme: 'no-fetch', privileges: { corsEnabled: true } }
|
||||||
])
|
])
|
||||||
|
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
|
|
Loading…
Reference in a new issue