diff --git a/models/domain.go b/models/domain.go index cf19230df..1af4483a2 100644 --- a/models/domain.go +++ b/models/domain.go @@ -233,6 +233,8 @@ func (dc *DomainConfig) GetPopulateCorrections(providerName string) []*Correctio return dc.pendingPopulateCorrections[providerName] } +// MakeFakeDomainConfig makes a DomainConfig with the given domain name. This is a workaround so we don't have to change sygnatures of every function that needs a DomainConfig. +// In the future we'll eliminate this by passing a DomainFixedForms instead (and possibly renaming DomainFixedForms). func MakeFakeDomainConfig(domain string) *DomainConfig { v := domaintags.MakeDomainNameVarieties(domain) return &DomainConfig{ diff --git a/pkg/domaintags/domaintags.go b/pkg/domaintags/domaintags.go index 6296641cd..3b2381e23 100644 --- a/pkg/domaintags/domaintags.go +++ b/pkg/domaintags/domaintags.go @@ -7,6 +7,7 @@ import ( ) // DomainFixedForms stores the various fixed forms of a domain name and tag. +// TODO(tlim): Rename this to DomainNameVarieties or something similar. type DomainFixedForms struct { NameRaw string // "originalinput.com" (name as input by the user, lowercased (no tag)) NameASCII string // "punycode.com" diff --git a/pkg/js/helpers.js b/pkg/js/helpers.js index 0c7890f2c..a18e01714 100644 --- a/pkg/js/helpers.js +++ b/pkg/js/helpers.js @@ -1353,8 +1353,6 @@ function recordBuilder(type, opts) { if ( d.subdomain && record.type != 'CF_SINGLE_REDIRECT' && - record.type != 'CF_REDIRECT' && - record.type != 'CF_TEMP_REDIRECT' && record.type != 'CF_WORKER_ROUTE' && record.type != 'ADGUARDHOME_A_PASSTHROUGH' && record.type != 'ADGUARDHOME_AAAA_PASSTHROUGH' @@ -1492,28 +1490,6 @@ function _validateCloudflareRedirect(value) { return value.indexOf(',') === -1; } -//var CF_REDIRECT = recordBuilder('CF_REDIRECT', { -// args: [ -// ['source', _validateCloudflareRedirect], -// ['destination', _validateCloudflareRedirect], -// ], -// transform: function (record, args, modifiers) { -// record.name = '@'; -// record.target = args.source + ',' + args.destination; -// }, -//}); - -//var CF_TEMP_REDIRECT = recordBuilder('CF_TEMP_REDIRECT', { -// args: [ -// ['source', _validateCloudflareRedirect], -// ['destination', _validateCloudflareRedirect], -// ], -// transform: function (record, args, modifiers) { -// record.name = '@'; -// record.target = args.source + ',' + args.destination; -// }, -//}); - var CF_WORKER_ROUTE = recordBuilder('CF_WORKER_ROUTE', { args: [ ['pattern', _validateCloudflareRedirect], @@ -2516,8 +2492,7 @@ function rawrecordBuilder(type) { // PLEASE KEEP THIS LIST ALPHABETICAL! -// CLOUDFLAREAPI: +var CF_REDIRECT = rawrecordBuilder('CF_REDIRECT'); var CF_SINGLE_REDIRECT = rawrecordBuilder('CLOUDFLAREAPI_SINGLE_REDIRECT'); var CF_TEMP_REDIRECT = rawrecordBuilder('CF_TEMP_REDIRECT'); -var CF_REDIRECT = rawrecordBuilder('CF_REDIRECT'); var RP = rawrecordBuilder('RP'); diff --git a/pkg/rtypecontrol/import.go b/pkg/rtypecontrol/import.go index eca23d9f9..cd90720da 100644 --- a/pkg/rtypecontrol/import.go +++ b/pkg/rtypecontrol/import.go @@ -11,7 +11,6 @@ import ( // ImportRawRecords imports the RawRecordConfigs into RecordConfigs. func ImportRawRecords(domains []*models.DomainConfig) error { - for _, dc := range domains { for _, rawRec := range dc.RawRecords { @@ -98,8 +97,9 @@ func NewRecordConfigFromStruct(name string, ttl uint32, t string, fields any, dc return rec, nil } +// setRecordNames updates the .Name* fields. func setRecordNames(rec *models.RecordConfig, dc *models.DomainConfig, n string) { - + // FYI(tlim): This code could be collapse if rec.SubDomain == "" { // Not _EXTEND() mode: if n == "@" {