Ariweb Suite 0.1.1 기반: 공통 라이브러리(db·http·세션·작업 엔진·할당/예약·알림·감사·보관소), 포털 뼈대, Webmaker/AriMail 도입 소스와 manifest
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
9ca4cee341
commit
c7aea8d419
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
// ============================================================================
|
||||
// 도메인 구매·관리 자동화 — 등록 업체 공통 창구 (v1.5.36, 요구 4)
|
||||
//
|
||||
// 업체: openprovider(1.4.0 부터) · porkbun · route53(Amazon Route 53 Domains, v1.6.32). 같은 모양의 함수(lib/registrars/<id>.js):
|
||||
// ready() · split(fqdn) · check(fqdns) → [{domain, status:'free'|'active'|'unknown', premium, price:{currency, amount}|null, reason}]
|
||||
// price(fqdn, 'create'|'renew'|'transfer', period) · createCustomer(contact) → handle|null · createDomain(fqdn, {handle, period}) → {id, status, expiresAt}
|
||||
// renewDomain(ref, fqdn, period) · getDomain(ref) → {expiresAt, status} · setNameServers(fqdn, ref, ns[]) · needsContact(등록자 정보 필요 여부)
|
||||
// 어느 업체: 설정 › 도메인 서비스 › 등록 업체(settings.domains.registrar, 기본 openprovider). 도메인 기록에는 구매 때의 업체(registrar)가 남아 갱신·네임서버는 그 업체로 간다.
|
||||
// 보안: 업체 접속 정보는 보관소(관리자)에만 있고, 사용자는 lib/domains.js 를 거쳐 자기 도메인만 다룬다. 가격은 업체 가격 × 요율을 캐시로 차감(변동 시 재확인).
|
||||
// ============================================================================
|
||||
const httpError = (m, s = 400) => Object.assign(new Error(m), { status: s });
|
||||
const PROVIDERS = { openprovider: require('./registrars/openprovider'), porkbun: require('./registrars/porkbun'), route53: require('./registrars/route53') };
|
||||
const IDS = Object.keys(PROVIDERS); const LABELS = { openprovider: 'Openprovider', porkbun: 'Porkbun', route53: 'Amazon Route 53' };
|
||||
function defaultId() { let c = {}; try { c = require('./domains').config(); } catch (_) {} return PROVIDERS[c.registrar] ? c.registrar : 'openprovider'; }
|
||||
function ready(id) { const p = PROVIDERS[id || defaultId()]; try { return !!(p && p.ready()); } catch (_) { return false; } }
|
||||
function get(id) { const p = PROVIDERS[id || defaultId()]; if (!p) throw httpError(`알 수 없는 등록 업체: ${id}`); return p; }
|
||||
/** 준비된 업체 모듈 (아니면 503 안내) */
|
||||
function current(id) { const p = get(id); if (!p.ready()) throw httpError(`도메인 서비스가 아직 준비되지 않았습니다. 관리자에게 문의하세요 (관리자: 외부 연동 접속 정보에 ${LABELS[p.id]} 접속 정보를 넣어야 합니다)`, 503); return p; }
|
||||
function catalog() { const d = defaultId(); return IDS.map((id) => ({ id, label: LABELS[id], ready: ready(id), isDefault: id === d, needsContact: PROVIDERS[id].needsContact !== false })); }
|
||||
module.exports = { PROVIDERS, IDS, LABELS, defaultId, ready, get, current, catalog };
|
||||
Reference in New Issue
Block a user