1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-09-27 23:05:55 -04:00

🐛 Don't rerequest resource when bypassing TOFU

This commit is contained in:
makeworld 2020-06-24 12:06:44 -04:00
parent bd6daa5a3c
commit e8e23c7fe6
2 changed files with 9 additions and 10 deletions

View File

@ -105,11 +105,9 @@ func handleTofu(cert *x509.Certificate, port string) bool {
return false return false
} }
// RemoveTofuEntry invalidates the TOFU entry in the database for the given cert and port. // ResetTofuEntry forces the cert passed to be valid, overwriting any previous TOFU entry.
// This will make any cert for that domain valid.
//
// The port string can be empty, to indicate port 1965. // The port string can be empty, to indicate port 1965.
func RemoveTofuEntry(cert *x509.Certificate, port string) { func ResetTofuEntry(cert *x509.Certificate, port string) {
tofuStore.Set(idKey(cert.Subject.CommonName, port), "") tofuStore.Set(idKey(cert.Subject.CommonName, port), "")
tofuStore.WriteConfig() tofuStore.WriteConfig()
} }

View File

@ -228,13 +228,14 @@ func handleURL(u string) (string, bool) {
if err == client.ErrTofu { if err == client.ErrTofu {
if Tofu(parsed.Host) { if Tofu(parsed.Host) {
// They want to continue anyway // They want to continue anyway
client.RemoveTofuEntry(res.Cert, parsed.Port()) client.ResetTofuEntry(res.Cert, parsed.Port())
return handleURL(u) // Response can be used further down
} } else {
// They don't want to continue // They don't want to continue
// Set the bar back to original URL // Set the bar back to original URL
bottomBar.SetText(tabMap[curTab].Url) bottomBar.SetText(tabMap[curTab].Url)
return "", false return "", false
}
} else if err != nil { } else if err != nil {
Error("URL Fetch Error", err.Error()) Error("URL Fetch Error", err.Error())
// Set the bar back to original URL // Set the bar back to original URL