(group, policy)
| 312 | } |
| 313 | } |
| 314 | const setPolicy = (group, policy) => { |
| 315 | if (isSurge && typeof ($httpAPI) !== 'undefined') { |
| 316 | return new Promise((resolve) => { |
| 317 | $httpAPI("POST", "v1/policy_groups/select", { |
| 318 | group_name: group, |
| 319 | policy: policy |
| 320 | }, (b) => resolve(!b.error || 0)) |
| 321 | }) |
| 322 | } |
| 323 | if (isLoon && typeof ($config.getPolicy) !== 'undefined') { |
| 324 | const set = $config.setSelectPolicy(group, policy); |
| 325 | return set || 0; |
| 326 | } |
| 327 | if (isQuanX && typeof ($configuration) !== 'undefined') { |
| 328 | return new Promise((resolve) => { |
| 329 | $configuration.sendMessage({ |
| 330 | action: "set_policy_state", |
| 331 | content: { |
| 332 | [group]: policy |
| 333 | } |
| 334 | }).then((b) => resolve(!b.error || 0), () => resolve()); |
| 335 | }) |
| 336 | } |
| 337 | } |
| 338 | const get = (options, callback) => { |
| 339 | if (isQuanX) { |
| 340 | options["method"] = "GET"; |
nothing calls this directly
no outgoing calls
no test coverage detected