flushFakeipCache.
This commit is contained in:
parent
5a10415064
commit
00429aeee0
|
@ -52,6 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
@IBOutlet var proxyProvidersMenuItem: NSMenuItem!
|
||||
@IBOutlet var ruleProvidersMenuItem: NSMenuItem!
|
||||
@IBOutlet var snifferMenuItem: NSMenuItem!
|
||||
@IBOutlet var flushFakeipCacheMenuItem: NSMenuItem!
|
||||
|
||||
var disposeBag = DisposeBag()
|
||||
var statusItemView: StatusItemView!
|
||||
|
@ -855,6 +856,12 @@ extension AppDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@IBAction func flushFakeipCache(_ sender: NSMenuItem) {
|
||||
ApiRequest.flushFakeipCache() {
|
||||
NSUserNotificationCenter.default.post(title: "Flush fake-ip cache", info: $0 ? "Success" : "Failed")
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func updateSniffing(_ sender: NSMenuItem) {
|
||||
let enable = sender.state != .on
|
||||
ApiRequest.updateSniffing(enable: enable) {
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<outlet property="dashboardMenuItem" destination="XG6-2M-PNi" id="hzn-77-3Uc"/>
|
||||
<outlet property="experimentalMenu" destination="sbS-Fj-gxn" id="m2U-Zq-cKD"/>
|
||||
<outlet property="externalControlSeparator" destination="tXn-AQ-OT3" id="ddo-u2-wUb"/>
|
||||
<outlet property="flushFakeipCacheMenuItem" destination="WZT-AH-ria" id="Sb4-rY-pg2"/>
|
||||
<outlet property="hideUnselecableMenuItem" destination="C3l-5G-vzB" id="pxn-sY-Hmf"/>
|
||||
<outlet property="httpPortMenuItem" destination="WNw-8Y-VFw" id="ldW-Gw-Q9L"/>
|
||||
<outlet property="ipMenuItem" destination="D2R-eG-cms" id="ugc-iD-j9T"/>
|
||||
|
@ -376,6 +377,12 @@
|
|||
<action selector="updateGEO:" target="Voe-Tx-rLC" id="TMi-ff-cMZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Flush fake-ip cache" id="WZT-AH-ria">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="flushFakeipCache:" target="Voe-Tx-rLC" id="ghQ-ZK-r9u"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Proxy providers" id="4Jz-gx-7X9">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Proxy providers" id="PXU-hU-r0O"/>
|
||||
|
|
|
@ -388,6 +388,16 @@ extension ApiRequest {
|
|||
completeHandler?()
|
||||
}
|
||||
}
|
||||
|
||||
static func flushFakeipCache(completeHandler: ((Bool) -> Void)? = nil) {
|
||||
Logger.log("FlushFakeipCache")
|
||||
req("/cache/fakeip/flush",
|
||||
method: .post).response {
|
||||
let re = $0.response?.statusCode == 204
|
||||
completeHandler?(re)
|
||||
Logger.log("FlushFakeipCache \(re ? "success" : "failed")")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Stream Apis
|
||||
|
|
Loading…
Reference in New Issue