Skip to content

Commit

Permalink
Upgrade to electron v29.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tong committed Mar 14, 2024
1 parent 6cfd85b commit d88d600
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 480 deletions.
14 changes: 7 additions & 7 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"start": "electron ."
},
"devDependencies": {
"electron": "v29.0.1"
"electron": "v29.1.4"
}
}
745 changes: 399 additions & 346 deletions electron-api.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"description": "Type definitions for the electron framework",
"releasenote": "See CHANGELOG",
"version": "29.0.1",
"version": "29.1.4",
"contributors": [
"tong",
"fponticelli"
Expand Down
20 changes: 9 additions & 11 deletions src/electron/NativeImage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ package electron;
@:optional
var scaleFactor : Float; }):electron.NativeImage;
/**
Creates a new `NativeImage` instance from `dataURL`.
Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded Data URL string.
**/
static function createFromDataURL(dataURL:String):electron.NativeImage;
/**
Creates a new `NativeImage` instance from the NSImage that maps to the given image name. See `System Icons` for a list of possible values.
Creates a new `NativeImage` instance from the `NSImage` that maps to the given image name. See Apple's `NSImageName` documentation for a list of possible values.
The `hslShift` is applied to the image with the following rules:
Expand All @@ -58,8 +58,6 @@ package electron;
In some cases, the `NSImageName` doesn't match its string representation; one example of this is `NSFolderImageName`, whose string representation would actually be `NSFolder`. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:
`echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - && ./test`
where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
**/
static function createFromNamedImage(imageName:String, ?hslShift:Array<Float>):electron.NativeImage;
Expand Down Expand Up @@ -90,7 +88,7 @@ package electron;
@:optional
var scaleFactor : Float; }):js.node.Buffer;
/**
The data URL of the image.
The Data URL of the image.
**/
function toDataURL(?options:{ /**
Defaults to 1.0.
Expand All @@ -108,7 +106,7 @@ package electron;
@:optional
var scaleFactor : Float; }):js.node.Buffer;
/**
A Buffer that stores C pointer to underlying native handle of the image. On macOS, a pointer to `NSImage` instance would be returned.
A Buffer that stores C pointer to underlying native handle of the image. On macOS, a pointer to `NSImage` instance is returned.
Notice that the returned pointer is a weak pointer to the underlying native image instead of a copy, so you _must_ ensure that the associated `nativeImage` instance is kept around.
**/
Expand All @@ -122,11 +120,11 @@ package electron;
**/
function getSize(?scaleFactor:Float):electron.Size;
/**
Marks the image as a template image.
Marks the image as a macOS template image.
**/
function setTemplateImage(option:Bool):Void;
/**
Whether the image is a template image.
Whether the image is a macOS template image.
**/
function isTemplateImage():Bool;
/**
Expand All @@ -152,17 +150,17 @@ package electron;
@:optional
var quality : String; }):electron.NativeImage;
/**
The image's aspect ratio.
The image's aspect ratio (width divided by height).
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
**/
function getAspectRatio(?scaleFactor:Float):Float;
/**
An array of all scale factors corresponding to representations for a given nativeImage.
An array of all scale factors corresponding to representations for a given `NativeImage`.
**/
function getScaleFactors():Array<Float>;
/**
Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.
Add an image representation for a specific scale factor. This can be used to programmatically add different scale factor representations to an image. This can be called on empty images.
**/
function addRepresentation(options:{ /**
The scale factor to add the image representation for.
Expand Down
65 changes: 65 additions & 0 deletions src/electron/ProxyConfig.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package electron;
/**
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules` option is ignored and `pacScript` configuration is applied.
The `proxyRules` has to follow the rules below:
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use `socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples: ".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.
Examples: "192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the host matches one of: "127.0.0.1", "::1", "localhost".
@see https://electronjs.org/docs/api/structures/proxy-config
**/
typedef ProxyConfig = {
/**
The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`, `fixed_servers` or `system`. Defaults to `pac_script` proxy mode if `pacScript` option is specified otherwise defaults to `fixed_servers`.
**/
@:optional
var mode : String;
/**
The URL associated with the PAC file.
**/
@:optional
var pacScript : String;
/**
Rules indicating which proxies to use.
**/
@:optional
var proxyRules : String;
/**
Rules indicating which URLs should bypass the proxy settings.
**/
@:optional
var proxyBypassRules : String;
}
5 changes: 5 additions & 0 deletions src/electron/main/App.hx
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,11 @@ package electron.main;
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
**/
static function setSecureKeyboardEntryEnabled(enabled:Bool):Void;
static function setProxy(config:electron.ProxyConfig):Void;
/**
Resolves with the proxy information for `url` that will be used when attempting to make requests using Net in the utility process.
**/
static function resolveProxy(url:String):js.lib.Promise<Any>;
static function on<T:(haxe.Constraints.Function)>(eventType:Dynamic, callback:T):Void;
}
enum abstract AppEvent<T:(haxe.Constraints.Function)>(js.node.events.EventEmitter.Event<T>) from js.node.events.EventEmitter.Event<T> {
Expand Down
58 changes: 1 addition & 57 deletions src/electron/main/Session.hx
Original file line number Diff line number Diff line change
Expand Up @@ -94,65 +94,9 @@ package electron.main;
Sets the proxy settings.
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules` option is ignored and `pacScript` configuration is applied.
You may need `ses.closeAllConnections` to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.
The `proxyRules` has to follow the rules below:
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use `socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples: ".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.
Examples: "192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the host matches one of: "127.0.0.1", "::1", "localhost".
**/
function setProxy(config:{ /**
The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`, `fixed_servers` or `system`. If it's unspecified, it will be automatically determined based on other specified options.
**/
@:optional
var mode : String; /**
The URL associated with the PAC file.
**/
@:optional
var pacScript : String; /**
Rules indicating which proxies to use.
**/
@:optional
var proxyRules : String; /**
Rules indicating which URLs should bypass the proxy settings.
**/
@:optional
var proxyBypassRules : String; }):js.lib.Promise<Any>;
function setProxy(config:electron.ProxyConfig):js.lib.Promise<Any>;
/**
Resolves with the resolved IP addresses for the `host`.
**/
Expand Down
5 changes: 5 additions & 0 deletions src/electron/remote/App.hx
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,11 @@ package electron.remote;
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
**/
static function setSecureKeyboardEntryEnabled(enabled:Bool):Void;
static function setProxy(config:electron.ProxyConfig):Void;
/**
Resolves with the proxy information for `url` that will be used when attempting to make requests using Net in the utility process.
**/
static function resolveProxy(url:String):js.lib.Promise<Any>;
static function on<T:(haxe.Constraints.Function)>(eventType:Dynamic, callback:T):Void;
}
enum abstract AppEvent<T:(haxe.Constraints.Function)>(js.node.events.EventEmitter.Event<T>) from js.node.events.EventEmitter.Event<T> {
Expand Down
58 changes: 1 addition & 57 deletions src/electron/remote/Session.hx
Original file line number Diff line number Diff line change
Expand Up @@ -94,65 +94,9 @@ package electron.remote;
Sets the proxy settings.
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules` option is ignored and `pacScript` configuration is applied.
You may need `ses.closeAllConnections` to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.
The `proxyRules` has to follow the rules below:
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use `socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples: ".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.
Examples: "192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the host matches one of: "127.0.0.1", "::1", "localhost".
**/
function setProxy(config:{ /**
The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`, `fixed_servers` or `system`. If it's unspecified, it will be automatically determined based on other specified options.
**/
@:optional
var mode : String; /**
The URL associated with the PAC file.
**/
@:optional
var pacScript : String; /**
Rules indicating which proxies to use.
**/
@:optional
var proxyRules : String; /**
Rules indicating which URLs should bypass the proxy settings.
**/
@:optional
var proxyBypassRules : String; }):js.lib.Promise<Any>;
function setProxy(config:electron.ProxyConfig):js.lib.Promise<Any>;
/**
Resolves with the resolved IP addresses for the `host`.
**/
Expand Down

0 comments on commit d88d600

Please sign in to comment.