1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

Add (un)secure option for proxies

This commit is contained in:
2022-05-06 18:27:03 +02:00
parent 5067c7b87f
commit 1c15a4e07f

View File

@ -20,8 +20,26 @@ extension DomainListVC {
} }
func toggleSecureForProxy() { func toggleSecureForProxy() {
// TODO: Handle this correctly let originalSecureStatus = selectedProxy!.secured
print("Will secure or unsecure proxy") let selectedProxy = selectedProxy!
self.waitAndExecute {
// 1. Remove the original proxy
Shell.run("\(Paths.valet) unproxy \(selectedProxy.domain)", requiresPath: true)
// 2. Add a new proxy, which is either secured/unsecured
let secure = originalSecureStatus ? "" : " --secure"
Shell.run("\(Paths.valet) proxy \(selectedProxy.domain) \(selectedProxy.target)\(secure)",
requiresPath: true)
// 3. Restart nginx
Actions.restartNginx()
// 4. Reload site list
DispatchQueue.main.async {
App.shared.domainListWindowController?.pressedReload(nil)
}
}
} }
func toggleSecureForSite() { func toggleSecureForSite() {