Methods
将受信任的服务器添加到注册表。
Name | Type | Description |
---|---|---|
host |
String | 要添加的主机。 |
port |
Number | 用于访问主机的端口。 |
Example:
// 添加受信任的服务器。
TrustedServers.add('my.server.com', 80);
清理注册表。
Example:
// 删除受信任的服务器。
TrustedServers.clear();
测试服务器是否受信任。如果该服务器包含在url中,那么它必须已经添加了端口。
Name | Type | Description |
---|---|---|
url |
String | 要根据受信任列表测试的url |
Returns:
如果url受信任,则返回true,否则返回false。
Example:
// 添加服务器
TrustedServers.add('my.server.com', 81);
// 检查服务器是否受信任
if (TrustedServers.contains('https://my.server.com:81/path/to/file.png')) {
// my.server.com:81 is trusted
}
if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
// my.server.com isn't trusted
}
从注册表中删除受信任的服务器
Name | Type | Description |
---|---|---|
host |
String | 要删除的主机。 |
port |
Number | 用于访问主机的端口。 |
Example:
// 删除受信任的服务器
TrustedServers.remove('my.server.com', 80);