domain-hound 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +89 -24
- package/clis/domain-check/company-search.mjs +1 -0
- package/clis/domain-check/dossier.mjs +16 -13
- package/clis/domain-check/google-play.mjs +11 -48
- package/clis/domain-check/google-search.mjs +3 -2
- package/clis/domain-check/handles.mjs +235 -106
- package/clis/domain-check/index.mjs +49 -28
- package/clis/domain-check/name-score.mjs +348 -0
- package/clis/domain-check/name-search.mjs +70 -18
- package/clis/domain-check/naming-method.mjs +37 -8
- package/clis/domain-check/price-catalog.mjs +33 -14
- package/clis/domain-check/price-snapshot.json +91 -0
- package/clis/domain-check/prices.mjs +5 -0
- package/clis/domain-check/public-name-checks.mjs +275 -0
- package/clis/domain-check/score-log.mjs +54 -0
- package/clis/domain-check/triage-sources.mjs +4 -1
- package/clis/domain-check/triage.mjs +131 -83
- package/clis/domain-check/youtube-handle.mjs +18 -0
- package/clis/portfolio/checks.mjs +456 -0
- package/clis/portfolio/discover.mjs +175 -0
- package/clis/portfolio/move.mjs +297 -0
- package/clis/portfolio/page.mjs +140 -0
- package/clis/portfolio/portfolio.mjs +212 -0
- package/clis/portfolio/store.mjs +62 -0
- package/clis/portfolio/transfer-prices.mjs +41 -0
- package/clis/spaceship/client.mjs +35 -19
- package/clis/spaceship/tools.mjs +105 -17
- package/clis/spaceship/transfer.mjs +332 -0
- package/display.mjs +62 -61
- package/dossier.mjs +8 -5
- package/hosted-results.mjs +157 -0
- package/hosted.mjs +164 -0
- package/package.json +21 -3
- package/plugin.json +8 -8
- package/results-style.mjs +3 -0
- package/results.mjs +149 -94
- package/server.json +4 -4
- package/server.mjs +216 -28
- package/share.mjs +18 -6
- package/site/r/share-format.mjs +23 -8
- package/skills/naming/SKILL.md +76 -0
- package/watch.mjs +3 -3
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
// move_domain plan: where a domain is registered, what renewal costs there, what moving to the cheaper shop costs, what
|
|
2
|
+
// blocks a move and the exact steps at the current registrar. Public facts only (the same registry facts and dated list
|
|
3
|
+
// prices my_domains uses); nothing is saved to the portfolio list and nothing is bought.
|
|
4
|
+
import { md } from '../../display.mjs';
|
|
5
|
+
import { datedListPrices, isListPriceUsable } from '../domain-check/price-catalog.mjs';
|
|
6
|
+
import { domainEnding } from '../domain-check/name-search.mjs';
|
|
7
|
+
import { shops } from '../domain-check/prices.mjs';
|
|
8
|
+
import { minimumYearlySaving, portfolioRegistry, readRegistry, registrarShop, transferPages } from './checks.mjs';
|
|
9
|
+
import { publishedRenewal, publishedSpaceshipPrice } from './transfer-prices.mjs';
|
|
10
|
+
|
|
11
|
+
const day = 86_400_000;
|
|
12
|
+
export const transferLockDays = 60;
|
|
13
|
+
export const minimumDaysToExpiry = 15;
|
|
14
|
+
// Spaceship is the target when its comparable cost is the cheapest or within this much per year of the cheapest.
|
|
15
|
+
export const preferenceUsdPerYear = 2;
|
|
16
|
+
export const compareYears = 3;
|
|
17
|
+
|
|
18
|
+
const icannPolicy = 'https://www.icann.org/resources/pages/transfer-policy-2024-02-21-en';
|
|
19
|
+
|
|
20
|
+
// Transfer rules per ending, from official pages. yearsAdded is what a completed transfer adds to the registration.
|
|
21
|
+
// lockDays: the registrar may refuse a transfer this soon after registration or an earlier transfer.
|
|
22
|
+
const gtld = { yearsAdded: 1, lockDays: transferLockDays, source: icannPolicy,
|
|
23
|
+
rule: 'ICANN Transfer Policy: the current registrar may refuse a transfer within 60 days of registration or of an earlier transfer.' };
|
|
24
|
+
const endingRules = {
|
|
25
|
+
ai: { yearsAdded: 2, lockDays: null, source: 'https://www.gandi.net/en/domain/tld/ai',
|
|
26
|
+
sources: ['https://www.gandi.net/en/domain/tld/ai', 'https://support.hover.com/support/solutions/articles/201000105559--ai-domain-policies'],
|
|
27
|
+
rule: '.ai: a transfer renews the domain for 2 years. The status must not be transfer prohibited, and the domain should not expire soon. '
|
|
28
|
+
+ 'The pages we read state no 60-day lock for .ai; the current registrar may still have its own.' },
|
|
29
|
+
io: { yearsAdded: 1, lockDays: transferLockDays, source: 'https://www.gandi.net/en/domain/tld/io',
|
|
30
|
+
rule: '.io: the domain must be at least 60 days old and not expire soon; the transfer is confirmed by email and adds one year. '
|
|
31
|
+
+ 'An expired .io is deactivated and can be renewed up to 45 days after expiry.' },
|
|
32
|
+
};
|
|
33
|
+
// Generic top-level domains in the price catalog: ICANN's Transfer Policy applies and each transfer adds one year.
|
|
34
|
+
const gtldEndings = new Set(['com', 'net', 'org', 'app', 'dev', 'xyz', 'tech', 'inc', 'studio', 'info', 'biz']);
|
|
35
|
+
|
|
36
|
+
export function transferRules(domain) {
|
|
37
|
+
const ending = domainEnding(domain);
|
|
38
|
+
if (endingRules[ending]) return { ending, ...endingRules[ending] };
|
|
39
|
+
if (gtldEndings.has(ending)) return { ending, ...gtld };
|
|
40
|
+
return { ending, yearsAdded: null, lockDays: null, source: null,
|
|
41
|
+
rule: '.' + ending + ': Domain Hound has no checked transfer rules for this ending. Check the registry and the new shop before moving.' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Official transfer-out pages, checked 2026-11-25. Steps are what each page says; a page we could not read is named only.
|
|
45
|
+
export const registrarGuides = [
|
|
46
|
+
{ id: 'spaceship', name: 'Spaceship', match: /\bspaceship\b/i, url: 'https://www.spaceship.com/domains/transfer/',
|
|
47
|
+
steps: 'Domain Manager → the domain → Transfer → Transfer domain. Follow the flow to unlock the domain and get its code.' },
|
|
48
|
+
{ id: 'godaddy', name: 'GoDaddy', match: /\bgodaddy\b/i, url: 'https://www.godaddy.com/help/transfer-my-domain-away-from-godaddy-3560',
|
|
49
|
+
steps: 'Domain Portfolio → the domain → Transfer to Another Registrar → Continue with transfer. GoDaddy unlocks it and turns off Domain Privacy as part of this flow. Verify your identity if prompted, then choose Click here to see Authorization Code.' },
|
|
50
|
+
{ id: 'namecheap', name: 'Namecheap', match: /\bnamecheap\b/i,
|
|
51
|
+
url: 'https://www.namecheap.com/support/knowledgebase/article.aspx/258/84/what-should-i-do-to-transfer-a-domain-from-namecheap/',
|
|
52
|
+
steps: 'Domain List → Manage → Sharing & Transfer → Transfer Out: turn off Registrar Lock and ask for the code. Namecheap emails it to the registrant address.' },
|
|
53
|
+
{ id: 'squarespace', name: 'Squarespace', match: /\bsquarespace\b/i,
|
|
54
|
+
url: 'https://support.squarespace.com/hc/en-us/articles/205812338-Transfer-a-domain-away-from-Squarespace',
|
|
55
|
+
steps: 'Domains dashboard → the domain → switch Domain Lock off → Request transfer code. Reauthenticate and check the registrant email for the code.' },
|
|
56
|
+
{ id: 'cloudflare', name: 'Cloudflare', match: /\bcloudflare\b/i,
|
|
57
|
+
url: 'https://developers.cloudflare.com/registrar/account-options/transfer-out-from-cloudflare/',
|
|
58
|
+
steps: 'Manage Domains → Manage → Configuration → Unlock → Confirm and Unlock. Copy the auth code shown in the dashboard.' },
|
|
59
|
+
{ id: 'porkbun', name: 'Porkbun', match: /\bporkbun\b/i, url: 'https://kb.porkbun.com/article/27-how-to-transfer-a-domain-from-porkbun-to-another-registrar',
|
|
60
|
+
steps: 'Domain Management: click the lock icon until it shows unlocked. Details → Get Authorization Code (shown in a popup).' },
|
|
61
|
+
{ id: 'dynadot', name: 'Dynadot', match: /\bdynadot\b/i, url: 'https://www.dynadot.com/help/question/transfer-away',
|
|
62
|
+
steps: 'Manage Domains → the domain → Authorization Code. If locked, choose Unlock Account and then Unlock. Copy the code shown and lock your account again. Any Auction Lock or Buy Lock must have ended.' },
|
|
63
|
+
{ id: 'hover', name: 'Hover', match: /\bhover\b/i,
|
|
64
|
+
url: 'https://support.hover.com/support/solutions/articles/201000064729-transferring-your-domain-away-from-hover',
|
|
65
|
+
steps: 'Control Panel → the domain’s Overview. Turn off Transfer Lock, retrieve the Authorization Code and check that the owner email is reachable.' },
|
|
66
|
+
{ id: 'gandi', name: 'Gandi', match: /\bgandi\b/i, url: 'https://docs.gandi.net/en/domain_names/transfer_out/auth_info.html',
|
|
67
|
+
steps: 'Domain → Transfer Out tab: turn off Transfer Lock, then Copy (or Generate a new code).' },
|
|
68
|
+
{ id: 'ionos', name: 'IONOS', match: /\bionos\b|\b1&1\b/i,
|
|
69
|
+
url: 'https://www.ionos.com/help/domains/transferring-your-domain-away-from-ionos-to-another-provider/transferring-a-domain-from-11-ionos-to-another-provider/',
|
|
70
|
+
steps: 'Turn off the domain transfer lock, then Renewal & Transfer → the domain → Show Authorization Code (it can take a few minutes).' },
|
|
71
|
+
];
|
|
72
|
+
export const registrarGuide = registrar => registrarGuides.find(guide => guide.match.test(String(registrar ?? ''))) ?? null;
|
|
73
|
+
|
|
74
|
+
// Where the new shop takes the transfer. Only Spaceship can be run by Domain Hound; the others are links.
|
|
75
|
+
export const spaceshipTransferPage = transferPages.spaceship;
|
|
76
|
+
|
|
77
|
+
const cents = value => Math.round(value * 100);
|
|
78
|
+
const usd = value => '$' + (value / 100).toFixed(2);
|
|
79
|
+
const ymd = iso => String(iso).slice(0, 10);
|
|
80
|
+
const daysSince = (iso, now) => {
|
|
81
|
+
const at = Date.parse(iso);
|
|
82
|
+
return Number.isFinite(at) ? Math.floor((now.getTime() - at) / day) : null;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Status words that stop a transfer outright, and the one the person can fix at the current registrar.
|
|
86
|
+
const hardStatus = [
|
|
87
|
+
['transfer prohibited', 'the registry reports a transfer prohibition; ask your registrar to check it'],
|
|
88
|
+
['server transfer prohibited', 'the registry locks transfers (server transfer prohibited); only the registry or registrar can lift it'],
|
|
89
|
+
['pending transfer', 'a transfer is already pending'],
|
|
90
|
+
['pending delete', 'pending delete: the registry will release it'],
|
|
91
|
+
['redemption period', 'in redemption: restore it at the current registrar first'],
|
|
92
|
+
['pending restore', 'restore pending at the registry'],
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
// Blockers that stop a move now (hard), and the fixable lock. The same check runs again just before any transfer.
|
|
96
|
+
export function transferBlockers(record, rules, now = new Date()) {
|
|
97
|
+
const blockers = [];
|
|
98
|
+
if (record.state === 'unknown') blockers.push('the registry did not answer, so the lock dates and status are unknown');
|
|
99
|
+
if (record.registered === false) blockers.push('the registry has no record of it');
|
|
100
|
+
for (const [word, text] of hardStatus) if (record.status?.includes(word)) blockers.push(text);
|
|
101
|
+
if (record.daysLeft !== null && record.daysLeft !== undefined) {
|
|
102
|
+
if (record.daysLeft < 0) blockers.push('it expired on ' + ymd(record.expires) + '; renew it at the current registrar first');
|
|
103
|
+
else if (record.daysLeft < minimumDaysToExpiry) {
|
|
104
|
+
blockers.push('it expires in ' + record.daysLeft + (record.daysLeft === 1 ? ' day' : ' days') + ' (' + ymd(record.expires)
|
|
105
|
+
+ '); renew at the current registrar first, a transfer this close to expiry can fail');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (rules.lockDays) {
|
|
109
|
+
const created = daysSince(record.created, now);
|
|
110
|
+
const moved = daysSince(record.transferred, now);
|
|
111
|
+
if (created !== null && created < rules.lockDays) {
|
|
112
|
+
blockers.push('registered ' + ymd(record.created) + ', under ' + rules.lockDays + ' days ago; wait until '
|
|
113
|
+
+ ymd(new Date(Date.parse(record.created) + rules.lockDays * day).toISOString()));
|
|
114
|
+
}
|
|
115
|
+
if (moved !== null && moved < rules.lockDays) {
|
|
116
|
+
blockers.push('transferred ' + ymd(record.transferred) + ', under ' + rules.lockDays + ' days ago; wait until '
|
|
117
|
+
+ ymd(new Date(Date.parse(record.transferred) + rules.lockDays * day).toISOString()));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const locked = record.status?.includes('client transfer prohibited') ?? false;
|
|
121
|
+
return { blockers, locked };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// One comparable three-year cost: the transfer (which adds yearsAdded years) and the remaining years at the shop's renewal
|
|
125
|
+
// price per year. Years beyond a whole renewal term are counted pro rata (annualized), so .ai's 2-year terms compare fairly.
|
|
126
|
+
export function threeYearCost({ transfer, transferYears, renewalPerYear }) {
|
|
127
|
+
if (!Number.isFinite(transfer) || !Number.isFinite(renewalPerYear) || !(transferYears > 0)) return null;
|
|
128
|
+
return transfer + Math.max(0, compareYears - transferYears) * renewalPerYear;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// The list-price options for one ending. Catalog prices are per year. A transfer price is used only where the term is
|
|
132
|
+
// known: endings whose transfer adds one year, and Spaceship's pricing page, whose transfer cell is per year.
|
|
133
|
+
function listOptions(tld, catalog, now) {
|
|
134
|
+
const byShop = new Map();
|
|
135
|
+
for (const row of [...datedListPrices(catalog, tld, now), ...datedListPrices(null, tld, now)]) {
|
|
136
|
+
if (!Number.isFinite(row.renewal) || Date.parse(row.checkedAt) > now.getTime()) continue;
|
|
137
|
+
if (!byShop.has(row.id) || row.checkedAt > byShop.get(row.id).checkedAt) byShop.set(row.id, row);
|
|
138
|
+
}
|
|
139
|
+
const spaceship = publishedSpaceshipPrice(tld, now);
|
|
140
|
+
if (spaceship && !byShop.has('spaceship')) byShop.set('spaceship', spaceship);
|
|
141
|
+
return byShop;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const listSource = id => ({
|
|
145
|
+
spaceship: 'https://www.spaceship.com/domain-search/pricing/',
|
|
146
|
+
dynadot: 'https://www.dynadot.com/domain/prices?currency=USD',
|
|
147
|
+
porkbun: 'https://porkbun.com/products/domains',
|
|
148
|
+
gandi: 'https://www.gandi.net/en/domain/tld/',
|
|
149
|
+
})[id] ?? null;
|
|
150
|
+
|
|
151
|
+
function targetOption(id, row, rules, live) {
|
|
152
|
+
if (id === 'spaceship' && live) {
|
|
153
|
+
const transferYears = live.years;
|
|
154
|
+
const renewalPerYear = live.renewal.amount / live.renewal.years / 100;
|
|
155
|
+
return { id, shop: 'Spaceship', basis: 'live', transfer: live.amount / 100, transferYears, renewalPerYear,
|
|
156
|
+
regularTransfer: live.regular / 100, promo: live.promo, url: spaceshipTransferPage,
|
|
157
|
+
threeYear: threeYearCost({ transfer: live.amount / 100, transferYears, renewalPerYear }) };
|
|
158
|
+
}
|
|
159
|
+
if (!row) return null;
|
|
160
|
+
const years = rules.yearsAdded;
|
|
161
|
+
let transfer = null;
|
|
162
|
+
let note = null;
|
|
163
|
+
if (Number.isFinite(row.transfer) && years === 1) transfer = row.transfer;
|
|
164
|
+
else if (Number.isFinite(row.transfer) && years > 1 && id === 'spaceship') {
|
|
165
|
+
transfer = Math.round(row.transfer * years * 100) / 100;
|
|
166
|
+
note = 'list $' + row.transfer.toFixed(2) + '/yr × ' + years + ' years';
|
|
167
|
+
} else if (Number.isFinite(row.transfer) && rules.ending === 'ai' && id === 'dynadot') {
|
|
168
|
+
// Dynadot's table lists the full fee and its .ai page confirms the two-year extension.
|
|
169
|
+
transfer = row.transfer;
|
|
170
|
+
}
|
|
171
|
+
const option = { id, shop: shops[id]?.name ?? id, basis: row.bundled ? 'snapshot' : 'list', checkedAt: row.checkedAt,
|
|
172
|
+
transfer, transferYears: years, renewalPerYear: row.renewal, url: transferPages[id], source: row.source ?? listSource(id), ...(note && { note }) };
|
|
173
|
+
option.threeYear = threeYearCost(option);
|
|
174
|
+
if (option.threeYear === null) option.unavailable = years > 1 ? 'its list does not state the ' + years + '-year transfer price'
|
|
175
|
+
: !years ? 'the transfer term for this ending is unknown' : 'no transfer price listed';
|
|
176
|
+
return option;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// The plan from registry facts and prices. live is an optional live Spaceship transfer offer (see spaceship/transfer.mjs).
|
|
180
|
+
export function planFromFacts(domain, record, catalog, now = new Date(), live = null) {
|
|
181
|
+
const rules = transferRules(domain);
|
|
182
|
+
const guide = registrarGuide(record.registrar);
|
|
183
|
+
const currentId = registrarShop(record.registrar);
|
|
184
|
+
const rows = listOptions(rules.ending, catalog, now);
|
|
185
|
+
const currentRow = currentId ? rows.get(currentId) : null;
|
|
186
|
+
const published = publishedRenewal(guide?.id ?? currentId, rules.ending, now);
|
|
187
|
+
const current = { registrar: record.registrar, shop: currentId ? shops[currentId]?.name ?? null : guide?.name ?? null,
|
|
188
|
+
renewalPerYear: currentRow?.renewal ?? null, basis: currentRow ? currentRow.bundled ? 'snapshot' : 'list' : null,
|
|
189
|
+
checkedAt: currentRow?.checkedAt ?? null, source: currentRow ? listSource(currentId) : null,
|
|
190
|
+
...(!currentRow && published) };
|
|
191
|
+
const atSpaceship = currentId === 'spaceship' || guide?.id === 'spaceship';
|
|
192
|
+
const options = Object.keys(transferPages).filter(id => id !== currentId)
|
|
193
|
+
.map(id => targetOption(id, rows.get(id), rules, id === 'spaceship' ? live : null)).filter(Boolean);
|
|
194
|
+
const comparable = options.filter(option => option.threeYear !== null);
|
|
195
|
+
const cheapest = comparable.reduce((best, option) => !best || option.threeYear < best.threeYear ? option : best, null);
|
|
196
|
+
const spaceship = comparable.find(option => option.id === 'spaceship');
|
|
197
|
+
const target = spaceship && cheapest && spaceship.threeYear <= cheapest.threeYear + preferenceUsdPerYear * compareYears
|
|
198
|
+
? spaceship : cheapest;
|
|
199
|
+
const stay = current.renewalPerYear !== null ? current.renewalPerYear * compareYears : null;
|
|
200
|
+
const saving = stay !== null && target ? cents(stay - target.threeYear) / 100 : null;
|
|
201
|
+
const { blockers, locked } = record.state === 'problem' && !record.registrar
|
|
202
|
+
? { blockers: [record.reason ?? 'the registry has no record'], locked: false } : transferBlockers(record, rules, now);
|
|
203
|
+
const cautions = [];
|
|
204
|
+
if (record.autoRenewGrace) {
|
|
205
|
+
cautions.push('The registry shows auto-renew grace (a renewal just happened). Ask ' + (current.shop ?? 'the current registrar')
|
|
206
|
+
+ ' whether a transfer now refunds or keeps that renewal before you move.');
|
|
207
|
+
}
|
|
208
|
+
if (rules.yearsAdded === null) cautions.push(rules.rule);
|
|
209
|
+
if ([current, target].some(price => price?.checkedAt && !isListPriceUsable(price.checkedAt, now))) {
|
|
210
|
+
cautions.push('Some prices are from an older list. Check today’s prices before deciding.');
|
|
211
|
+
} else if (current.renewalPerYear !== null) {
|
|
212
|
+
cautions.push('Your own renewal bill may differ from the published standard price.');
|
|
213
|
+
}
|
|
214
|
+
if (target?.promo) cautions.push('Spaceship’s transfer price is a promotion; the regular price is ' + usd(cents(target.regularTransfer)) + '.');
|
|
215
|
+
let verdict;
|
|
216
|
+
if (atSpaceship && (saving === null || saving <= 0)) verdict = 'already-at-spaceship';
|
|
217
|
+
else if (blockers.length) verdict = 'blocked';
|
|
218
|
+
else if (!target) verdict = 'no-price';
|
|
219
|
+
else if (saving === null) verdict = 'renewal-unknown';
|
|
220
|
+
else verdict = saving / compareYears > minimumYearlySaving ? 'worth-moving' : 'small-saving';
|
|
221
|
+
return { domain, checkedAt: now.toISOString(), rules, guide: guide && { name: guide.name, url: guide.url ?? null, steps: guide.steps ?? null },
|
|
222
|
+
registry: { registered: record.registered ?? null, registrar: record.registrar,
|
|
223
|
+
created: record.created, transferred: record.transferred ?? null, expires: record.expires,
|
|
224
|
+
daysLeft: record.daysLeft, status: record.status, source: record.source },
|
|
225
|
+
current, options, target: target ?? null, stayThreeYear: stay, saving, blockers, locked, cautions, verdict };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const money = value => '$' + value.toFixed(2);
|
|
229
|
+
const basisText = option => option.basis === 'live' ? 'live Spaceship quote' : (option.basis === 'snapshot' ? 'snapshot' : 'list')
|
|
230
|
+
+ ' price ' + ymd(option.checkedAt);
|
|
231
|
+
|
|
232
|
+
// The steps at the current registrar, then at the new shop.
|
|
233
|
+
export function moveSteps(plan) {
|
|
234
|
+
const at = plan.current.shop ?? plan.registry.registrar ?? 'your current registrar';
|
|
235
|
+
const guide = plan.guide;
|
|
236
|
+
const steps = [];
|
|
237
|
+
const lock = plan.locked ? 'Unlock the domain at ' + at + ' (the registry shows a transfer lock). '
|
|
238
|
+
: plan.registry.status?.length ? 'The registry shows no transfer lock. ' : 'Check the transfer lock in your registrar account. ';
|
|
239
|
+
steps.push(lock
|
|
240
|
+
+ 'Get the authorization (EPP) code' + (guide?.steps ? ': ' + guide.steps : ' from ' + at + '.')
|
|
241
|
+
+ (guide?.url ? ' [' + at + ' guide](' + guide.url + ')' : ' [ICANN transfer rules](' + icannPolicy + ')'));
|
|
242
|
+
steps.push('Keep WHOIS privacy on unless a registrar requires it off for transfer. Make sure the owner email at ' + at
|
|
243
|
+
+ ' is reachable: some transfers ask for approval there.');
|
|
244
|
+
if (plan.target?.id === 'spaceship') {
|
|
245
|
+
steps.push('Start the transfer at Spaceship and enter the code there yourself: [Spaceship transfer](' + spaceshipTransferPage + '). '
|
|
246
|
+
+ 'Or ask Domain Hound for the transfer with your limits (move_domain with quote_id and max_usd).');
|
|
247
|
+
} else if (plan.target) {
|
|
248
|
+
steps.push('Start the transfer at ' + plan.target.shop + ' and enter the code there yourself: [' + plan.target.shop + ' transfer]('
|
|
249
|
+
+ plan.target.url + ').');
|
|
250
|
+
}
|
|
251
|
+
steps.push('Check that your current DNS provider will keep serving the domain after the move. If your current registrar hosts DNS, copy its records and arrange continued DNS service before transferring. Verify DNS and the new expiry afterwards.');
|
|
252
|
+
return steps;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// The answer, at most about ten lines.
|
|
256
|
+
export function planLines(plan) {
|
|
257
|
+
const { domain, registry, current, target } = plan;
|
|
258
|
+
if (registry.registered === false) return [md(domain) + ': the registry has no record of it, so there is nothing to move.'];
|
|
259
|
+
const lines = [];
|
|
260
|
+
const where = registry.registrar ? md(registry.registrar) : 'an unknown registrar';
|
|
261
|
+
lines.push(md(domain) + ': registered at ' + where + (registry.expires ? ', expires ' + ymd(registry.expires) : '') + '.'
|
|
262
|
+
+ (registry.transferred ? ' Last transfer ' + ymd(registry.transferred) + ' (registry).' : ''));
|
|
263
|
+
if (plan.verdict === 'already-at-spaceship') {
|
|
264
|
+
lines.push('Already at Spaceship. The prices below show no cheaper move.');
|
|
265
|
+
}
|
|
266
|
+
lines.push('Renewal at ' + md(current.shop ?? current.registrar ?? 'the current registrar') + ': '
|
|
267
|
+
+ (current.renewalPerYear !== null ? money(current.renewalPerYear) + '/yr (' + basisText(current) + ')'
|
|
268
|
+
: 'unavailable (no reliable list price; check your last renewal invoice)') + '.');
|
|
269
|
+
if (current.source) lines[lines.length - 1] += ' [Pricing](' + current.source + ')';
|
|
270
|
+
for (const option of plan.options) {
|
|
271
|
+
lines.push(option.shop + ': ' + (option.threeYear === null ? 'transfer price unavailable (' + option.unavailable + ')'
|
|
272
|
+
: 'transfer ' + money(option.transfer) + ' adds ' + option.transferYears + (option.transferYears === 1 ? ' year' : ' years')
|
|
273
|
+
+ (option.note ? ' (' + option.note + ')' : '') + ', renews ' + money(option.renewalPerYear) + '/yr; ' + compareYears
|
|
274
|
+
+ ' years ' + money(option.threeYear) + ' (' + basisText(option) + ')') + '.');
|
|
275
|
+
}
|
|
276
|
+
if (target && plan.saving !== null) {
|
|
277
|
+
const comparison = plan.saving >= 0 ? ' saves ' + money(plan.saving) : ' costs ' + money(-plan.saving) + ' more';
|
|
278
|
+
lines.push('Moving to ' + target.shop + comparison + ' over ' + compareYears + ' years (annualized), against '
|
|
279
|
+
+ money(plan.stayThreeYear) + ' staying.');
|
|
280
|
+
} else if (target) {
|
|
281
|
+
lines.push('Suggested transfer shop: ' + target.shop + '. Check your current renewal bill to calculate the saving.');
|
|
282
|
+
}
|
|
283
|
+
if (plan.blockers.length) lines.push('Blocked now: ' + plan.blockers.map(md).join('; ') + '.');
|
|
284
|
+
lines.push(...plan.cautions.map(md));
|
|
285
|
+
lines.push('Rules: ' + plan.rules.rule + (plan.rules.source ? ' [source](' + plan.rules.source + ')' : ''));
|
|
286
|
+
if (!plan.blockers.length && target && plan.verdict !== 'already-at-spaceship') {
|
|
287
|
+
moveSteps(plan).forEach((step, index) => lines.push((index + 1) + '. ' + step));
|
|
288
|
+
}
|
|
289
|
+
else if (plan.guide?.url) lines.push('[' + plan.guide.name + ' transfer instructions](' + plan.guide.url + ')');
|
|
290
|
+
return lines;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Registry record shared by the public plan and the paid path.
|
|
294
|
+
export async function transferRegistryRecord(domain, { facts = portfolioRegistry, now = new Date() } = {}) {
|
|
295
|
+
const answer = await facts(domain, { deadline: performance.now() + 6000 }).catch(() => null);
|
|
296
|
+
return { ...readRegistry(answer, now), registered: answer?.registered === 'taken' ? true : answer?.registered === 'free' ? false : null };
|
|
297
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// The local results page for my_domains, in the same receipt style as the name results: one row per domain,
|
|
2
|
+
// most urgent first. One fixed file pair (portfolio.html and portfolio.md) is rewritten on each check.
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { mkdir, rename, unlink, writeFile } from 'node:fs/promises';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { join, resolve } from 'node:path';
|
|
8
|
+
import { pathToFileURL } from 'node:url';
|
|
9
|
+
import { backgroundCommand } from '../../results.mjs';
|
|
10
|
+
import { receiptStyle } from '../../results-style.mjs';
|
|
11
|
+
|
|
12
|
+
const escape = value => String(value ?? '').replace(/[&<>"']/g, char =>
|
|
13
|
+
({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char]);
|
|
14
|
+
const plain = value => String(value ?? '').replace(/[\r\n\p{Cc}\p{Cf}]+/gu, ' ').trim();
|
|
15
|
+
const markdown = value => plain(value).replace(/[\\|<>\[\]`*_]/g, '\\$&');
|
|
16
|
+
const anchor = (label, url) => '<a href="' + escape(url) + '">' + escape(label) + '</a>';
|
|
17
|
+
const cash = value => Number.isFinite(value) ? '$' + value.toFixed(2) : 'No price';
|
|
18
|
+
const day = value => typeof value === 'string' ? value.slice(0, 10) : null;
|
|
19
|
+
const https = value => typeof value === 'string' && /^https:\/\/[^\s<>"]+$/.test(value) ? value : null;
|
|
20
|
+
|
|
21
|
+
// Inline [label](https://...) links from the say lines become anchors; everything else is escaped text.
|
|
22
|
+
function paragraph(line) {
|
|
23
|
+
let html = '';
|
|
24
|
+
let offset = 0;
|
|
25
|
+
for (const match of line.matchAll(/\[([^\]]+)\]\((https:\/\/[^\s)]+)\)/g)) {
|
|
26
|
+
html += escape(line.slice(offset, match.index).replace(/\\(.)/g, '$1')) + anchor(match[1], match[2]);
|
|
27
|
+
offset = match.index + match[0].length;
|
|
28
|
+
}
|
|
29
|
+
return '<p>' + html + escape(line.slice(offset).replace(/\\(.)/g, '$1')) + '</p>';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const checkText = (label, check, ok) => {
|
|
33
|
+
if (!check) return null;
|
|
34
|
+
if (check.state === 'ok') return label + ': ' + ok(check);
|
|
35
|
+
if (check.state === 'none') return label + ': ' + (check.reason ?? 'none');
|
|
36
|
+
if (check.state === 'unknown') return label + ': unknown (' + (check.reason ?? 'no answer') + ')';
|
|
37
|
+
return label + ': ' + (check.reason ?? 'problem');
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// The facts under one domain, in reading order. Unknown checks say so; they are never shown as failures.
|
|
41
|
+
export function rowFacts(row) {
|
|
42
|
+
const r = row.registry;
|
|
43
|
+
const registry = r.state === 'unknown' ? 'Registry: unknown (' + (r.reason ?? 'no answer') + ')'
|
|
44
|
+
: r.state === 'problem' && !r.expires ? 'Registry: ' + (r.reason ?? r.problems?.join('; ') ?? 'problem')
|
|
45
|
+
: ['Registrar: ' + (r.registrar ?? 'not shown'), r.created && 'created ' + day(r.created),
|
|
46
|
+
r.problems?.length ? r.problems.join('; ') : null,
|
|
47
|
+
r.autoRenewGrace ? 'registry shows auto-renew grace' : null].filter(Boolean).join(' · ');
|
|
48
|
+
const site = row.site.httpStatus
|
|
49
|
+
? 'Site: HTTP ' + row.site.httpStatus + (row.site.redirect ? ', redirects to ' + row.site.redirect : '')
|
|
50
|
+
+ (row.site.note ? ' (' + row.site.note + ')' : '')
|
|
51
|
+
: checkText('Site', row.site, () => 'up');
|
|
52
|
+
const tls = checkText('Certificate', row.tls, check => check.expires
|
|
53
|
+
? 'valid until ' + day(check.expires) + (check.issuer ? ' (' + check.issuer + ')' : '') : 'expiry not available');
|
|
54
|
+
const email = row.email?.mx === 'unknown' || row.email?.state === 'unknown' ? checkText('Email', row.email)
|
|
55
|
+
: 'Email: ' + (row.email.mx === true ? 'MX yes' : row.email.mx === 'null' ? 'declares no mail' : 'no MX')
|
|
56
|
+
+ ' · SPF ' + (row.email.spf === 'unknown' ? 'unknown' : row.email.spf ? 'yes' : 'no')
|
|
57
|
+
+ ' · DMARC ' + (row.email.dmarc === 'unknown' ? 'unknown' : row.email.dmarc ? 'yes' : 'no');
|
|
58
|
+
const m = row.money;
|
|
59
|
+
const dated = price => cash(price.renewal) + '/yr at ' + price.shop + ', ' + (price.estimate ? 'snapshot ' : 'list ') + day(price.checkedAt);
|
|
60
|
+
const money = [m.current ? 'Renewal ' + dated(m.current) : m.currentShop ? 'Renewal at ' + m.currentShop + ': no list price'
|
|
61
|
+
: 'Renewal at this registrar: not in our price list',
|
|
62
|
+
m.cheapest && m.cheapest.shop !== m.current?.shop ? 'lowest listed renewal ' + dated(m.cheapest) : null].filter(Boolean).join(' · ');
|
|
63
|
+
const nameservers = row.nameservers ?? r.nameservers;
|
|
64
|
+
return [registry, r.status?.length && 'Registry status: ' + r.status.join(', '),
|
|
65
|
+
'DNS: ' + (row.dnsHost ?? 'name servers unknown'),
|
|
66
|
+
nameservers?.length && 'Name servers: ' + nameservers.join(', '), site, tls, email, money,
|
|
67
|
+
m.move && 'Move to ' + m.move.to + ' to save ' + cash(m.move.saving) + ' over 3 years at list prices'].filter(Boolean);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function renderPage(rows, lines, checkedAt, note) {
|
|
71
|
+
const expiry = row => row.registry.expires
|
|
72
|
+
? day(row.registry.expires) + (row.registry.daysLeft !== null ? ' (' + row.registry.daysLeft + ' d)' : '') : 'Unknown';
|
|
73
|
+
const renewal = row => row.money.current ? cash(row.money.current.renewal) : 'No price';
|
|
74
|
+
const body = rows.map(row => {
|
|
75
|
+
const facts = rowFacts(row);
|
|
76
|
+
const current = row.money.current;
|
|
77
|
+
const lowest = row.money.cheapest;
|
|
78
|
+
const links = [https(row.registry.source?.url) ? anchor('Registry source', row.registry.source.url) : null,
|
|
79
|
+
https(current?.source) ? anchor(current.shop + ' prices', current.source) : null,
|
|
80
|
+
lowest?.source !== current?.source && https(lowest?.source) ? anchor(lowest.shop + ' prices', lowest.source) : null,
|
|
81
|
+
row.money.move && https(row.money.move.url) ? anchor('Transfer to ' + row.money.move.to, row.money.move.url) : null].filter(Boolean);
|
|
82
|
+
const date = day(row.registry.expires);
|
|
83
|
+
const deadline = date ? '<time datetime="' + escape(row.registry.expires) + '">' + escape(date) + '</time>'
|
|
84
|
+
+ (row.registry.daysLeft !== null ? '<br>' + escape(String(row.registry.daysLeft) + ' d') : '') : 'Unknown';
|
|
85
|
+
return '<tr><th scope="row"><code>' + escape(row.domain) + '</code><small>' + escape(row.registry.registrar ?? 'Registrar unknown')
|
|
86
|
+
+ '</small><details><summary>Details</summary><small>' + facts.map(escape).join('<br>')
|
|
87
|
+
+ (links.length ? '<br>' + links.join(' · ') : '') + '</small></details></th><td>' + deadline + '</td><td>'
|
|
88
|
+
+ escape(renewal(row)) + '</td></tr>';
|
|
89
|
+
});
|
|
90
|
+
const html = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'
|
|
91
|
+
+ '<meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="default-src \'none\'; style-src \'unsafe-inline\'; base-uri \'none\'; form-action \'none\'">'
|
|
92
|
+
+ '<title>Your domains | Domain Hound</title><style>' + receiptStyle
|
|
93
|
+
+ 'tbody details{border:0} tbody summary{padding:.2rem 0;font-size:.9rem} td time{font-size:.8rem;white-space:nowrap}'
|
|
94
|
+
+ '</style></head><body><main>'
|
|
95
|
+
+ '<header><small>Domain Hound</small><h1>Your domains</h1><time datetime="' + escape(checkedAt) + '">'
|
|
96
|
+
+ escape(checkedAt.slice(0, 16).replace('T', ' ') + ' UTC') + '</time></header><section>'
|
|
97
|
+
+ lines.map(paragraph).join('') + '</section><article><table><caption>Most urgent first · USD list prices before tax</caption>'
|
|
98
|
+
+ '<thead><tr><th scope="col">Domain</th><th scope="col">Expires</th><th scope="col">Renewal</th></tr></thead><tbody>'
|
|
99
|
+
+ body.join('') + '</tbody></table></article><footer>' + paragraph(note) + '</footer></main></body></html>\n';
|
|
100
|
+
const md = ['# Your domains', '', 'Domain Hound · ' + checkedAt, '', ...lines, '',
|
|
101
|
+
'| Domain | Expires | Renewal (USD) | Facts |', '| --- | --- | --- | --- |',
|
|
102
|
+
...rows.map(row => '| ' + [markdown(row.domain), markdown(expiry(row)), markdown(renewal(row)),
|
|
103
|
+
rowFacts(row).map(markdown).join('<br>')].join(' | ') + ' |'),
|
|
104
|
+
'', markdown(note), ''].join('\n');
|
|
105
|
+
return { html, md };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function writePrivate(filename, content) {
|
|
109
|
+
const temporary = filename + '.' + randomUUID() + '.tmp';
|
|
110
|
+
try {
|
|
111
|
+
await writeFile(temporary, content, { flag: 'wx', mode: 0o600 });
|
|
112
|
+
await rename(temporary, filename);
|
|
113
|
+
} finally {
|
|
114
|
+
await unlink(temporary).catch(() => {});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// A page writer for one server process. It opens the page in the background the first time only.
|
|
119
|
+
export function portfolioPages({ env = process.env,
|
|
120
|
+
directory = env.DOMAIN_HOUND_RESULTS_DIR || join(homedir(), '.domain-hound', 'results') } = {}) {
|
|
121
|
+
let opened = false;
|
|
122
|
+
return async (rows, lines, checkedAt, note) => {
|
|
123
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
124
|
+
const page = renderPage(rows, lines, checkedAt, note);
|
|
125
|
+
const filename = resolve(directory, 'portfolio.html');
|
|
126
|
+
await writePrivate(resolve(directory, 'portfolio.md'), page.md);
|
|
127
|
+
await writePrivate(filename, page.html);
|
|
128
|
+
if (!opened) {
|
|
129
|
+
opened = true;
|
|
130
|
+
await backgroundCommand(filename, env).then(command => {
|
|
131
|
+
if (!command) return;
|
|
132
|
+
const [executable, args, launchEnv] = command;
|
|
133
|
+
const browser = spawn(executable, args, { stdio: 'ignore', windowsHide: true, env: launchEnv });
|
|
134
|
+
browser.on('error', () => {});
|
|
135
|
+
browser.unref();
|
|
136
|
+
}).catch(() => {});
|
|
137
|
+
}
|
|
138
|
+
return pathToFileURL(filename).href.replaceAll('(', '%28').replaceAll(')', '%29');
|
|
139
|
+
};
|
|
140
|
+
}
|