diff --git a/assets/components/tracking/connector/ConnectorForm.tsx b/assets/components/tracking/connector/ConnectorForm.tsx index 1cd6d25..37db087 100644 --- a/assets/components/tracking/connector/ConnectorForm.tsx +++ b/assets/components/tracking/connector/ConnectorForm.tsx @@ -135,6 +135,7 @@ export function ConnectorForm({form, onCreate}: { form: FormInstance, onCreate: { provider === ConnectorProvider.AUTODNS && <> +
- {t`It is required, that a domain, which should registerd, is available in DNS`}} - required={false}> - - - - authData, $this->client); - $zoneCheck = $this->client->request( - 'POST', - '/v1/zone/_search?keys=name', - (new HttpOptions()) - ->setAuthBasic($authData["username"], $authData["password"]) - ->setHeader('Accept', 'application/json') - ->setHeader('X-Domainrobot-Context', $authData["context"]) - - ->setBaseUri(self::BASE_URL) - ->setJson([ - 'filters' => [ - [ - "key" => "name", - "value" => $ldhName, - "operator" => "EQUAL", - ] - ], - ]) - ->toArray() - )->toArray(); - - if (empty($zoneCheck["data"])) { - // The domain not yet exists in DNS Server, we create them - - $zoneCreateResponse = $this->client->request( - 'POST', - '/v1/zone', - (new HttpOptions()) - ->setAuthBasic($authData["username"], $authData["password"]) - ->setHeader('Accept', 'application/json') - ->setHeader('X-Domainrobot-Context', $authData["context"]) - - ->setBaseUri(self::BASE_URL) - ->setJson([ - 'origin' => $ldhName, - "main" => [ - "address" => $authData["dns_ip"] - ], - "soa" => [ - "refresh" => 3600, - "retry" => 7200, - "expire" => 604800, - "ttl" => 600 - ], - "action" => "COMPLETE", - "wwwInclude" => true, - "nameServers" => [ - [ - "name" => "a.ns14.net" - ], - [ - "name" => "b.ns14.net" - ], - [ - "name" => "c.ns14.net" - ], - [ - "name" => "d.ns14.net" - ], - ] - - ]) - ->toArray() - )->toArray(); - } - - if($dryRun) { return; } @@ -114,43 +47,121 @@ class AutodnsProvider extends AbstractProvider 'POST', '/v1/domain', (new HttpOptions()) - ->setAuthBasic($authData["username"], $authData["password"]) + ->setAuthBasic($authData['username'], $authData['password']) ->setHeader('Accept', 'application/json') - ->setHeader('X-Domainrobot-Context', $authData["context"]) + ->setHeader('X-Domainrobot-Context', $authData['context']) ->setBaseUri(self::BASE_URL) ->setJson([ 'name' => $ldhName, - "ownerc" => [ - "id" => $authData["contactid"], + 'ownerc' => [ + 'id' => $authData['contactid'], ], - "adminc" => [ - "id" => $authData["contactid"], + 'adminc' => [ + 'id' => $authData['contactid'], ], - "techc" => [ - "id" => $authData["contactid"], + 'techc' => [ + 'id' => $authData['contactid'], ], - "confirmOrder" => $authData["ownerConfirm"], - "nameServers" => [ + 'confirmOrder' => $authData['ownerConfirm'], + 'nameServers' => [ [ - "name" => "a.ns14.net" + 'name' => 'a.ns14.net' ], [ - "name" => "b.ns14.net" + 'name' => 'b.ns14.net' ], [ - "name" => "c.ns14.net" + 'name' => 'c.ns14.net' ], [ - "name" => "d.ns14.net" + 'name' => 'd.ns14.net' ], ] ]) ->toArray() )->toArray(); - } + public function registerZone(Domain $domain, bool $dryRun = false): void + { + $authData = $this->authData; + + $ldhName = $domain->getLdhName(); + + if($dryRun) { + return; + } + + $zoneCheck = $this->client->request( + 'POST', + '/v1/zone/_search?keys=name', + (new HttpOptions()) + ->setAuthBasic($authData['username'], $authData['password']) + ->setHeader('Accept', 'application/json') + ->setHeader('X-Domainrobot-Context', $authData['context']) + + ->setBaseUri(self::BASE_URL) + ->setJson([ + 'filters' => [ + [ + 'key' => 'name', + 'value' => $ldhName, + 'operator' => 'EQUAL', + ] + ], + ]) + ->toArray() + )->toArray(); + + $responseDataIsEmpty = empty($zoneCheck['data']); + + if ($responseDataIsEmpty) { + // The domain not yet exists in DNS Server, we create them + + $this->client->request( + 'POST', + '/v1/zone', + (new HttpOptions()) + ->setAuthBasic($authData['username'], $authData['password']) + ->setHeader('Accept', 'application/json') + ->setHeader('X-Domainrobot-Context', $authData['context']) + + ->setBaseUri(self::BASE_URL) + ->setJson([ + 'origin' => $ldhName, + 'main' => [ + 'address' => $authData['dns_ip'] + ], + 'soa' => [ + 'refresh' => 3600, + 'retry' => 7200, + 'expire' => 604800, + 'ttl' => 600 + ], + 'action' => 'COMPLETE', + 'wwwInclude' => true, + 'nameServers' => [ + [ + 'name' => 'a.ns14.net' + ], + [ + 'name' => 'b.ns14.net' + ], + [ + 'name' => 'c.ns14.net' + ], + [ + 'name' => 'd.ns14.net' + ], + ] + + ]) + ->toArray() + )->toArray(); + } + } + /** * @throws TransportExceptionInterface */ @@ -164,8 +175,8 @@ class AutodnsProvider extends AbstractProvider $ownerLegalAge = $authData['ownerLegalAge']; $waiveRetractationPeriod = $authData['waiveRetractationPeriod']; - if (empty($authData["context"])) { - $authData["context"] = 4; + if (empty($authData['context'])) { + $authData['context'] = 4; } if ( @@ -188,9 +199,9 @@ class AutodnsProvider extends AbstractProvider 'GET', '/v1/hello', (new HttpOptions()) - ->setAuthBasic($authData["username"], $authData["password"]) + ->setAuthBasic($authData['username'], $authData['password']) ->setHeader('Accept', 'application/json') - ->setHeader('X-Domainrobot-Context', $authData["context"]) + ->setHeader('X-Domainrobot-Context', $authData['context']) ->setBaseUri(self::BASE_URL) ->toArray() ); @@ -205,1138 +216,14 @@ class AutodnsProvider extends AbstractProvider return $authData; } - /** - * @throws TransportExceptionInterface - * @throws ServerExceptionInterface - * @throws RedirectionExceptionInterface - * @throws DecodingExceptionInterface - * @throws ClientExceptionInterface - */ - protected function getSupportedTldList(): array + public function isSupported(Domain ...$domainList): bool { - return [ - "abogado", - "ac", - "ac.cn", - "ac.mu", - "ac.nz", - "ac.vn", - "aca.pro", - "academy", - "accountant", - "accountants", - "actor", - "adult", - "ae", - "ae.org", - "aero", - "aeroport.fr", - "af", - "africa", - "ag", - "agency", - "ah.cn", - "ai", - "airforce", - "al", - "alsace", - "am", - "amsterdam", - "apartments", - "app", - "aq", - "ar", - "archi", - "army", - "art", - "arts.ro", - "as", - "asia", - "asn.au", - "asso.fr", - "associates", - "at", - "attorney", - "au", - "auction", - "audio", - "auto", - "autos", - "avocat.fr", - "ax", - "az", - "ba", - "baby", - "band", - "bank", - "bar", - "bar.pro", - "barcelona", - "bargains", - "bayern", - "bb", - "bbs.tr", - "be", - "beauty", - "beer", - "berlin", - "best", - "bet", - "bg", - "bi", - "bid", - "bike", - "bingo", - "bio", - "biz", - "biz.cy", - "biz.fj", - "biz.in", - "biz.mm", - "biz.pl", - "biz.pr", - "biz.ss", - "biz.tr", - "biz.vn", - "bj.cn", - "black", - "blackfriday", - "blog", - "blue", - "bm", - "bo", - "boats", - "bond", - "boo", - "boston", - "boutique", - "br.com", - "broker", - "brussels", - "bs", - "bt", - "build", - "builders", - "business", - "buzz", - "by", - "bz", - "ca", - "cab", - "cafe", - "cam", - "camera", - "camp", - "capetown", - "capital", - "car", - "cards", - "care", - "career", - "careers", - "cars", - "casa", - "case", - "cash", - "casino", - "cat", - "catering", - "cc", - "cci.fr", - "cd", - "center", - "ceo", - "cf", - "cfd", - "cg", - "ch", - "channel", - "charity", - "chat", - "cheap", - "christmas", - "church", - "city", - "cl", - "claims", - "cleaning", - "click", - "clinic", - "clothing", - "cloud", - "club", - "cm", - "cn", - "cn.com", - "co", - "co.ag", - "co.am", - "co.at", - "co.az", - "co.bi", - "co.bz", - "co.cg", - "co.cm", - "co.com", - "co.cr", - "co.gg", - "co.gl", - "co.gy", - "co.hu", - "co.id", - "co.il", - "co.im", - "co.in", - "co.ir", - "co.je", - "co.jp", - "co.ke", - "co.kr", - "co.lc", - "co.ls", - "co.ma", - "co.mg", - "co.ms", - "co.mu", - "co.na", - "co.ni", - "co.nz", - "co.pn", - "co.rs", - "co.rw", - "co.th", - "co.tt", - "co.ug", - "co.uk", - "co.ve", - "co.vi", - "co.za", - "co.zw", - "coach", - "codes", - "coffee", - "college", - "cologne", - "com", - "com.af", - "com.ag", - "com.ai", - "com.al", - "com.am", - "com.ar", - "com.au", - "com.az", - "com.bb", - "com.bi", - "com.bm", - "com.bo", - "com.br", - "com.bs", - "com.bt", - "com.by", - "com.bz", - "com.cg", - "com.cm", - "com.cn", - "com.co", - "com.cu", - "com.cy", - "com.de", - "com.dm", - "com.do", - "com.ec", - "com.ee", - "com.es", - "com.fj", - "com.fr", - "com.ge", - "com.gi", - "com.gl", - "com.gp", - "com.gr", - "com.gt", - "com.gy", - "com.hk", - "com.hn", - "com.hr", - "com.ht", - "com.im", - "com.in", - "com.kg", - "com.ki", - "com.kz", - "com.lb", - "com.lc", - "com.lv", - "com.ly", - "com.mg", - "com.mk", - "com.mm", - "com.ms", - "com.mt", - "com.mu", - "com.mx", - "com.my", - "com.na", - "com.nf", - "com.ng", - "com.ni", - "com.pa", - "com.pe", - "com.ph", - "com.pk", - "com.pl", - "com.pr", - "com.ps", - "com.pt", - "com.py", - "com.ro", - "com.ru", - "com.sa", - "com.sb", - "com.sc", - "com.sg", - "com.sl", - "com.so", - "com.ss", - "com.sv", - "com.tj", - "com.tr", - "com.tt", - "com.tw", - "com.ua", - "com.uy", - "com.vc", - "com.ve", - "com.vi", - "com.vn", - "community", - "company", - "compare", - "computer", - "condos", - "construction", - "consulting", - "contact", - "contractors", - "cooking", - "cool", - "coop", - "country", - "coupons", - "courses", - "cpa.pro", - "cq.cn", - "cr", - "credit", - "creditcard", - "cricket", - "cruises", - "cu", - "cx", - "cy", - "cyou", - "cz", - "dad", - "dance", - "date", - "dating", - "day", - "de", - "de.com", - "dealer", - "deals", - "degree", - "delivery", - "democrat", - "dental", - "dentist", - "design", - "dev", - "diamonds", - "diet", - "digital", - "direct", - "directory", - "discount", - "diy", - "dj", - "dk", - "dm", - "do", - "doctor", - "dog", - "domains", - "donetsk.ua", - "download", - "durban", - "earth", - "ec", - "eco", - "edu.gr", - "edu.hn", - "edu.mk", - "edu.ng", - "edu.vn", - "education", - "ee", - "email", - "energy", - "eng.pro", - "engineer", - "engineering", - "enterprises", - "equipment", - "es", - "esq", - "estate", - "eu", - "eu.com", - "events", - "exchange", - "expert", - "exposed", - "express", - "fail", - "faith", - "family", - "fan", - "fans", - "farm", - "fashion", - "fi", - "fin.ec", - "finance", - "financial", - "firm.in", - "firm.ro", - "fish", - "fishing", - "fit", - "fitness", - "fj.cn", - "flights", - "florist", - "flowers", - "fm", - "fo", - "foo", - "food", - "football", - "forsale", - "forum", - "foundation", - "fr", - "frl", - "fun", - "fund", - "furniture", - "futbol", - "fyi", - "ga", - "gallery", - "game", - "games", - "garden", - "gay", - "gb.net", - "gd", - "gd.cn", - "ge", - "geek.nz", - "gen.in", - "gen.nz", - "gen.tr", - "gg", - "gi", - "gift", - "gifts", - "gives", - "giving", - "gl", - "glass", - "global", - "gm", - "gmbh", - "gold", - "golf", - "gouv.fr", - "gov.gr", - "gp", - "gq", - "gr", - "gr.com", - "graphics", - "gratis", - "green", - "gripe", - "group", - "gs", - "gs.cn", - "gt", - "guide", - "guitars", - "guru", - "gx.cn", - "gy", - "gz.cn", - "ha.cn", - "hair", - "hamburg", - "haus", - "hb.cn", - "he.cn", - "health", - "health.vn", - "healthcare", - "help", - "hi.cn", - "hiphop", - "hiv", - "hk", - "hk.cn", - "hl.cn", - "hm", - "hn", - "hn.cn", - "hockey", - "holdings", - "holiday", - "homes", - "horse", - "hospital", - "host", - "hosting", - "house", - "how", - "hr", - "ht", - "hu", - "hu.net", - "icu", - "id", - "id.au", - "idv.tw", - "ie", - "im", - "immo", - "immobilien", - "in", - "in.th", - "in.ua", - "inc", - "ind.br", - "ind.in", - "industries", - "inf.mk", - "info", - "info.ec", - "info.fj", - "info.in", - "info.ke", - "info.pl", - "info.pr", - "info.ro", - "info.tr", - "info.vn", - "ing", - "ink", - "institute", - "insure", - "int.vn", - "international", - "investments", - "io", - "ir", - "irish", - "is", - "isla.pr", - "ist", - "istanbul", - "it", - "it.com", - "je", - "jetzt", - "jewelry", - "jl.cn", - "jobs", - "joburg", - "jp", - "jp.net", - "jpn.com", - "js.cn", - "juegos", - "jur.pro", - "jx.cn", - "kaufen", - "ke", - "kg", - "ki", - "kids", - "kiev.ua", - "kim", - "kitchen", - "koeln", - "kr", - "kz", - "la", - "land", - "lat", - "law", - "law.pro", - "lawyer", - "lc", - "lease", - "legal", - "lgbt", - "li", - "life", - "lifestyle", - "lighting", - "limited", - "limo", - "link", - "live", - "living", - "llc", - "ln.cn", - "loan", - "loans", - "lol", - "london", - "lotto", - "love", - "lt", - "ltd", - "ltd.gi", - "ltd.uk", - "ltda", - "lu", - "luxe", - "luxury", - "lv", - "ly", - "ma", - "madrid", - "maison", - "makeup", - "management", - "market", - "marketing", - "markets", - "mba", - "mc", - "md", - "me", - "me.in", - "me.ke", - "me.ss", - "me.uk", - "med.ec", - "med.pro", - "media", - "meme", - "memorial", - "men", - "menu", - "mg", - "miami", - "mk", - "ml", - "mn", - "mo.cn", - "mobi", - "mobi.ke", - "moda", - "moe", - "mom", - "money", - "monster", - "mortgage", - "moscow", - "motorcycles", - "mov", - "movie", - "mp", - "ms", - "mt", - "mu", - "museum", - "music", - "mw", - "mx", - "my", - "na", - "nagoya", - "name", - "name.fj", - "name.pr", - "name.tr", - "name.vn", - "navy", - "ne", - "ne.ke", - "net", - "net.af", - "net.ag", - "net.ai", - "net.al", - "net.am", - "net.au", - "net.az", - "net.bb", - "net.bm", - "net.br", - "net.bs", - "net.bt", - "net.by", - "net.bz", - "net.cm", - "net.cn", - "net.co", - "net.cy", - "net.dm", - "net.do", - "net.ec", - "net.fj", - "net.ge", - "net.gg", - "net.gp", - "net.gr", - "net.gt", - "net.gy", - "net.hk", - "net.hn", - "net.im", - "net.in", - "net.je", - "net.kg", - "net.ki", - "net.lb", - "net.lc", - "net.lv", - "net.ma", - "net.mg", - "net.mk", - "net.mt", - "net.mu", - "net.my", - "net.nf", - "net.ng", - "net.ni", - "net.nz", - "net.pe", - "net.ph", - "net.pk", - "net.pl", - "net.pn", - "net.pr", - "net.ps", - "net.ru", - "net.rw", - "net.sa", - "net.sb", - "net.sc", - "net.sl", - "net.so", - "net.ss", - "net.tr", - "net.tw", - "net.ua", - "net.uk", - "net.vc", - "net.vn", - "net.za", - "network", - "new", - "news", - "nexus", - "nf", - "ng", - "ni", - "ninja", - "nl", - "nm.cn", - "no", - "nom.ag", - "nom.co", - "nom.es", - "nom.fr", - "nom.ni", - "nom.pe", - "nom.ro", - "nrw", - "nt.ro", - "nu", - "nx.cn", - "nyc", - "nz", - "off.ai", - "one", - "onl", - "online", - "ooo", - "or.at", - "or.bi", - "or.id", - "or.ke", - "or.kr", - "or.mu", - "org", - "org.af", - "org.ag", - "org.ai", - "org.al", - "org.am", - "org.au", - "org.az", - "org.bb", - "org.bi", - "org.bm", - "org.bs", - "org.bz", - "org.cn", - "org.cy", - "org.dm", - "org.do", - "org.es", - "org.fj", - "org.ge", - "org.gg", - "org.gi", - "org.gr", - "org.gt", - "org.hk", - "org.hn", - "org.il", - "org.im", - "org.in", - "org.je", - "org.kg", - "org.ki", - "org.lb", - "org.lc", - "org.ls", - "org.ma", - "org.mk", - "org.mm", - "org.ms", - "org.mt", - "org.mu", - "org.mx", - "org.my", - "org.na", - "org.ng", - "org.ni", - "org.nz", - "org.pe", - "org.ph", - "org.pk", - "org.pl", - "org.pn", - "org.pr", - "org.ps", - "org.pt", - "org.ro", - "org.rs", - "org.ru", - "org.rw", - "org.sa", - "org.sb", - "org.sc", - "org.sl", - "org.so", - "org.tw", - "org.ua", - "org.uk", - "org.vc", - "org.vn", - "org.za", - "org.zw", - "organic", - "page", - "paris", - "partners", - "parts", - "party", - "pe", - "pet", - "ph", - "phd", - "photo", - "photography", - "photos", - "pics", - "pictures", - "pink", - "pizza", - "pk", - "pl", - "place", - "plc.uk", - "plumbing", - "plus", - "pm", - "pn", - "poker", - "porn", - "pp.ru", - "pr", - "prd.fr", - "press", - "presse.fr", - "pro", - "pro.ec", - "pro.fj", - "pro.pr", - "pro.vn", - "productions", - "prof", - "promo", - "properties", - "property", - "ps", - "pt", - "pub", - "pub.sa", - "pw", - "qa", - "qh.cn", - "qpon", - "quest", - "racing", - "re", - "rec.ro", - "recipes", - "red", - "rehab", - "reise", - "reisen", - "ren", - "rent", - "rentals", - "repair", - "report", - "republican", - "rest", - "restaurant", - "review", - "reviews", - "rich", - "rip", - "ro", - "rocks", - "rodeo", - "rs", - "rsvp", - "ru", - "ru.com", - "ruhr", - "run", - "rw", - "sa", - "sa.com", - "saarland", - "sale", - "salon", - "sarl", - "sb", - "sbs", - "sc", - "sc.cn", - "school", - "school.nz", - "schule", - "science", - "scot", - "sd.cn", - "se", - "se.net", - "select", - "services", - "sex", - "sexy", - "sg", - "sh", - "sh.cn", - "shiksha", - "shoes", - "shop", - "shopping", - "show", - "si", - "singles", - "site", - "sk", - "ski", - "skin", - "sl", - "sn.cn", - "so", - "soccer", - "social", - "software", - "solar", - "solutions", - "soy", - "spa", - "space", - "sport", - "srl", - "st", - "storage", - "store", - "store.ro", - "stream", - "studio", - "study", - "style", - "su", - "sucks", - "supplies", - "supply", - "support", - "surf", - "surgery", - "sv", - "swiss", - "sx", - "sx.cn", - "systems", - "tattoo", - "tax", - "taxi", - "tc", - "team", - "tech", - "technology", - "tel", - "tel.tr", - "tennis", - "tf", - "theater", - "tickets", - "tienda", - "tips", - "tires", - "tirol", - "tj", - "tj.cn", - "tk", - "tl", - "tm", - "tm.fr", - "tm.ro", - "tm.se", - "to", - "today", - "tokyo", - "tools", - "top", - "tours", - "town", - "toys", - "tr", - "trade", - "trading", - "training", - "travel", - "tt", - "tube", - "tv", - "tv.tr", - "tw", - "tw.cn", - "ua", - "ug", - "uk", - "uk.com", - "uk.net", - "university", - "uno", - "us", - "us.com", - "us.org", - "uy", - "uz", - "vacations", - "vc", - "vegas", - "ventures", - "versicherung", - "vet", - "vg", - "vi", - "viajes", - "video", - "villas", - "vin", - "vip", - "vision", - "vlaanderen", - "vn", - "vodka", - "vote", - "voto", - "voyage", - "vu", - "watch", - "watches", - "waw.pl", - "web.id", - "web.tr", - "web.za", - "webcam", - "website", - "wedding", - "wf", - "wien", - "wiki", - "win", - "wine", - "work", - "works", - "world", - "ws", - "wtf", - "www.ro", - "xj.cn", - "xn--4dbrk0ce", - "xn--80adxhks", - "xn--80ao21a", - "xn--90a3ac", - "xn--90ais", - "xn--czrs0t", - "xn--d1alf", - "xn--e1a4c", - "xn--fiqs8s", - "xn--fjq720a", - "xn--j1amh", - "xn--kpry57d", - "xn--node", - "xn--o1ac.xn--90a3ac", - "xn--p1ai", - "xn--qxa6a", - "xn--qxam", - "xn--unup4y", - "xn--vhquv", - "xn--ygbi2ammx", - "xxx", - "xyz", - "xz.cn", - "yachts", - "yn.cn", - "yoga", - "yokohama", - "yt", - "za.com", - "zip", - "zj.cn", - "zone", - "zuerich" - ]; + return true; } + protected function getSupportedTldList(): array { + return []; + } /** * @throws \Psr\Cache\InvalidArgumentException */