Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435import Foundation
struct SupportMetadata { let email: String let issuesURL: String
init(product: DevProduct) throws { email = product["PRODUCT_SUPPORT_EMAIL"] ?? "" guard email.isEmpty || Self.validAddress(email) else { throw DevError("Invalid PRODUCT_SUPPORT_EMAIL in Scripts/product.env") } let configuredURL = product["PRODUCT_ISSUES_URL"] ?? "" issuesURL = configuredURL.isEmpty ? "https://tangled.org/vinnymac.dev/parcel/issues" : configuredURL _ = try UpdateMetadata.https(issuesURL) }
private static func validAddress(_ value: String) -> Bool { let parts = value.split(separator: "@", omittingEmptySubsequences: false) guard parts.count == 2, !parts[0].isEmpty, !parts[1].isEmpty, value.utf8.count <= 254 else { return false } func asciiLetterOrDigit(_ byte: UInt8) -> Bool { (65...90).contains(byte) || (97...122).contains(byte) || (48...57).contains(byte) } let local = parts[0] guard local.utf8.allSatisfy({ asciiLetterOrDigit($0) || [46, 95, 37, 43, 45].contains($0) }), local.first != ".", local.last != ".", !local.contains("..") else { return false } let labels = parts[1].split(separator: ".", omittingEmptySubsequences: false) return labels.count >= 2 && labels.allSatisfy { !$0.isEmpty && $0.utf8.count <= 63 && $0.first != "-" && $0.last != "-" && $0.utf8.allSatisfy { asciiLetterOrDigit($0) || $0 == 45 } } }}