Hide CA expiration errors on managed sites (#128)
This commit is contained in:
parent
69d0641874
commit
693c7b6346
|
@ -52,7 +52,7 @@ class Sites(private var engine: FlutterEngine) {
|
||||||
val context = MainActivity.getContext()!!
|
val context = MainActivity.getContext()!!
|
||||||
val site = containers[id]!!.site
|
val site = containers[id]!!.site
|
||||||
|
|
||||||
val baseDir = if(site.managed == true) context.noBackupFilesDir else context.filesDir
|
val baseDir = if(site.managed) context.noBackupFilesDir else context.filesDir
|
||||||
val siteDir = baseDir.resolve("sites").resolve(id)
|
val siteDir = baseDir.resolve("sites").resolve(id)
|
||||||
siteDir.deleteRecursively()
|
siteDir.deleteRecursively()
|
||||||
refreshSites()
|
refreshSites()
|
||||||
|
@ -275,7 +275,7 @@ class Site(context: Context, siteDir: File) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors && !managed) {
|
||||||
errors.add("There are issues with 1 or more ca certificates")
|
errors.add("There are issues with 1 or more ca certificates")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,15 @@ class Site: Codable {
|
||||||
id = incoming.id
|
id = incoming.id
|
||||||
staticHostmap = incoming.staticHostmap
|
staticHostmap = incoming.staticHostmap
|
||||||
unsafeRoutes = incoming.unsafeRoutes ?? []
|
unsafeRoutes = incoming.unsafeRoutes ?? []
|
||||||
|
lhDuration = incoming.lhDuration
|
||||||
|
port = incoming.port
|
||||||
|
cipher = incoming.cipher
|
||||||
|
sortKey = incoming.sortKey ?? 0
|
||||||
|
logVerbosity = incoming.logVerbosity ?? "info"
|
||||||
|
mtu = incoming.mtu ?? 1300
|
||||||
|
managed = incoming.managed ?? false
|
||||||
|
lastManagedUpdate = incoming.lastManagedUpdate
|
||||||
|
rawConfig = incoming.rawConfig
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let rawCert = incoming.cert
|
let rawCert = incoming.cert
|
||||||
|
@ -232,7 +241,7 @@ class Site: Codable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors && !managed) {
|
||||||
errors.append("There are issues with 1 or more ca certificates")
|
errors.append("There are issues with 1 or more ca certificates")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,16 +257,6 @@ class Site: Codable {
|
||||||
errors.append("Unable to create the site directory: \(error.localizedDescription)")
|
errors.append("Unable to create the site directory: \(error.localizedDescription)")
|
||||||
}
|
}
|
||||||
|
|
||||||
lhDuration = incoming.lhDuration
|
|
||||||
port = incoming.port
|
|
||||||
cipher = incoming.cipher
|
|
||||||
sortKey = incoming.sortKey ?? 0
|
|
||||||
logVerbosity = incoming.logVerbosity ?? "info"
|
|
||||||
mtu = incoming.mtu ?? 1300
|
|
||||||
managed = incoming.managed ?? false
|
|
||||||
lastManagedUpdate = incoming.lastManagedUpdate
|
|
||||||
rawConfig = incoming.rawConfig
|
|
||||||
|
|
||||||
if (managed && (try? getDNCredentials())?.invalid != false) {
|
if (managed && (try? getDNCredentials())?.invalid != false) {
|
||||||
errors.append("Unable to fetch managed updates - please re-enroll the device")
|
errors.append("Unable to fetch managed updates - please re-enroll the device")
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,13 +154,16 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
|
||||||
|
|
||||||
Widget _keys() {
|
Widget _keys() {
|
||||||
final certError = site.certInfo == null || site.certInfo!.validity == null || !site.certInfo!.validity!.valid;
|
final certError = site.certInfo == null || site.certInfo!.validity == null || !site.certInfo!.validity!.valid;
|
||||||
var caError = site.ca.length == 0;
|
var caError = false;
|
||||||
if (!caError) {
|
if (!site.managed) {
|
||||||
site.ca.forEach((ca) {
|
var caError = site.ca.length == 0;
|
||||||
if (ca.validity == null || !ca.validity!.valid) {
|
if (!caError) {
|
||||||
caError = true;
|
site.ca.forEach((ca) {
|
||||||
}
|
if (ca.validity == null || !ca.validity!.valid) {
|
||||||
});
|
caError = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConfigSection(
|
return ConfigSection(
|
||||||
|
|
Loading…
Reference in New Issue