(groupName)
| 285 | return response; |
| 286 | } |
| 287 | const getPolicy = (groupName) => { |
| 288 | if (isSurge) { |
| 289 | if (typeof ($httpAPI) === 'undefined') return 3; |
| 290 | return new Promise((resolve) => { |
| 291 | $httpAPI("GET", "v1/policy_groups/select", { |
| 292 | group_name: encodeURIComponent(groupName) |
| 293 | }, (b) => resolve(b.policy || 2)) |
| 294 | }) |
| 295 | } |
| 296 | if (isLoon) { |
| 297 | if (typeof ($config.getPolicy) === 'undefined') return 3; |
| 298 | const getName = $config.getPolicy(groupName); |
| 299 | return getName || 2; |
| 300 | } |
| 301 | if (isQuanX) { |
| 302 | if (typeof ($configuration) === 'undefined') return 3; |
| 303 | return new Promise((resolve) => { |
| 304 | $configuration.sendMessage({ |
| 305 | action: "get_policy_state" |
| 306 | }).then(b => { |
| 307 | if (b.ret && b.ret[groupName]) { |
| 308 | resolve(b.ret[groupName][1]); |
| 309 | } else resolve(2); |
| 310 | }, () => resolve()); |
| 311 | }) |
| 312 | } |
| 313 | } |
| 314 | const setPolicy = (group, policy) => { |
| 315 | if (isSurge && typeof ($httpAPI) !== 'undefined') { |
| 316 | return new Promise((resolve) => { |
nothing calls this directly
no outgoing calls
no test coverage detected