Methods
向注册表添加受信任的服务器
| Name | Type | Description |
|---|---|---|
host |
string | 要添加的主机。 |
port |
number | 用于访问该主机的端口。 |
Example:
// 添加受信任的服务器
TrustedServers.add('my.server.com', 80);
Clears the registry
Example:
// Remove a trusted server
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 受信任
}
if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
// my.server.com 不受信任
}
从注册表中移除受信任的服务器
| Name | Type | Description |
|---|---|---|
host |
string | 要移除的主机。 |
port |
number | 用于访问该主机的端口。 |
Example:
// 移除受信任的服务器
TrustedServers.remove('my.server.com', 80);
