@inblog/cli 0.2.0 → 0.2.2
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/dist/bin/inblog.js +233 -38
- package/dist/bin/inblog.js.map +1 -1
- package/dist/sdk/index.d.mts +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +3 -3
- package/dist/sdk/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bin/inblog.js
CHANGED
|
@@ -242,8 +242,8 @@ var InblogClient = class {
|
|
|
242
242
|
if (this.accessToken) return this.accessToken;
|
|
243
243
|
throw new Error("No valid authentication token available");
|
|
244
244
|
}
|
|
245
|
-
buildUrl(
|
|
246
|
-
const url = new URL(`/api${
|
|
245
|
+
buildUrl(path4, params) {
|
|
246
|
+
const url = new URL(`/api${path4}`, this.baseUrl);
|
|
247
247
|
if (params) {
|
|
248
248
|
for (const [key, value] of Object.entries(params)) {
|
|
249
249
|
if (value === void 0 || value === null) continue;
|
|
@@ -282,8 +282,8 @@ var InblogClient = class {
|
|
|
282
282
|
}
|
|
283
283
|
return body;
|
|
284
284
|
}
|
|
285
|
-
async get(
|
|
286
|
-
const url = this.buildUrl(
|
|
285
|
+
async get(path4, params) {
|
|
286
|
+
const url = this.buildUrl(path4, params);
|
|
287
287
|
const response = await fetch(url, { method: "GET", headers: await this.readHeaders() });
|
|
288
288
|
const json = await this.handleResponse(response);
|
|
289
289
|
return {
|
|
@@ -291,8 +291,8 @@ var InblogClient = class {
|
|
|
291
291
|
meta: extractMeta(json)
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
async list(
|
|
295
|
-
const url = this.buildUrl(
|
|
294
|
+
async list(path4, params) {
|
|
295
|
+
const url = this.buildUrl(path4, params);
|
|
296
296
|
const response = await fetch(url, { method: "GET", headers: await this.readHeaders() });
|
|
297
297
|
const json = await this.handleResponse(response);
|
|
298
298
|
return {
|
|
@@ -300,8 +300,8 @@ var InblogClient = class {
|
|
|
300
300
|
meta: extractMeta(json)
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
async create(
|
|
304
|
-
const url = this.buildUrl(
|
|
303
|
+
async create(path4, type, attributes, params) {
|
|
304
|
+
const url = this.buildUrl(path4, params);
|
|
305
305
|
const body = serialize(type, attributes);
|
|
306
306
|
const response = await fetch(url, {
|
|
307
307
|
method: "POST",
|
|
@@ -314,8 +314,8 @@ var InblogClient = class {
|
|
|
314
314
|
meta: extractMeta(json)
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
async update(
|
|
318
|
-
const url = this.buildUrl(
|
|
317
|
+
async update(path4, type, id, attributes) {
|
|
318
|
+
const url = this.buildUrl(path4);
|
|
319
319
|
const body = serialize(type, attributes, id);
|
|
320
320
|
const response = await fetch(url, {
|
|
321
321
|
method: "PATCH",
|
|
@@ -328,15 +328,15 @@ var InblogClient = class {
|
|
|
328
328
|
meta: extractMeta(json)
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
async delete(
|
|
332
|
-
const url = this.buildUrl(
|
|
331
|
+
async delete(path4) {
|
|
332
|
+
const url = this.buildUrl(path4);
|
|
333
333
|
const response = await fetch(url, { method: "DELETE", headers: await this.readHeaders() });
|
|
334
334
|
if (!response.ok) {
|
|
335
335
|
await this.handleResponse(response);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
async post(
|
|
339
|
-
const url = this.buildUrl(
|
|
338
|
+
async post(path4, body) {
|
|
339
|
+
const url = this.buildUrl(path4);
|
|
340
340
|
const response = await fetch(url, {
|
|
341
341
|
method: "POST",
|
|
342
342
|
headers: await this.writeHeaders(),
|
|
@@ -348,8 +348,8 @@ var InblogClient = class {
|
|
|
348
348
|
meta: extractMeta(json)
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
async patch(
|
|
352
|
-
const url = this.buildUrl(
|
|
351
|
+
async patch(path4, body) {
|
|
352
|
+
const url = this.buildUrl(path4);
|
|
353
353
|
const response = await fetch(url, {
|
|
354
354
|
method: "PATCH",
|
|
355
355
|
headers: await this.writeHeaders(),
|
|
@@ -364,16 +364,16 @@ var InblogClient = class {
|
|
|
364
364
|
/**
|
|
365
365
|
* Raw GET — for non-JSON:API endpoints that return plain JSON.
|
|
366
366
|
*/
|
|
367
|
-
async rawGet(
|
|
368
|
-
const url = this.buildUrl(
|
|
367
|
+
async rawGet(path4, params) {
|
|
368
|
+
const url = this.buildUrl(path4, params);
|
|
369
369
|
const response = await fetch(url, { method: "GET", headers: await this.readHeaders() });
|
|
370
370
|
return this.handleRawResponse(response);
|
|
371
371
|
}
|
|
372
372
|
/**
|
|
373
373
|
* Raw POST — for non-JSON:API endpoints.
|
|
374
374
|
*/
|
|
375
|
-
async rawPost(
|
|
376
|
-
const url = this.buildUrl(
|
|
375
|
+
async rawPost(path4, body) {
|
|
376
|
+
const url = this.buildUrl(path4);
|
|
377
377
|
const headers = await this.readHeaders();
|
|
378
378
|
headers["Content-Type"] = "application/json";
|
|
379
379
|
const response = await fetch(url, {
|
|
@@ -386,8 +386,8 @@ var InblogClient = class {
|
|
|
386
386
|
/**
|
|
387
387
|
* Raw PATCH — for non-JSON:API endpoints.
|
|
388
388
|
*/
|
|
389
|
-
async rawPatch(
|
|
390
|
-
const url = this.buildUrl(
|
|
389
|
+
async rawPatch(path4, body) {
|
|
390
|
+
const url = this.buildUrl(path4);
|
|
391
391
|
const headers = await this.readHeaders();
|
|
392
392
|
headers["Content-Type"] = "application/json";
|
|
393
393
|
const response = await fetch(url, {
|
|
@@ -400,8 +400,8 @@ var InblogClient = class {
|
|
|
400
400
|
/**
|
|
401
401
|
* Raw DELETE — for non-JSON:API endpoints.
|
|
402
402
|
*/
|
|
403
|
-
async rawDelete(
|
|
404
|
-
const url = this.buildUrl(
|
|
403
|
+
async rawDelete(path4) {
|
|
404
|
+
const url = this.buildUrl(path4);
|
|
405
405
|
const response = await fetch(url, { method: "DELETE", headers: await this.readHeaders() });
|
|
406
406
|
if (response.status === 204) return { success: true };
|
|
407
407
|
return this.handleRawResponse(response);
|
|
@@ -712,11 +712,11 @@ var BlogsEndpoint = class {
|
|
|
712
712
|
async me() {
|
|
713
713
|
return this.client.get("/v1/blogs/me");
|
|
714
714
|
}
|
|
715
|
-
async update(
|
|
715
|
+
async update(input) {
|
|
716
716
|
return this.client.update(
|
|
717
|
-
|
|
717
|
+
"/v1/blogs/me",
|
|
718
718
|
"blogs",
|
|
719
|
-
|
|
719
|
+
"me",
|
|
720
720
|
input
|
|
721
721
|
);
|
|
722
722
|
}
|
|
@@ -1556,6 +1556,171 @@ function registerAuthorsCommands(program2) {
|
|
|
1556
1556
|
|
|
1557
1557
|
// src/commands/blogs.ts
|
|
1558
1558
|
var import_prompts2 = require("@inquirer/prompts");
|
|
1559
|
+
|
|
1560
|
+
// src/utils/domain.ts
|
|
1561
|
+
var import_promises = __toESM(require("dns/promises"));
|
|
1562
|
+
var MULTI_PART_TLDS = [
|
|
1563
|
+
".co.uk",
|
|
1564
|
+
".co.kr",
|
|
1565
|
+
".co.jp",
|
|
1566
|
+
".co.nz",
|
|
1567
|
+
".co.za",
|
|
1568
|
+
".co.in",
|
|
1569
|
+
".co.id",
|
|
1570
|
+
".com.au",
|
|
1571
|
+
".com.br",
|
|
1572
|
+
".com.cn",
|
|
1573
|
+
".com.mx",
|
|
1574
|
+
".com.tw",
|
|
1575
|
+
".com.sg",
|
|
1576
|
+
".net.au",
|
|
1577
|
+
".net.br",
|
|
1578
|
+
".net.cn",
|
|
1579
|
+
".org.uk",
|
|
1580
|
+
".org.au",
|
|
1581
|
+
".org.br",
|
|
1582
|
+
".ac.uk",
|
|
1583
|
+
".ac.kr",
|
|
1584
|
+
".ac.jp",
|
|
1585
|
+
".ne.jp",
|
|
1586
|
+
".or.jp",
|
|
1587
|
+
".or.kr",
|
|
1588
|
+
".gov.uk",
|
|
1589
|
+
".gov.au",
|
|
1590
|
+
".gov.br",
|
|
1591
|
+
".edu.au",
|
|
1592
|
+
".edu.cn"
|
|
1593
|
+
];
|
|
1594
|
+
function getRootDomain(domain) {
|
|
1595
|
+
const lower = domain.toLowerCase();
|
|
1596
|
+
const multiTld = MULTI_PART_TLDS.find((tld) => lower.endsWith(tld));
|
|
1597
|
+
if (multiTld) {
|
|
1598
|
+
const withoutTld = lower.slice(0, -multiTld.length);
|
|
1599
|
+
const parts2 = withoutTld.split(".").filter(Boolean);
|
|
1600
|
+
return parts2[parts2.length - 1] + multiTld;
|
|
1601
|
+
}
|
|
1602
|
+
const parts = lower.split(".");
|
|
1603
|
+
return parts.slice(-2).join(".");
|
|
1604
|
+
}
|
|
1605
|
+
function isSubdomain(domain) {
|
|
1606
|
+
if (!domain) return false;
|
|
1607
|
+
const lower = domain.toLowerCase();
|
|
1608
|
+
const multiTld = MULTI_PART_TLDS.find((tld) => lower.endsWith(tld));
|
|
1609
|
+
if (multiTld) {
|
|
1610
|
+
const withoutTld = lower.slice(0, -multiTld.length);
|
|
1611
|
+
return withoutTld.includes(".");
|
|
1612
|
+
}
|
|
1613
|
+
return domain.split(".").length > 2;
|
|
1614
|
+
}
|
|
1615
|
+
async function lookupNameservers(domain) {
|
|
1616
|
+
const rootDomain = getRootDomain(domain);
|
|
1617
|
+
try {
|
|
1618
|
+
return await import_promises.default.resolveNs(rootDomain);
|
|
1619
|
+
} catch {
|
|
1620
|
+
return [];
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
var DNS_PROVIDER_MAP = [
|
|
1624
|
+
[["godaddy", "domaincontrol"], "GoDaddy"],
|
|
1625
|
+
[["namecheap", "registrar-servers.com"], "Namecheap"],
|
|
1626
|
+
[["cloudflare"], "Cloudflare"],
|
|
1627
|
+
[["googledomains", "google.com"], "Google Domains"],
|
|
1628
|
+
[["awsdns", "amazon"], "AWS (Route 53)"],
|
|
1629
|
+
[["bluehost"], "Bluehost"],
|
|
1630
|
+
[["siteground"], "SiteGround"],
|
|
1631
|
+
[["hostgator"], "HostGator"],
|
|
1632
|
+
[["dreamhost"], "DreamHost"],
|
|
1633
|
+
[["name.com"], "Name.com"],
|
|
1634
|
+
[["gandi"], "Gandi"],
|
|
1635
|
+
[["gabia"], "Gabia"],
|
|
1636
|
+
[["whois"], "Whois"],
|
|
1637
|
+
[["cafe24"], "Cafe24"],
|
|
1638
|
+
[["imweb"], "Imweb"],
|
|
1639
|
+
[["xinnet"], "Xinnet"],
|
|
1640
|
+
[["aliyun", "alidns"], "Aliyun"],
|
|
1641
|
+
[["dnspod", "qcloud"], "Tencent Cloud"]
|
|
1642
|
+
];
|
|
1643
|
+
function detectDnsProvider(nameservers) {
|
|
1644
|
+
if (nameservers.length === 0) return null;
|
|
1645
|
+
const nsString = nameservers.join(",").toLowerCase();
|
|
1646
|
+
for (const [keywords, provider] of DNS_PROVIDER_MAP) {
|
|
1647
|
+
if (keywords.some((kw) => nsString.includes(kw))) return provider;
|
|
1648
|
+
}
|
|
1649
|
+
return null;
|
|
1650
|
+
}
|
|
1651
|
+
var DNS_PROVIDER_GUIDES = {
|
|
1652
|
+
GoDaddy: "https://www.godaddy.com/help/add-a-cname-record-19236",
|
|
1653
|
+
Namecheap: "https://www.namecheap.com/support/knowledgebase/article.aspx/434/2237/how-do-i-set-up-host-records-for-a-domain/",
|
|
1654
|
+
Cloudflare: "https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/",
|
|
1655
|
+
"Google Domains": "https://support.google.com/domains/answer/3290350",
|
|
1656
|
+
"AWS (Route 53)": "https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating.html",
|
|
1657
|
+
Bluehost: "https://www.bluehost.com/help/article/dns-management-add-edit-or-delete-dns-entries",
|
|
1658
|
+
SiteGround: "https://www.siteground.com/kb/how_to_manage_dns_records/",
|
|
1659
|
+
HostGator: "https://www.hostgator.com/help/article/how-to-change-dns-zones-mx-cname-and-a-records",
|
|
1660
|
+
DreamHost: "https://help.dreamhost.com/hc/en-us/articles/215413857-DreamHost-DNS-overview",
|
|
1661
|
+
"Name.com": "https://www.name.com/support/articles/205934458-Adding-a-CNAME-Record",
|
|
1662
|
+
Gandi: "https://docs.gandi.net/en/domain_names/common_operations/dns_records.html",
|
|
1663
|
+
Gabia: "https://customer.gabia.com/manual/dns/3041/3040",
|
|
1664
|
+
Whois: "https://cs.whois.co.kr/manual/?p=view&page=1&number=435&keyfield=sub_cont&keyword=dns",
|
|
1665
|
+
Cafe24: "https://help.cafe24.com/docs/domain/domain-hosting-external-service-connection/",
|
|
1666
|
+
Imweb: "https://imweb.me/qna?mode=faq&q=71897",
|
|
1667
|
+
Xinnet: "http://www.xinnet.com/service/cjwt/yuming/guanli/1485.html",
|
|
1668
|
+
Aliyun: "https://www.alibabacloud.com/help/en/dns/user-guide/add-a-dns-record",
|
|
1669
|
+
"Tencent Cloud": "https://www.tencentcloud.com/document/product/302/3446"
|
|
1670
|
+
};
|
|
1671
|
+
function getDnsProviderGuide(provider) {
|
|
1672
|
+
return DNS_PROVIDER_GUIDES[provider] || null;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
// src/utils/upload.ts
|
|
1676
|
+
var import_node_fs = __toESM(require("fs"));
|
|
1677
|
+
var import_node_path = __toESM(require("path"));
|
|
1678
|
+
var import_node_crypto2 = require("crypto");
|
|
1679
|
+
var WORKER_URL = "https://upload.inblog.dev/";
|
|
1680
|
+
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
1681
|
+
var MIME_TYPES = {
|
|
1682
|
+
".png": "image/png",
|
|
1683
|
+
".jpg": "image/jpeg",
|
|
1684
|
+
".jpeg": "image/jpeg",
|
|
1685
|
+
".gif": "image/gif",
|
|
1686
|
+
".webp": "image/webp",
|
|
1687
|
+
".svg": "image/svg+xml",
|
|
1688
|
+
".ico": "image/x-icon"
|
|
1689
|
+
};
|
|
1690
|
+
function isLocalPath(value) {
|
|
1691
|
+
if (value.startsWith("http://") || value.startsWith("https://")) return false;
|
|
1692
|
+
return import_node_fs.default.existsSync(value);
|
|
1693
|
+
}
|
|
1694
|
+
async function uploadImage(filePath, bucket) {
|
|
1695
|
+
const resolved = import_node_path.default.resolve(filePath);
|
|
1696
|
+
if (!import_node_fs.default.existsSync(resolved)) {
|
|
1697
|
+
throw new Error(`File not found: ${resolved}`);
|
|
1698
|
+
}
|
|
1699
|
+
const stat = import_node_fs.default.statSync(resolved);
|
|
1700
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
1701
|
+
throw new Error(`File size exceeds 10MB limit: ${(stat.size / 1024 / 1024).toFixed(1)}MB`);
|
|
1702
|
+
}
|
|
1703
|
+
const ext = import_node_path.default.extname(resolved).toLowerCase();
|
|
1704
|
+
const contentType = MIME_TYPES[ext] || "application/octet-stream";
|
|
1705
|
+
const fileKey = `${bucket}/${(/* @__PURE__ */ new Date()).toISOString()}-${(0, import_node_crypto2.randomUUID)()}`;
|
|
1706
|
+
const body = import_node_fs.default.readFileSync(resolved);
|
|
1707
|
+
const response = await fetch(`${WORKER_URL}?fileKey=${fileKey}`, {
|
|
1708
|
+
method: "POST",
|
|
1709
|
+
body,
|
|
1710
|
+
headers: { "Content-Type": contentType }
|
|
1711
|
+
});
|
|
1712
|
+
if (!response.ok) {
|
|
1713
|
+
throw new Error(`Upload failed: ${response.status} ${response.statusText}`);
|
|
1714
|
+
}
|
|
1715
|
+
const data = await response.json();
|
|
1716
|
+
return data.publicUrl;
|
|
1717
|
+
}
|
|
1718
|
+
async function resolveImageUrl(value, bucket) {
|
|
1719
|
+
if (!isLocalPath(value)) return value;
|
|
1720
|
+
return uploadImage(value, bucket);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// src/commands/blogs.ts
|
|
1559
1724
|
function registerBlogsCommands(program2) {
|
|
1560
1725
|
const blogs = program2.command("blogs").description("Manage blogs \u2014 list, switch, view, and update blog settings");
|
|
1561
1726
|
blogs.command("me").description("Show blog info (title, subdomain, plan, domain)").action(async function() {
|
|
@@ -1705,25 +1870,24 @@ function registerBlogsCommands(program2) {
|
|
|
1705
1870
|
handleError(error, json);
|
|
1706
1871
|
}
|
|
1707
1872
|
});
|
|
1708
|
-
blogs.command("update").description("Update blog title, description, language, or timezone").option("-t, --title <title>", "Blog title").option("-d, --description <desc>", "Blog description").option("--language <lang>", "Blog language").option("--timezone-diff <hours>", "Timezone offset in hours").option("--logo <url>", "Blog logo image URL").option("--favicon <url>", "Blog favicon image URL").option("--og-image <url>", "Blog OG image URL").option("--ga-id <id>", "Google Analytics measurement ID").action(async function() {
|
|
1873
|
+
blogs.command("update").description("Update blog title, description, language, or timezone").option("-t, --title <title>", "Blog title").option("-d, --description <desc>", "Blog description").option("--language <lang>", "Blog language").option("--timezone-diff <hours>", "Timezone offset in hours").option("--logo <path-or-url>", "Blog logo image (local file or URL)").option("--favicon <path-or-url>", "Blog favicon image (local file or URL)").option("--og-image <path-or-url>", "Blog OG image (local file or URL)").option("--ga-id <id>", "Google Analytics measurement ID").action(async function() {
|
|
1709
1874
|
const json = isJsonMode(this);
|
|
1710
1875
|
try {
|
|
1711
1876
|
const opts = this.opts();
|
|
1712
1877
|
const ctx = createClientFromCommand(this);
|
|
1713
|
-
const { data: blog } = await ctx.blogs.me();
|
|
1714
1878
|
const input = {};
|
|
1715
1879
|
if (opts.title) input.title = opts.title;
|
|
1716
1880
|
if (opts.description) input.description = opts.description;
|
|
1717
1881
|
if (opts.language) input.blog_language = opts.language;
|
|
1718
1882
|
if (opts.timezoneDiff !== void 0) input.timezone_diff = parseInt(opts.timezoneDiff, 10);
|
|
1719
|
-
if (opts.logo) input.logo = opts.logo;
|
|
1720
|
-
if (opts.favicon) input.favicon = opts.favicon;
|
|
1721
|
-
if (opts.ogImage) input.og_image = opts.ogImage;
|
|
1883
|
+
if (opts.logo) input.logo = await resolveImageUrl(opts.logo, "logo");
|
|
1884
|
+
if (opts.favicon) input.favicon = await resolveImageUrl(opts.favicon, "favicon");
|
|
1885
|
+
if (opts.ogImage) input.og_image = await resolveImageUrl(opts.ogImage, "og_image");
|
|
1722
1886
|
if (opts.gaId) input.ga_measurement_id = opts.gaId;
|
|
1723
1887
|
if (Object.keys(input).length === 0) {
|
|
1724
1888
|
throw new Error("No fields to update. Provide at least one option.");
|
|
1725
1889
|
}
|
|
1726
|
-
const { data } = await ctx.blogs.update(
|
|
1890
|
+
const { data } = await ctx.blogs.update(input);
|
|
1727
1891
|
if (json) {
|
|
1728
1892
|
printJson(data);
|
|
1729
1893
|
} else {
|
|
@@ -1734,22 +1898,53 @@ function registerBlogsCommands(program2) {
|
|
|
1734
1898
|
}
|
|
1735
1899
|
});
|
|
1736
1900
|
const domain = blogs.command("domain").description("Manage custom domain");
|
|
1737
|
-
domain.command("connect <domain>").description("Connect a custom domain").action(async function(domainArg) {
|
|
1901
|
+
domain.command("connect <domain>").description("Connect a custom domain (with DNS provider detection)").action(async function(domainArg) {
|
|
1738
1902
|
const json = isJsonMode(this);
|
|
1739
1903
|
try {
|
|
1740
1904
|
const ctx = createClientFromCommand(this);
|
|
1741
1905
|
const result = await ctx.blogs.domainConnect(domainArg);
|
|
1906
|
+
const nameservers = await lookupNameservers(domainArg);
|
|
1907
|
+
const provider = detectDnsProvider(nameservers);
|
|
1908
|
+
const guide = provider ? getDnsProviderGuide(provider) : null;
|
|
1909
|
+
const isSub = isSubdomain(domainArg);
|
|
1742
1910
|
if (json) {
|
|
1743
|
-
printJson(
|
|
1911
|
+
printJson({
|
|
1912
|
+
...result,
|
|
1913
|
+
nameservers,
|
|
1914
|
+
dns_provider: provider,
|
|
1915
|
+
dns_provider_guide: guide,
|
|
1916
|
+
is_subdomain: isSub
|
|
1917
|
+
});
|
|
1744
1918
|
} else {
|
|
1745
1919
|
printSuccess(`Custom domain requested: ${domainArg}`);
|
|
1920
|
+
if (provider) {
|
|
1921
|
+
console.log(`
|
|
1922
|
+
DNS Provider: ${provider}`);
|
|
1923
|
+
if (nameservers.length > 0) {
|
|
1924
|
+
console.log(` Nameservers: ${nameservers.join(", ")}`);
|
|
1925
|
+
}
|
|
1926
|
+
} else if (nameservers.length > 0) {
|
|
1927
|
+
console.log(`
|
|
1928
|
+
Nameservers: ${nameservers.join(", ")}`);
|
|
1929
|
+
}
|
|
1930
|
+
console.log("\n DNS \uC124\uC815:");
|
|
1931
|
+
if (isSub) {
|
|
1932
|
+
console.log(` \u2192 CNAME ${domainArg} \u2192 cname.inblog.ai`);
|
|
1933
|
+
} else {
|
|
1934
|
+
console.log(` \u2192 A ${domainArg} \u2192 76.76.21.21`);
|
|
1935
|
+
}
|
|
1746
1936
|
if (result.dns_records && result.dns_records.length > 0) {
|
|
1937
|
+
console.log("");
|
|
1747
1938
|
printTable(
|
|
1748
1939
|
["Type", "Name", "Value"],
|
|
1749
1940
|
result.dns_records.map((r) => [r.type, r.name, r.value])
|
|
1750
1941
|
);
|
|
1751
1942
|
}
|
|
1752
|
-
|
|
1943
|
+
if (guide) {
|
|
1944
|
+
console.log(`
|
|
1945
|
+
${provider} DNS \uC124\uC815 \uAC00\uC774\uB4DC: ${guide}`);
|
|
1946
|
+
}
|
|
1947
|
+
printWarning("\nDNS \uC804\uD30C \uD6C4 `inblog blogs domain status`\uB85C \uD655\uC778\uD558\uC138\uC694.");
|
|
1753
1948
|
}
|
|
1754
1949
|
} catch (error) {
|
|
1755
1950
|
handleError(error, json);
|
|
@@ -1818,12 +2013,12 @@ function registerBlogsCommands(program2) {
|
|
|
1818
2013
|
handleError(error, json);
|
|
1819
2014
|
}
|
|
1820
2015
|
});
|
|
1821
|
-
banner.command("set").description("Update banner settings").option("--image <url>", "Banner image URL").option("--title <text>", "Banner title text").option("--subtext <text>", "Banner subtext").option("--title-color <hex>", "Banner title color (hex)").option("--bg-color <hex>", "Banner background color (hex)").action(async function() {
|
|
2016
|
+
banner.command("set").description("Update banner settings").option("--image <path-or-url>", "Banner image (local file or URL)").option("--title <text>", "Banner title text").option("--subtext <text>", "Banner subtext").option("--title-color <hex>", "Banner title color (hex)").option("--bg-color <hex>", "Banner background color (hex)").action(async function() {
|
|
1822
2017
|
const json = isJsonMode(this);
|
|
1823
2018
|
try {
|
|
1824
2019
|
const opts = this.opts();
|
|
1825
2020
|
const input = {};
|
|
1826
|
-
if (opts.image) input.banner_url = opts.image;
|
|
2021
|
+
if (opts.image) input.banner_url = await resolveImageUrl(opts.image, "banner");
|
|
1827
2022
|
if (opts.title) input.banner_title = opts.title;
|
|
1828
2023
|
if (opts.subtext) input.banner_subtext = opts.subtext;
|
|
1829
2024
|
if (opts.titleColor) input.banner_title_color = opts.titleColor;
|