Hide CA expiration errors on managed sites (#128)

This commit is contained in:
John Maguire 2023-05-17 12:10:11 -04:00 committed by GitHub
parent 69d0641874
commit 693c7b6346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 26 deletions

View File

@ -52,7 +52,7 @@ class Sites(private var engine: FlutterEngine) {
val context = MainActivity.getContext()!!
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)
siteDir.deleteRecursively()
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")
}

View File

@ -194,6 +194,15 @@ class Site: Codable {
id = incoming.id
staticHostmap = incoming.staticHostmap
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 {
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")
}
@ -248,16 +257,6 @@ class Site: Codable {
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) {
errors.append("Unable to fetch managed updates - please re-enroll the device")
}

View File

@ -154,6 +154,8 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
Widget _keys() {
final certError = site.certInfo == null || site.certInfo!.validity == null || !site.certInfo!.validity!.valid;
var caError = false;
if (!site.managed) {
var caError = site.ca.length == 0;
if (!caError) {
site.ca.forEach((ca) {
@ -162,6 +164,7 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
}
});
}
}
return ConfigSection(
label: "IDENTITY",