star8-cli 1.1.0 → 1.2.1
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/index.js +664 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -330,6 +330,138 @@ var ApiClient = class {
|
|
|
330
330
|
return this.delete(`${this.serverPath()}/ssh/key/${enc(keyId)}`);
|
|
331
331
|
}
|
|
332
332
|
// ================================================================
|
|
333
|
+
// リソースモニター
|
|
334
|
+
// ================================================================
|
|
335
|
+
async getResourceMonitor(date) {
|
|
336
|
+
return this.get(`${this.serverPath()}/resource-monitor`, { date });
|
|
337
|
+
}
|
|
338
|
+
// ================================================================
|
|
339
|
+
// WAF設定
|
|
340
|
+
// ================================================================
|
|
341
|
+
async listWaf(params) {
|
|
342
|
+
return this.get(`${this.serverPath()}/waf`, params);
|
|
343
|
+
}
|
|
344
|
+
async updateWaf(domain, data) {
|
|
345
|
+
return this.put(`${this.serverPath()}/waf/${enc(domain)}`, data);
|
|
346
|
+
}
|
|
347
|
+
// ================================================================
|
|
348
|
+
// php.ini設定
|
|
349
|
+
// ================================================================
|
|
350
|
+
async listPhpIni(params) {
|
|
351
|
+
return this.get(`${this.serverPath()}/php-ini`, params);
|
|
352
|
+
}
|
|
353
|
+
async updatePhpIni(domain, data) {
|
|
354
|
+
return this.put(`${this.serverPath()}/php-ini/${enc(domain)}`, data);
|
|
355
|
+
}
|
|
356
|
+
async resetPhpIni(domain) {
|
|
357
|
+
return this.post(`${this.serverPath()}/php-ini/${enc(domain)}/reset`);
|
|
358
|
+
}
|
|
359
|
+
// ================================================================
|
|
360
|
+
// WordPressセキュリティ設定
|
|
361
|
+
// ================================================================
|
|
362
|
+
async getWordPressSecurity(params) {
|
|
363
|
+
return this.get(`${this.serverPath()}/wordpress-security`, params);
|
|
364
|
+
}
|
|
365
|
+
async updateWordPressSecurity(data) {
|
|
366
|
+
return this.post(`${this.serverPath()}/wordpress-security`, data);
|
|
367
|
+
}
|
|
368
|
+
// ================================================================
|
|
369
|
+
// Xアクセラレータ設定
|
|
370
|
+
// ================================================================
|
|
371
|
+
async listXAccelerator(params) {
|
|
372
|
+
return this.get(`${this.serverPath()}/x-accelerator`, params);
|
|
373
|
+
}
|
|
374
|
+
async updateXAccelerator(domain, data) {
|
|
375
|
+
return this.put(`${this.serverPath()}/x-accelerator/${enc(domain)}`, data);
|
|
376
|
+
}
|
|
377
|
+
// ================================================================
|
|
378
|
+
// サーバーキャッシュ設定
|
|
379
|
+
// ================================================================
|
|
380
|
+
async listServerCache(params) {
|
|
381
|
+
return this.get(`${this.serverPath()}/server-cache`, params);
|
|
382
|
+
}
|
|
383
|
+
async updateServerCache(domain, data) {
|
|
384
|
+
return this.put(`${this.serverPath()}/server-cache/${enc(domain)}`, data);
|
|
385
|
+
}
|
|
386
|
+
async clearServerCache(domain) {
|
|
387
|
+
return this.delete(`${this.serverPath()}/server-cache/${enc(domain)}/cache`);
|
|
388
|
+
}
|
|
389
|
+
// ================================================================
|
|
390
|
+
// ブラウザキャッシュ設定
|
|
391
|
+
// ================================================================
|
|
392
|
+
async listBrowserCache(params) {
|
|
393
|
+
return this.get(`${this.serverPath()}/browser-cache`, params);
|
|
394
|
+
}
|
|
395
|
+
async updateBrowserCache(domain, data) {
|
|
396
|
+
return this.put(`${this.serverPath()}/browser-cache/${enc(domain)}`, data);
|
|
397
|
+
}
|
|
398
|
+
// ================================================================
|
|
399
|
+
// サイト転送設定
|
|
400
|
+
// ================================================================
|
|
401
|
+
async listUrlRedirect(params) {
|
|
402
|
+
return this.get(`${this.serverPath()}/url-redirect`, params);
|
|
403
|
+
}
|
|
404
|
+
async addUrlRedirect(data) {
|
|
405
|
+
return this.post(`${this.serverPath()}/url-redirect`, data);
|
|
406
|
+
}
|
|
407
|
+
async deleteUrlRedirect(redirectId) {
|
|
408
|
+
return this.delete(`${this.serverPath()}/url-redirect/${enc(redirectId)}`);
|
|
409
|
+
}
|
|
410
|
+
// ================================================================
|
|
411
|
+
// アクセス拒否設定
|
|
412
|
+
// ================================================================
|
|
413
|
+
async listAccessDeny(params) {
|
|
414
|
+
return this.get(`${this.serverPath()}/access-deny`, params);
|
|
415
|
+
}
|
|
416
|
+
async addAccessDeny(data) {
|
|
417
|
+
return this.post(`${this.serverPath()}/access-deny`, data);
|
|
418
|
+
}
|
|
419
|
+
async updateAccessDeny(denyId, data) {
|
|
420
|
+
return this.put(`${this.serverPath()}/access-deny/${enc(denyId)}`, data);
|
|
421
|
+
}
|
|
422
|
+
async deleteAccessDeny(denyId) {
|
|
423
|
+
return this.delete(`${this.serverPath()}/access-deny/${enc(denyId)}`);
|
|
424
|
+
}
|
|
425
|
+
// ================================================================
|
|
426
|
+
// XPageSpeed設定
|
|
427
|
+
// ================================================================
|
|
428
|
+
async listXPageSpeed(params) {
|
|
429
|
+
return this.get(`${this.serverPath()}/xpagespeed`, params);
|
|
430
|
+
}
|
|
431
|
+
async updateXPageSpeed(domain, data) {
|
|
432
|
+
return this.put(`${this.serverPath()}/xpagespeed/${enc(domain)}`, data);
|
|
433
|
+
}
|
|
434
|
+
// ================================================================
|
|
435
|
+
// 自動バックアップの取得・復元
|
|
436
|
+
// ================================================================
|
|
437
|
+
async listAutoBackupBackupDates() {
|
|
438
|
+
return this.get(`${this.serverPath()}/auto-backup/backup-dates`);
|
|
439
|
+
}
|
|
440
|
+
async listAutoBackup() {
|
|
441
|
+
return this.get(`${this.serverPath()}/auto-backup`);
|
|
442
|
+
}
|
|
443
|
+
async getAutoBackup(requestId) {
|
|
444
|
+
return this.get(`${this.serverPath()}/auto-backup/${enc(requestId)}`);
|
|
445
|
+
}
|
|
446
|
+
async createAutoBackup(data) {
|
|
447
|
+
return this.post(`${this.serverPath()}/auto-backup`, data);
|
|
448
|
+
}
|
|
449
|
+
// ================================================================
|
|
450
|
+
// MySQLバックアップの取得・復元
|
|
451
|
+
// ================================================================
|
|
452
|
+
async listMysqlBackupDatabases() {
|
|
453
|
+
return this.get(`${this.serverPath()}/mysql-backup/databases`);
|
|
454
|
+
}
|
|
455
|
+
async listMysqlBackup() {
|
|
456
|
+
return this.get(`${this.serverPath()}/mysql-backup`);
|
|
457
|
+
}
|
|
458
|
+
async getMysqlBackup(requestId) {
|
|
459
|
+
return this.get(`${this.serverPath()}/mysql-backup/${enc(requestId)}`);
|
|
460
|
+
}
|
|
461
|
+
async createMysqlBackup(data) {
|
|
462
|
+
return this.post(`${this.serverPath()}/mysql-backup`, data);
|
|
463
|
+
}
|
|
464
|
+
// ================================================================
|
|
333
465
|
// ログ
|
|
334
466
|
// ================================================================
|
|
335
467
|
async getAccessLog(params) {
|
|
@@ -500,13 +632,19 @@ function formatTable(data) {
|
|
|
500
632
|
const obj = data;
|
|
501
633
|
const arrayEntry = Object.entries(obj).find(([, v]) => Array.isArray(v) && (v.length === 0 || typeof v[0] === "object" && v[0] !== null));
|
|
502
634
|
if (arrayEntry) {
|
|
503
|
-
const
|
|
635
|
+
const [arrayKey, arrayValue] = arrayEntry;
|
|
636
|
+
const scalarEntries = Object.entries(obj).filter(([k]) => k !== arrayKey);
|
|
504
637
|
const parts = [];
|
|
505
638
|
if (scalarEntries.length > 0) {
|
|
506
639
|
parts.push(renderKeyValueTable(Object.fromEntries(scalarEntries)));
|
|
507
640
|
parts.push("");
|
|
508
641
|
}
|
|
509
|
-
|
|
642
|
+
const items = arrayValue;
|
|
643
|
+
if (items.length === 0) {
|
|
644
|
+
parts.push(scalarEntries.length > 0 ? `${arrayKey} (0\u4EF6)` : "(\u30C7\u30FC\u30BF\u306A\u3057)");
|
|
645
|
+
} else {
|
|
646
|
+
parts.push(renderArrayTable(items));
|
|
647
|
+
}
|
|
510
648
|
return parts.join("\n");
|
|
511
649
|
}
|
|
512
650
|
return renderKeyValueTable(obj);
|
|
@@ -522,10 +660,23 @@ function renderKeyValueTable(obj) {
|
|
|
522
660
|
const lines = entries.map((e) => `${padRight(e.key, maxKeyLen)} ${e.value}`);
|
|
523
661
|
return lines.join("\n");
|
|
524
662
|
}
|
|
663
|
+
function collectTableKeys(items) {
|
|
664
|
+
const keys = [];
|
|
665
|
+
const seen = /* @__PURE__ */ new Set();
|
|
666
|
+
for (const item of items) {
|
|
667
|
+
for (const key of Object.keys(item)) {
|
|
668
|
+
if (!seen.has(key)) {
|
|
669
|
+
seen.add(key);
|
|
670
|
+
keys.push(key);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return keys;
|
|
675
|
+
}
|
|
525
676
|
function renderArrayTable(items) {
|
|
526
677
|
if (items.length === 0)
|
|
527
678
|
return "(\u30C7\u30FC\u30BF\u306A\u3057)";
|
|
528
|
-
const keys =
|
|
679
|
+
const keys = collectTableKeys(items);
|
|
529
680
|
const colWidths = keys.map((key) => {
|
|
530
681
|
const headerWidth = displayWidth(key);
|
|
531
682
|
const maxDataWidth = Math.max(...items.map((item) => displayWidth(formatValue(item[key]))));
|
|
@@ -627,7 +778,7 @@ function maskApiKey(apiKey) {
|
|
|
627
778
|
}
|
|
628
779
|
function registerAuthCommands(program, brand) {
|
|
629
780
|
const auth = program.command("auth").description("\u8A8D\u8A3C\u8A2D\u5B9A");
|
|
630
|
-
auth.command("login").description("API\u30AD\u30FC\u3092\u8A2D\u5B9A\uFF08\u30B5\u30FC\u30D0\u30FC\
|
|
781
|
+
auth.command("login").description("API\u30AD\u30FC\u3092\u8A2D\u5B9A\uFF08\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C1\u53F0\u306E\u30AD\u30FC\u306F\u30B5\u30FC\u30D0\u30FC\u540D\u3092\u81EA\u52D5\u691C\u51FA\uFF09").option("--api-key <key>", "API\u30AD\u30FC").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u81EA\u52D5\u691C\u51FA\u3092\u4E0A\u66F8\u304D\uFF09").action(async (opts, cmd) => {
|
|
631
782
|
const profileName = cmd.optsWithGlobals().profile ?? "default";
|
|
632
783
|
let apiKey = opts.apiKey;
|
|
633
784
|
let servername = opts.servername;
|
|
@@ -654,6 +805,10 @@ function registerAuthCommands(program, brand) {
|
|
|
654
805
|
if (!servername && meData.servername) {
|
|
655
806
|
servername = meData.servername;
|
|
656
807
|
console.error(` \u30B5\u30FC\u30D0\u30FC\u540D\u3092\u81EA\u52D5\u691C\u51FA\u3057\u307E\u3057\u305F: ${servername}`);
|
|
808
|
+
} else if (!servername) {
|
|
809
|
+
console.error(" \u3053\u306EAPI\u30AD\u30FC\u306F\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08\u300C\u3059\u3079\u3066\u306E\u30B5\u30FC\u30D0\u30FC\u300D\u7B49\uFF09\u3002");
|
|
810
|
+
console.error(" \u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u5BFE\u8C61\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
811
|
+
console.error(` \u4F8B: ${brand.commandName} server --servername <\u30B5\u30FC\u30D0\u30FCID> info`);
|
|
657
812
|
}
|
|
658
813
|
const config = loadConfig(brand);
|
|
659
814
|
config.profiles[profileName] = {
|
|
@@ -699,6 +854,8 @@ function registerAuthCommands(program, brand) {
|
|
|
699
854
|
console.log(`API\u30AD\u30FC: ${maskApiKey(profile.apiKey)}`);
|
|
700
855
|
if (profile.servername) {
|
|
701
856
|
console.log(`\u30B5\u30FC\u30D0\u30FC\u540D: ${profile.servername}`);
|
|
857
|
+
} else {
|
|
858
|
+
console.log("\u30B5\u30FC\u30D0\u30FC\u540D: \u672A\u56FA\u5B9A\uFF08\u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u6307\u5B9A\uFF09");
|
|
702
859
|
}
|
|
703
860
|
console.log(`API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8: ${brand.apiBase}`);
|
|
704
861
|
});
|
|
@@ -739,7 +896,7 @@ function registerAuthCommands(program, brand) {
|
|
|
739
896
|
const marker = name === config.defaultProfile ? " (default)" : "";
|
|
740
897
|
const p = config.profiles[name];
|
|
741
898
|
const key = maskApiKey(p.apiKey);
|
|
742
|
-
const sv = p.servername ? ` servername=${p.servername}` : "";
|
|
899
|
+
const sv = p.servername ? ` servername=${p.servername}` : " servername=(\u672A\u56FA\u5B9A)";
|
|
743
900
|
console.log(`${name}${marker}: key=${key}${sv}`);
|
|
744
901
|
}
|
|
745
902
|
});
|
|
@@ -1455,6 +1612,495 @@ function registerLogCommands(parent, brand) {
|
|
|
1455
1612
|
});
|
|
1456
1613
|
}
|
|
1457
1614
|
|
|
1615
|
+
// ../core/dist/commands/server/resource-monitor/index.js
|
|
1616
|
+
function registerResourceMonitorCommands(parent, brand) {
|
|
1617
|
+
const resourceMonitor = parent.command("resource-monitor").description("\u30EA\u30BD\u30FC\u30B9\u30E2\u30CB\u30BF\u30FC");
|
|
1618
|
+
resourceMonitor.command("get").description("\u6307\u5B9A\u65E5\u306ECPU\u30FB\u30E1\u30E2\u30EA\u30FB\u8EE2\u9001\u91CF\u6642\u7CFB\u5217\u3092\u53D6\u5F97").requiredOption("--date <date>", "\u5BFE\u8C61\u65E5\uFF08Y-m-d \u307E\u305F\u306F Ymd\u3002\u5F53\u65E5\u542B\u3080\u76F4\u8FD11\u304B\u6708\uFF09").action(async (opts) => {
|
|
1619
|
+
const client = resolveClient(parent, brand);
|
|
1620
|
+
printResult(await client.getResourceMonitor(opts.date), getFormat(parent));
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
// ../core/dist/commands/server/waf/index.js
|
|
1625
|
+
function registerWafCommands(parent, brand) {
|
|
1626
|
+
const waf = parent.command("waf").description("WAF\u8A2D\u5B9A");
|
|
1627
|
+
waf.command("list").description("WAF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1628
|
+
const client = resolveClient(parent, brand);
|
|
1629
|
+
const params = {};
|
|
1630
|
+
if (opts.domain)
|
|
1631
|
+
params.domain = opts.domain;
|
|
1632
|
+
printResult(await client.listWaf(params), getFormat(parent));
|
|
1633
|
+
});
|
|
1634
|
+
waf.command("update <domain>").description("WAF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--xss-protection <value>", "XSS\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--sql-injection-protection <value>", "SQL\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--file-protection <value>", "\u30D5\u30A1\u30A4\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--mail-protection <value>", "\u30E1\u30FC\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--command-protection <value>", "\u30B3\u30DE\u30F3\u30C9\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--php-protection <value>", "PHP\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (domain, opts) => {
|
|
1635
|
+
const data = {};
|
|
1636
|
+
if (opts.xssProtection !== void 0)
|
|
1637
|
+
data.xss_protection = opts.xssProtection;
|
|
1638
|
+
if (opts.sqlInjectionProtection !== void 0)
|
|
1639
|
+
data.sql_injection_protection = opts.sqlInjectionProtection;
|
|
1640
|
+
if (opts.fileProtection !== void 0)
|
|
1641
|
+
data.file_protection = opts.fileProtection;
|
|
1642
|
+
if (opts.mailProtection !== void 0)
|
|
1643
|
+
data.mail_protection = opts.mailProtection;
|
|
1644
|
+
if (opts.commandProtection !== void 0)
|
|
1645
|
+
data.command_protection = opts.commandProtection;
|
|
1646
|
+
if (opts.phpProtection !== void 0)
|
|
1647
|
+
data.php_protection = opts.phpProtection;
|
|
1648
|
+
if (Object.keys(data).length === 0) {
|
|
1649
|
+
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1650
|
+
}
|
|
1651
|
+
const client = resolveClient(parent, brand);
|
|
1652
|
+
printResult(await client.updateWaf(domain, data), getFormat(parent));
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// ../core/dist/commands/server/php-ini/index.js
|
|
1657
|
+
var PHP_INI_UPDATE_OPTIONS = [
|
|
1658
|
+
{ cli: "display-errors", api: "display_errors", desc: "\u30A8\u30E9\u30FC\u5185\u5BB9\u3092\u753B\u9762\u306B\u51FA\u529B\uFF08On / Off\uFF09" },
|
|
1659
|
+
{ cli: "error-reporting", api: "error_reporting", desc: "\u30A8\u30E9\u30FC\u51FA\u529B\u30EC\u30D9\u30EB" },
|
|
1660
|
+
{ cli: "display-startup-errors", api: "display_startup_errors", desc: "\u8D77\u52D5\u6642\u30A8\u30E9\u30FC\u3092\u8868\u793A\uFF08On / Off\uFF09" },
|
|
1661
|
+
{ cli: "session-auto-start", api: "session.auto_start", desc: "\u30BB\u30C3\u30B7\u30E7\u30F3\u81EA\u52D5\u958B\u59CB\uFF080 / 1\uFF09" },
|
|
1662
|
+
{ cli: "session-name", api: "session.name", desc: "\u30BB\u30C3\u30B7\u30E7\u30F3\u540D" },
|
|
1663
|
+
{ cli: "session-use-cookies", api: "session.use_cookies", desc: "\u30BB\u30C3\u30B7\u30E7\u30F3ID\u306B\u30AF\u30C3\u30AD\u30FC\u3092\u4F7F\u7528\uFF080 / 1\uFF09" },
|
|
1664
|
+
{ cli: "session-use-only-cookies", api: "session.use_only_cookies", desc: "\u30AF\u30C3\u30AD\u30FC\u306E\u307F\u3067\u30BB\u30C3\u30B7\u30E7\u30F3ID\u3092\u4FDD\u5B58\uFF080 / 1\uFF09" },
|
|
1665
|
+
{ cli: "session-use-trans-sid", api: "session.use_trans_sid", desc: "URL\u3078\u30BB\u30C3\u30B7\u30E7\u30F3ID\u3092\u81EA\u52D5\u8A2D\u5B9A\uFF080 / 1\uFF09" },
|
|
1666
|
+
{ cli: "session-cookie-lifetime", api: "session.cookie_lifetime", desc: "\u30AF\u30C3\u30AD\u30FC\u6709\u52B9\u671F\u9593\uFF08\u79D2\uFF09" },
|
|
1667
|
+
{ cli: "session-cookie-path", api: "session.cookie_path", desc: "\u30AF\u30C3\u30AD\u30FC\u3092\u6709\u52B9\u3068\u3059\u308B\u30D1\u30B9" },
|
|
1668
|
+
{ cli: "session-cookie-domain", api: "session.cookie_domain", desc: "\u30AF\u30C3\u30AD\u30FC\u3092\u6709\u52B9\u3068\u3059\u308B\u30C9\u30E1\u30A4\u30F3" },
|
|
1669
|
+
{ cli: "mbstring-language", api: "mbstring.language", desc: "\u30C7\u30D5\u30A9\u30EB\u30C8\u8A00\u8A9E" },
|
|
1670
|
+
{ cli: "mbstring-internal-encoding", api: "mbstring.internal_encoding", desc: "\u5185\u90E8\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0" },
|
|
1671
|
+
{ cli: "mbstring-http-input", api: "mbstring.http_input", desc: "HTTP\u5165\u529B\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u5909\u63DB" },
|
|
1672
|
+
{ cli: "mbstring-http-output", api: "mbstring.http_output", desc: "HTTP\u51FA\u529B\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u5909\u63DB" },
|
|
1673
|
+
{ cli: "mbstring-encoding-translation", api: "mbstring.encoding_translation", desc: "\u5185\u90E8\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3078\u306E\u5909\u63DB\uFF08On / Off\uFF09" },
|
|
1674
|
+
{ cli: "mbstring-detect-order", api: "mbstring.detect_order", desc: "\u6587\u5B57\u30B3\u30FC\u30C9\u691C\u51FA" },
|
|
1675
|
+
{ cli: "mbstring-substitute-character", api: "mbstring.substitute_character", desc: "\u7121\u52B9\u6587\u5B57\u306E\u4EE3\u66FF\u6587\u5B57" },
|
|
1676
|
+
{ cli: "max-execution-time", api: "max_execution_time", desc: "\u6700\u5927\u5B9F\u884C\u6642\u9593\uFF08\u79D2\uFF09" },
|
|
1677
|
+
{ cli: "max-input-time", api: "max_input_time", desc: "\u5165\u529B\u30D1\u30FC\u30B9\u6700\u5927\u6642\u9593\uFF08\u79D2\uFF09" },
|
|
1678
|
+
{ cli: "memory-limit", api: "memory_limit", desc: "\u6700\u5927\u30E1\u30E2\u30EA" },
|
|
1679
|
+
{ cli: "post-max-size", api: "post_max_size", desc: "POST\u30C7\u30FC\u30BF\u6700\u5927\u30B5\u30A4\u30BA" },
|
|
1680
|
+
{ cli: "upload-max-filesize", api: "upload_max_filesize", desc: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u30D5\u30A1\u30A4\u30EB\u6700\u5927\u30B5\u30A4\u30BA" },
|
|
1681
|
+
{ cli: "register-globals", api: "register_globals", desc: "register_globals\uFF08On / Off\uFF09" },
|
|
1682
|
+
{ cli: "magic-quotes-gpc", api: "magic_quotes_gpc", desc: "magic_quotes_gpc\uFF08On / Off\uFF09" },
|
|
1683
|
+
{ cli: "safe-mode", api: "safe_mode", desc: "safe_mode\uFF08On / Off\u3002user_ini_active \u304C true \u306E\u3068\u304D\u306F\u5909\u66F4\u4E0D\u53EF\uFF09" },
|
|
1684
|
+
{ cli: "file-uploads", api: "file_uploads", desc: "HTTP\u30D5\u30A1\u30A4\u30EB\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\uFF08On / Off\u3002user_ini_active \u304C true \u306E\u3068\u304D\u306F\u5909\u66F4\u4E0D\u53EF\uFF09" },
|
|
1685
|
+
{ cli: "allow-url-fopen", api: "allow_url_fopen", desc: "allow_url_fopen\uFF08On / Off\u3002user_ini_active \u304C true \u306E\u3068\u304D\u306F\u5909\u66F4\u4E0D\u53EF\uFF09" },
|
|
1686
|
+
{ cli: "allow-url-include", api: "allow_url_include", desc: "allow_url_include\uFF08On / Off\u3002user_ini_active \u304C true \u306E\u3068\u304D\u306F\u5909\u66F4\u4E0D\u53EF\uFF09" }
|
|
1687
|
+
];
|
|
1688
|
+
function cliOptionToCamelCase(cli) {
|
|
1689
|
+
return cli.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
1690
|
+
}
|
|
1691
|
+
function buildUpdateData(opts) {
|
|
1692
|
+
const data = {};
|
|
1693
|
+
for (const { cli, api } of PHP_INI_UPDATE_OPTIONS) {
|
|
1694
|
+
const value = opts[cliOptionToCamelCase(cli)];
|
|
1695
|
+
if (value !== void 0)
|
|
1696
|
+
data[api] = value;
|
|
1697
|
+
}
|
|
1698
|
+
return data;
|
|
1699
|
+
}
|
|
1700
|
+
function registerPhpIniCommands(parent, brand) {
|
|
1701
|
+
const phpIni = parent.command("php-ini").description("php.ini\u8A2D\u5B9A\uFF08php-version \u3068\u306F\u5225\uFF09");
|
|
1702
|
+
phpIni.command("list").description("php.ini\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1703
|
+
const client = resolveClient(parent, brand);
|
|
1704
|
+
const params = {};
|
|
1705
|
+
if (opts.domain)
|
|
1706
|
+
params.domain = opts.domain;
|
|
1707
|
+
printResult(await client.listPhpIni(params), getFormat(parent));
|
|
1708
|
+
});
|
|
1709
|
+
const update = phpIni.command("update <domain>").description("php.ini\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
|
|
1710
|
+
for (const { cli, desc } of PHP_INI_UPDATE_OPTIONS) {
|
|
1711
|
+
update.option(`--${cli} <value>`, desc);
|
|
1712
|
+
}
|
|
1713
|
+
update.action(async (domain, opts) => {
|
|
1714
|
+
const data = buildUpdateData(opts);
|
|
1715
|
+
if (Object.keys(data).length === 0) {
|
|
1716
|
+
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1717
|
+
}
|
|
1718
|
+
const client = resolveClient(parent, brand);
|
|
1719
|
+
printResult(await client.updatePhpIni(domain, data), getFormat(parent));
|
|
1720
|
+
});
|
|
1721
|
+
phpIni.command("reset <domain>").description("php.ini\u8A2D\u5B9A\u3092\u521D\u671F\u5024\u306B\u623B\u3059").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
|
|
1722
|
+
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E php.ini \u3092\u521D\u671F\u5024\u306B\u623B\u3057\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1723
|
+
const client = resolveClient(parent, brand);
|
|
1724
|
+
printResult(await client.resetPhpIni(domain), getFormat(parent));
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
// ../core/dist/commands/server/wordpress-security/index.js
|
|
1729
|
+
var UPDATE_BLOCKS = [
|
|
1730
|
+
"comment_restriction",
|
|
1731
|
+
"login_attempt_limit",
|
|
1732
|
+
"foreign_ip_restriction",
|
|
1733
|
+
"ip_restriction"
|
|
1734
|
+
];
|
|
1735
|
+
var UPDATE_OPTIONS = [
|
|
1736
|
+
{ cli: "comment-restriction-bulk-post-enabled", desc: "\u5358\u4E00\u30E6\u30FC\u30B6\u30FC\u304B\u3089\u306E\u5927\u91CF\u6295\u7A3F\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1737
|
+
{ cli: "comment-restriction-foreign-post-enabled", desc: "\u56FD\u5916\u304B\u3089\u306E\u6295\u7A3F\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1738
|
+
{ cli: "login-attempt-limit-enabled", desc: "\u30ED\u30B0\u30A4\u30F3\u8A66\u884C\u56DE\u6570\u5236\u9650\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1739
|
+
{ cli: "foreign-ip-dashboard-enabled", desc: "\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9 \u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1740
|
+
{ cli: "foreign-ip-dashboard-allowed-ips", desc: '\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9 \u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u901A\u5E38\u306F\u30AF\u30A9\u30FC\u30C8\u4E0D\u8981\u3002\u7A7A\u306B\u3059\u308B\u5834\u5408\u306E\u307F ""\uFF09' },
|
|
1741
|
+
{ cli: "foreign-ip-xml-rpc-api-enabled", desc: "XML-RPC API \u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1742
|
+
{ cli: "foreign-ip-xml-rpc-api-allowed-ips", desc: 'XML-RPC API \u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u901A\u5E38\u306F\u30AF\u30A9\u30FC\u30C8\u4E0D\u8981\u3002\u7A7A\u306B\u3059\u308B\u5834\u5408\u306E\u307F ""\uFF09' },
|
|
1743
|
+
{ cli: "foreign-ip-rest-api-enabled", desc: "REST API \u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1744
|
+
{ cli: "foreign-ip-rest-api-allowed-ips", desc: 'REST API \u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u901A\u5E38\u306F\u30AF\u30A9\u30FC\u30C8\u4E0D\u8981\u3002\u7A7A\u306B\u3059\u308B\u5834\u5408\u306E\u307F ""\uFF09' },
|
|
1745
|
+
{ cli: "foreign-ip-wlwmanifest-enabled", desc: "wlwmanifest.xml \u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1746
|
+
{ cli: "foreign-ip-wlwmanifest-allowed-ips", desc: 'wlwmanifest.xml \u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u901A\u5E38\u306F\u30AF\u30A9\u30FC\u30C8\u4E0D\u8981\u3002\u7A7A\u306B\u3059\u308B\u5834\u5408\u306E\u307F ""\uFF09' },
|
|
1747
|
+
{ cli: "ip-restriction-enabled", desc: "IP\u30A2\u30C9\u30EC\u30B9\u5236\u9650\uFF08\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\uFF09\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1748
|
+
{ cli: "ip-restriction-allowed-ips", desc: 'IP\u30A2\u30C9\u30EC\u30B9\u5236\u9650\u306E\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A IPv4 \u307E\u305F\u306F CIDR\u3002\u901A\u5E38\u306F\u30AF\u30A9\u30FC\u30C8\u4E0D\u8981\u3002\u7A7A\u306B\u3059\u308B\u5834\u5408\u306E\u307F ""\uFF09' }
|
|
1749
|
+
];
|
|
1750
|
+
function parseIpAddressList(value) {
|
|
1751
|
+
if (value === "") {
|
|
1752
|
+
return [];
|
|
1753
|
+
}
|
|
1754
|
+
return value.split(",").map((a) => a.trim()).filter((a) => a !== "");
|
|
1755
|
+
}
|
|
1756
|
+
function parseBooleanParam(label, value) {
|
|
1757
|
+
const normalized = value.trim().toLowerCase();
|
|
1758
|
+
if (normalized !== "true" && normalized !== "false" && normalized !== "1" && normalized !== "0") {
|
|
1759
|
+
throw new ApiError("\u5165\u529B\u5024\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093", 422, "VALIDATION_ERROR", [`${label}\u306F true/false \u307E\u305F\u306F 1/0 \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`]);
|
|
1760
|
+
}
|
|
1761
|
+
return normalized === "true" || normalized === "1";
|
|
1762
|
+
}
|
|
1763
|
+
function setForeignIpTarget(block, target, enabledLabel, enabled, allowedIps) {
|
|
1764
|
+
const entry = {};
|
|
1765
|
+
if (enabled !== void 0)
|
|
1766
|
+
entry.enabled = parseBooleanParam(enabledLabel, enabled);
|
|
1767
|
+
if (allowedIps !== void 0)
|
|
1768
|
+
entry.allowed_ip_addresses = parseIpAddressList(allowedIps);
|
|
1769
|
+
if (Object.keys(entry).length > 0)
|
|
1770
|
+
block[target] = entry;
|
|
1771
|
+
}
|
|
1772
|
+
function buildUpdateData2(domain, opts) {
|
|
1773
|
+
const data = { domain };
|
|
1774
|
+
const commentRestriction = {};
|
|
1775
|
+
if (opts.commentRestrictionBulkPostEnabled !== void 0) {
|
|
1776
|
+
commentRestriction.bulk_post = {
|
|
1777
|
+
enabled: parseBooleanParam("\u5358\u4E00\u30E6\u30FC\u30B6\u30FC\u304B\u3089\u306E\u5927\u91CF\u6295\u7A3F", opts.commentRestrictionBulkPostEnabled)
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
if (opts.commentRestrictionForeignPostEnabled !== void 0) {
|
|
1781
|
+
commentRestriction.foreign_post = {
|
|
1782
|
+
enabled: parseBooleanParam("\u56FD\u5916\u304B\u3089\u306E\u6295\u7A3F", opts.commentRestrictionForeignPostEnabled)
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
if (Object.keys(commentRestriction).length > 0) {
|
|
1786
|
+
data.comment_restriction = commentRestriction;
|
|
1787
|
+
}
|
|
1788
|
+
if (opts.loginAttemptLimitEnabled !== void 0) {
|
|
1789
|
+
data.login_attempt_limit = {
|
|
1790
|
+
enabled: parseBooleanParam("\u30ED\u30B0\u30A4\u30F3\u8A66\u884C\u56DE\u6570\u5236\u9650", opts.loginAttemptLimitEnabled)
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
const foreignIpRestriction = {};
|
|
1794
|
+
setForeignIpTarget(foreignIpRestriction, "dashboard", "\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9 \u30A2\u30AF\u30BB\u30B9\u5236\u9650", opts.foreignIpDashboardEnabled, opts.foreignIpDashboardAllowedIps);
|
|
1795
|
+
setForeignIpTarget(foreignIpRestriction, "xml_rpc_api", "XML-RPC API \u30A2\u30AF\u30BB\u30B9\u5236\u9650", opts.foreignIpXmlRpcApiEnabled, opts.foreignIpXmlRpcApiAllowedIps);
|
|
1796
|
+
setForeignIpTarget(foreignIpRestriction, "rest_api", "REST API \u30A2\u30AF\u30BB\u30B9\u5236\u9650", opts.foreignIpRestApiEnabled, opts.foreignIpRestApiAllowedIps);
|
|
1797
|
+
setForeignIpTarget(foreignIpRestriction, "wlwmanifest", "wlwmanifest.xml \u30A2\u30AF\u30BB\u30B9\u5236\u9650", opts.foreignIpWlwmanifestEnabled, opts.foreignIpWlwmanifestAllowedIps);
|
|
1798
|
+
if (Object.keys(foreignIpRestriction).length > 0) {
|
|
1799
|
+
data.foreign_ip_restriction = foreignIpRestriction;
|
|
1800
|
+
}
|
|
1801
|
+
const ipRestriction = {};
|
|
1802
|
+
if (opts.ipRestrictionEnabled !== void 0) {
|
|
1803
|
+
ipRestriction.enabled = parseBooleanParam("IP\u30A2\u30C9\u30EC\u30B9\u5236\u9650\uFF08\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\uFF09", opts.ipRestrictionEnabled);
|
|
1804
|
+
}
|
|
1805
|
+
if (opts.ipRestrictionAllowedIps !== void 0) {
|
|
1806
|
+
ipRestriction.allowed_ip_addresses = parseIpAddressList(opts.ipRestrictionAllowedIps);
|
|
1807
|
+
}
|
|
1808
|
+
if (Object.keys(ipRestriction).length > 0) {
|
|
1809
|
+
data.ip_restriction = ipRestriction;
|
|
1810
|
+
}
|
|
1811
|
+
if (!UPDATE_BLOCKS.some((key) => key in data)) {
|
|
1812
|
+
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1813
|
+
}
|
|
1814
|
+
return data;
|
|
1815
|
+
}
|
|
1816
|
+
function registerWordPressSecurityCommands(parent, brand) {
|
|
1817
|
+
const wordpressSecurity = parent.command("wordpress-security").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
|
|
1818
|
+
wordpressSecurity.command("get").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1819
|
+
const client = resolveClient(parent, brand);
|
|
1820
|
+
const params = {};
|
|
1821
|
+
if (opts.domain)
|
|
1822
|
+
params.domain = opts.domain;
|
|
1823
|
+
printResult(await client.getWordPressSecurity(params), getFormat(parent));
|
|
1824
|
+
});
|
|
1825
|
+
const update = wordpressSecurity.command("update <domain>").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
|
|
1826
|
+
for (const { cli, desc } of UPDATE_OPTIONS) {
|
|
1827
|
+
update.option(`--${cli} <value>`, desc);
|
|
1828
|
+
}
|
|
1829
|
+
update.action(async (domain, opts) => {
|
|
1830
|
+
const data = buildUpdateData2(domain, opts);
|
|
1831
|
+
const client = resolveClient(parent, brand);
|
|
1832
|
+
printResult(await client.updateWordPressSecurity(data), getFormat(parent));
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
// ../core/dist/commands/server/x-accelerator/index.js
|
|
1837
|
+
function registerXAcceleratorCommands(parent, brand) {
|
|
1838
|
+
const xAccelerator = parent.command("x-accelerator").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A");
|
|
1839
|
+
xAccelerator.command("list").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1840
|
+
const client = resolveClient(parent, brand);
|
|
1841
|
+
const params = {};
|
|
1842
|
+
if (opts.domain)
|
|
1843
|
+
params.domain = opts.domain;
|
|
1844
|
+
printResult(await client.listXAccelerator(params), getFormat(parent));
|
|
1845
|
+
});
|
|
1846
|
+
xAccelerator.command("update <domain>").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--xaccelerator-status <status>", "X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\uFF08off / v1 / v2\uFF09").action(async (domain, opts) => {
|
|
1847
|
+
const client = resolveClient(parent, brand);
|
|
1848
|
+
printResult(await client.updateXAccelerator(domain, { xaccelerator_status: opts.xacceleratorStatus }), getFormat(parent));
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
// ../core/dist/commands/server/server-cache/index.js
|
|
1853
|
+
function registerServerCacheCommands(parent, brand) {
|
|
1854
|
+
const serverCache = parent.command("server-cache").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
|
|
1855
|
+
serverCache.command("list").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1856
|
+
const client = resolveClient(parent, brand);
|
|
1857
|
+
const params = {};
|
|
1858
|
+
if (opts.domain)
|
|
1859
|
+
params.domain = opts.domain;
|
|
1860
|
+
printResult(await client.listServerCache(params), getFormat(parent));
|
|
1861
|
+
});
|
|
1862
|
+
serverCache.command("update <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--server-cache-status <status>", "\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08on / off\uFF09").action(async (domain, opts) => {
|
|
1863
|
+
const client = resolveClient(parent, brand);
|
|
1864
|
+
printResult(await client.updateServerCache(domain, { server_cache_status: opts.serverCacheStatus }), getFormat(parent));
|
|
1865
|
+
});
|
|
1866
|
+
serverCache.command("clear-cache <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u306E\u5185\u5BB9\u3092\u524A\u9664\uFF08\u30D1\u30FC\u30B8\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
|
|
1867
|
+
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u5185\u5BB9\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1868
|
+
const client = resolveClient(parent, brand);
|
|
1869
|
+
printResult(await client.clearServerCache(domain), getFormat(parent));
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
// ../core/dist/commands/server/browser-cache/index.js
|
|
1874
|
+
function registerBrowserCacheCommands(parent, brand) {
|
|
1875
|
+
const browserCache = parent.command("browser-cache").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
|
|
1876
|
+
browserCache.command("list").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1877
|
+
const client = resolveClient(parent, brand);
|
|
1878
|
+
const params = {};
|
|
1879
|
+
if (opts.domain)
|
|
1880
|
+
params.domain = opts.domain;
|
|
1881
|
+
printResult(await client.listBrowserCache(params), getFormat(parent));
|
|
1882
|
+
});
|
|
1883
|
+
browserCache.command("update <domain>").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--browser-cache-status <status>", "\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08all / ignore-css-js / off\uFF09").action(async (domain, opts) => {
|
|
1884
|
+
const client = resolveClient(parent, brand);
|
|
1885
|
+
printResult(await client.updateBrowserCache(domain, { browser_cache_status: opts.browserCacheStatus }), getFormat(parent));
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// ../core/dist/commands/server/url-redirect/index.js
|
|
1890
|
+
function registerUrlRedirectCommands(parent, brand) {
|
|
1891
|
+
const urlRedirect = parent.command("url-redirect").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A");
|
|
1892
|
+
urlRedirect.command("list").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1893
|
+
const client = resolveClient(parent, brand);
|
|
1894
|
+
const params = {};
|
|
1895
|
+
if (opts.domain)
|
|
1896
|
+
params.domain = opts.domain;
|
|
1897
|
+
printResult(await client.listUrlRedirect(params), getFormat(parent));
|
|
1898
|
+
});
|
|
1899
|
+
urlRedirect.command("add").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--from-host <host>", "\u8EE2\u9001\u5143\u30DB\u30B9\u30C8\uFF08FQDN\uFF09").option("--from-path <path>", "\u8EE2\u9001\u5143\u30D1\u30B9\uFF08\u7701\u7565\u6642\u306F /\u3002\u5148\u982D\u304C / \u3067\u306A\u3044\u5834\u5408\u306F API \u5074\u3067 / \u3092\u4ED8\u4E0E\uFF09").requiredOption("--redirect-to-url <url>", "\u8EE2\u9001\u5148URL\uFF08http \u307E\u305F\u306F https\uFF09").requiredOption("--status-code <code>", "\u8EE2\u9001\u6642\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u30B3\u30FC\u30C9\uFF08301 / 302\uFF09").action(async (opts) => {
|
|
1900
|
+
const client = resolveClient(parent, brand);
|
|
1901
|
+
const data = {
|
|
1902
|
+
domain: opts.domain,
|
|
1903
|
+
from_host: opts.fromHost,
|
|
1904
|
+
redirect_to_url: opts.redirectToUrl,
|
|
1905
|
+
status_code: Number(opts.statusCode)
|
|
1906
|
+
};
|
|
1907
|
+
if (opts.fromPath !== void 0)
|
|
1908
|
+
data.from_path = opts.fromPath;
|
|
1909
|
+
printResult(await client.addUrlRedirect(data), getFormat(parent));
|
|
1910
|
+
});
|
|
1911
|
+
urlRedirect.command("delete <redirectId>").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (redirectId) => {
|
|
1912
|
+
await confirmDestructiveAction(parent, `\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A "${redirectId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1913
|
+
const client = resolveClient(parent, brand);
|
|
1914
|
+
printResult(await client.deleteUrlRedirect(redirectId), getFormat(parent));
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// ../core/dist/commands/server/access-deny/index.js
|
|
1919
|
+
function registerAccessDenyCommands(parent, brand) {
|
|
1920
|
+
const accessDeny = parent.command("access-deny").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A");
|
|
1921
|
+
accessDeny.command("list").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1922
|
+
const client = resolveClient(parent, brand);
|
|
1923
|
+
const params = {};
|
|
1924
|
+
if (opts.domain)
|
|
1925
|
+
params.domain = opts.domain;
|
|
1926
|
+
printResult(await client.listAccessDeny(params), getFormat(parent));
|
|
1927
|
+
});
|
|
1928
|
+
accessDeny.command("add").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--ip-address <address>", "\u62D2\u5426IP\u30A2\u30C9\u30EC\u30B9\u30FB\u30DB\u30B9\u30C8\uFF08IPv4 / CIDR / \u90E8\u5206IP / \u30DB\u30B9\u30C8\u540D\uFF09").option("--memo <memo>", "\u30E1\u30E2\uFF08\u6700\u5927500\u6587\u5B57\uFF09").action(async (opts) => {
|
|
1929
|
+
const client = resolveClient(parent, brand);
|
|
1930
|
+
const data = {
|
|
1931
|
+
domain: opts.domain,
|
|
1932
|
+
ip_address: opts.ipAddress
|
|
1933
|
+
};
|
|
1934
|
+
if (opts.memo !== void 0)
|
|
1935
|
+
data.memo = opts.memo;
|
|
1936
|
+
printResult(await client.addAccessDeny(data), getFormat(parent));
|
|
1937
|
+
});
|
|
1938
|
+
accessDeny.command("update <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <memo>", "\u30E1\u30E2\uFF08\u7701\u7565\u307E\u305F\u306F\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").action(async (denyId, opts) => {
|
|
1939
|
+
if (opts.memo === void 0) {
|
|
1940
|
+
throw new Error("--memo \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1941
|
+
}
|
|
1942
|
+
const client = resolveClient(parent, brand);
|
|
1943
|
+
printResult(await client.updateAccessDeny(denyId, { memo: opts.memo }), getFormat(parent));
|
|
1944
|
+
});
|
|
1945
|
+
accessDeny.command("delete <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (denyId) => {
|
|
1946
|
+
await confirmDestructiveAction(parent, `\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A "${denyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1947
|
+
const client = resolveClient(parent, brand);
|
|
1948
|
+
printResult(await client.deleteAccessDeny(denyId), getFormat(parent));
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// ../core/dist/commands/server/xpagespeed/index.js
|
|
1953
|
+
var UPDATE_OPTIONS2 = [
|
|
1954
|
+
{ cli: "xoptimize-images", api: "xoptimize_images", label: "\u753B\u50CF\u6700\u9069\u5316", desc: "\u753B\u50CF\u6700\u9069\u5316\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1955
|
+
{ cli: "lazyload-images", api: "lazyload_images", label: "\u753B\u50CF\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F", desc: "\u753B\u50CF\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1956
|
+
{ cli: "xoptimize-css", api: "xoptimize_css", label: "CSS\u6700\u9069\u5316", desc: "CSS\u6700\u9069\u5316\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1957
|
+
{ cli: "lazyload-css", api: "lazyload_css", label: "CSS\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F", desc: "CSS\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1958
|
+
{ cli: "xoptimize-javascript", api: "xoptimize_javascript", label: "JavaScript\u6700\u9069\u5316", desc: "JavaScript\u6700\u9069\u5316\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" },
|
|
1959
|
+
{ cli: "lazyload-javascript", api: "lazyload_javascript", label: "JavaScript\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F", desc: "JavaScript\u9045\u5EF6\u8AAD\u307F\u8FBC\u307F\uFF08true/false \u307E\u305F\u306F 1/0\uFF09" }
|
|
1960
|
+
];
|
|
1961
|
+
function cliOptionToCamelCase2(cli) {
|
|
1962
|
+
return cli.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
1963
|
+
}
|
|
1964
|
+
function parseBooleanParam2(label, value) {
|
|
1965
|
+
const normalized = value.trim().toLowerCase();
|
|
1966
|
+
if (normalized !== "true" && normalized !== "false" && normalized !== "1" && normalized !== "0") {
|
|
1967
|
+
throw new ApiError("\u5165\u529B\u5024\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093", 422, "VALIDATION_ERROR", [`${label}\u306F true/false \u307E\u305F\u306F 1/0 \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`]);
|
|
1968
|
+
}
|
|
1969
|
+
return normalized === "true" || normalized === "1";
|
|
1970
|
+
}
|
|
1971
|
+
function buildUpdateData3(opts) {
|
|
1972
|
+
const data = {};
|
|
1973
|
+
for (const { cli, api, label } of UPDATE_OPTIONS2) {
|
|
1974
|
+
const value = opts[cliOptionToCamelCase2(cli)];
|
|
1975
|
+
if (value !== void 0)
|
|
1976
|
+
data[api] = parseBooleanParam2(label, value);
|
|
1977
|
+
}
|
|
1978
|
+
if (Object.keys(data).length === 0) {
|
|
1979
|
+
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1980
|
+
}
|
|
1981
|
+
if (Object.keys(data).length > 1) {
|
|
1982
|
+
throw new Error("1\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u5909\u66F4\u3067\u304D\u308B\u306E\u306F1\u3064\u306E\u6700\u9069\u5316\u6A5F\u80FD\u306E\u307F\u3067\u3059");
|
|
1983
|
+
}
|
|
1984
|
+
return data;
|
|
1985
|
+
}
|
|
1986
|
+
function registerXPageSpeedCommands(parent, brand) {
|
|
1987
|
+
const xPageSpeed = parent.command("xpagespeed").description("XPageSpeed\u8A2D\u5B9A");
|
|
1988
|
+
xPageSpeed.command("list").description("XPageSpeed\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1989
|
+
const client = resolveClient(parent, brand);
|
|
1990
|
+
const params = {};
|
|
1991
|
+
if (opts.domain)
|
|
1992
|
+
params.domain = opts.domain;
|
|
1993
|
+
printResult(await client.listXPageSpeed(params), getFormat(parent));
|
|
1994
|
+
});
|
|
1995
|
+
const update = xPageSpeed.command("update <domain>").description("XPageSpeed\u306E\u6700\u9069\u5316\u6A5F\u80FD\u3092\u5909\u66F4\uFF081\u30EA\u30AF\u30A8\u30B9\u30C8\u30671\u6A5F\u80FD\u306E\u307F\uFF09");
|
|
1996
|
+
for (const { cli, desc } of UPDATE_OPTIONS2) {
|
|
1997
|
+
update.option(`--${cli} <value>`, desc);
|
|
1998
|
+
}
|
|
1999
|
+
update.action(async (domain, opts) => {
|
|
2000
|
+
const data = buildUpdateData3(opts);
|
|
2001
|
+
const client = resolveClient(parent, brand);
|
|
2002
|
+
printResult(await client.updateXPageSpeed(domain, data), getFormat(parent));
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
// ../core/dist/commands/server/auto-backup/index.js
|
|
2007
|
+
var DOMAIN_ELEMENT_TYPES = ["web", "setting", "mail"];
|
|
2008
|
+
function validationError(...errors) {
|
|
2009
|
+
throw new ApiError("\u5165\u529B\u5024\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093", 422, "VALIDATION_ERROR", errors);
|
|
2010
|
+
}
|
|
2011
|
+
function collectFlagValue(value, previous) {
|
|
2012
|
+
return previous.concat([value]);
|
|
2013
|
+
}
|
|
2014
|
+
function parseDomainElementEntry(part) {
|
|
2015
|
+
const equalIndex = part.indexOf("=");
|
|
2016
|
+
if (equalIndex === -1) {
|
|
2017
|
+
validationError("domain_elements \u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002example.com=web,setting \u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
2018
|
+
}
|
|
2019
|
+
const domain = part.slice(0, equalIndex).trim();
|
|
2020
|
+
const elementsRaw = part.slice(equalIndex + 1).trim();
|
|
2021
|
+
if (domain === "" || elementsRaw === "") {
|
|
2022
|
+
validationError("domain_elements \u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002example.com=web,setting \u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
2023
|
+
}
|
|
2024
|
+
const elements = elementsRaw.split(",").map((e) => e.trim()).filter((e) => e !== "");
|
|
2025
|
+
if (elements.length === 0) {
|
|
2026
|
+
validationError(`domain_elements \u306E ${domain} \u306B elements\uFF08${DOMAIN_ELEMENT_TYPES.join(", ")}\uFF09\u30921\u4EF6\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
2027
|
+
}
|
|
2028
|
+
return { domain, elements };
|
|
2029
|
+
}
|
|
2030
|
+
function parseDomainElements(values) {
|
|
2031
|
+
if (values.length === 0) {
|
|
2032
|
+
validationError("scope \u304C selected \u306E\u5834\u5408\u3001domain_elements \u30921\u4EF6\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
2033
|
+
}
|
|
2034
|
+
return values.map((value) => parseDomainElementEntry(value.trim()));
|
|
2035
|
+
}
|
|
2036
|
+
function registerAutoBackupCommands(parent, brand) {
|
|
2037
|
+
const autoBackup = parent.command("auto-backup").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
|
|
2038
|
+
autoBackup.command("backup-dates").description("\u9078\u629E\u53EF\u80FD\u306A\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2039
|
+
const client = resolveClient(parent, brand);
|
|
2040
|
+
printResult(await client.listAutoBackupBackupDates(), getFormat(parent));
|
|
2041
|
+
});
|
|
2042
|
+
autoBackup.command("list").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2043
|
+
const client = resolveClient(parent, brand);
|
|
2044
|
+
printResult(await client.listAutoBackup(), getFormat(parent));
|
|
2045
|
+
});
|
|
2046
|
+
autoBackup.command("show <requestId>").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
|
|
2047
|
+
const client = resolveClient(parent, brand);
|
|
2048
|
+
printResult(await client.getAutoBackup(requestId), getFormat(parent));
|
|
2049
|
+
});
|
|
2050
|
+
autoBackup.command("create").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").requiredOption("--scope <scope>", "\u51E6\u7406\u65B9\u6CD5\uFF08all / selected\uFF09").option("--domain-elements <value>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\uFF08scope=selected \u306E\u3068\u304D\u5FC5\u9808\u3002\u7E70\u308A\u8FD4\u3057\u53EF\uFF09\u3002\u5F62\u5F0F: example.com=web,setting\uFF08elements: web / setting / mail\uFF09", collectFlagValue, []).option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
|
|
2051
|
+
const operationType = opts.operationType;
|
|
2052
|
+
const scope = opts.scope;
|
|
2053
|
+
if (operationType === "restore") {
|
|
2054
|
+
await confirmDestructiveAction(parent, "\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u307F\u307E\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u4E0A\u306E\u30C7\u30FC\u30BF\u304C\u4E0A\u66F8\u304D\u3055\u308C\u3001\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F");
|
|
2055
|
+
}
|
|
2056
|
+
const data = {
|
|
2057
|
+
backup_date: opts.backupDate,
|
|
2058
|
+
operation_type: operationType,
|
|
2059
|
+
scope
|
|
2060
|
+
};
|
|
2061
|
+
const domainElementValues = opts.domainElements;
|
|
2062
|
+
if (scope === "selected") {
|
|
2063
|
+
if (domainElementValues.length === 0) {
|
|
2064
|
+
validationError("scope \u304C selected \u306E\u5834\u5408\u3001--domain-elements \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
2065
|
+
}
|
|
2066
|
+
data.domain_elements = parseDomainElements(domainElementValues);
|
|
2067
|
+
} else if (domainElementValues.length > 0) {
|
|
2068
|
+
validationError("\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F \u51E6\u7406\u65B9\u6CD5 \u304C selected \u306E\u5834\u5408\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002");
|
|
2069
|
+
}
|
|
2070
|
+
const client = resolveClient(parent, brand);
|
|
2071
|
+
printResult(await client.createAutoBackup(data), getFormat(parent));
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
// ../core/dist/commands/server/mysql-backup/index.js
|
|
2076
|
+
function registerMysqlBackupCommands(parent, brand) {
|
|
2077
|
+
const mysqlBackup = parent.command("mysql-backup").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
|
|
2078
|
+
mysqlBackup.command("databases").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async () => {
|
|
2079
|
+
const client = resolveClient(parent, brand);
|
|
2080
|
+
printResult(await client.listMysqlBackupDatabases(), getFormat(parent));
|
|
2081
|
+
});
|
|
2082
|
+
mysqlBackup.command("list").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2083
|
+
const client = resolveClient(parent, brand);
|
|
2084
|
+
printResult(await client.listMysqlBackup(), getFormat(parent));
|
|
2085
|
+
});
|
|
2086
|
+
mysqlBackup.command("show <requestId>").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
|
|
2087
|
+
const client = resolveClient(parent, brand);
|
|
2088
|
+
printResult(await client.getMysqlBackup(requestId), getFormat(parent));
|
|
2089
|
+
});
|
|
2090
|
+
mysqlBackup.command("create").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--db-name <name>", "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
|
|
2091
|
+
const operationType = opts.operationType;
|
|
2092
|
+
if (operationType === "restore") {
|
|
2093
|
+
await confirmDestructiveAction(parent, `\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${opts.dbName}" \u306E MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u307F\u307E\u3059\u3002\u5BFE\u8C61 DB \u304C\u4E0A\u66F8\u304D\u3055\u308C\u3001\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
2094
|
+
}
|
|
2095
|
+
const client = resolveClient(parent, brand);
|
|
2096
|
+
printResult(await client.createMysqlBackup({
|
|
2097
|
+
db_name: opts.dbName,
|
|
2098
|
+
backup_date: opts.backupDate,
|
|
2099
|
+
operation_type: operationType
|
|
2100
|
+
}), getFormat(parent));
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
|
|
1458
2104
|
// ../core/dist/commands/me/index.js
|
|
1459
2105
|
function registerMeCommand(program, brand) {
|
|
1460
2106
|
program.command("me").description("\u73FE\u5728\u306EAPI\u30AD\u30FC\u60C5\u5831\u3092\u8868\u793A").action(async (_opts, cmd) => {
|
|
@@ -1508,6 +2154,18 @@ function run(brand, version = "0.0.0") {
|
|
|
1508
2154
|
registerSslCommands(server, brand);
|
|
1509
2155
|
registerDnsCommands(server, brand);
|
|
1510
2156
|
registerLogCommands(server, brand);
|
|
2157
|
+
registerResourceMonitorCommands(server, brand);
|
|
2158
|
+
registerWafCommands(server, brand);
|
|
2159
|
+
registerPhpIniCommands(server, brand);
|
|
2160
|
+
registerWordPressSecurityCommands(server, brand);
|
|
2161
|
+
registerXAcceleratorCommands(server, brand);
|
|
2162
|
+
registerServerCacheCommands(server, brand);
|
|
2163
|
+
registerBrowserCacheCommands(server, brand);
|
|
2164
|
+
registerUrlRedirectCommands(server, brand);
|
|
2165
|
+
registerAccessDenyCommands(server, brand);
|
|
2166
|
+
registerXPageSpeedCommands(server, brand);
|
|
2167
|
+
registerAutoBackupCommands(server, brand);
|
|
2168
|
+
registerMysqlBackupCommands(server, brand);
|
|
1511
2169
|
program.parseAsync(process.argv).catch((err) => {
|
|
1512
2170
|
if (err instanceof ApiError) {
|
|
1513
2171
|
console.error(`\u30A8\u30E9\u30FC [${err.errorCode}]: ${err.message}`);
|
|
@@ -1530,7 +2188,7 @@ function run(brand, version = "0.0.0") {
|
|
|
1530
2188
|
// package.json
|
|
1531
2189
|
var package_default = {
|
|
1532
2190
|
name: "star8-cli",
|
|
1533
|
-
version: "1.1
|
|
2191
|
+
version: "1.2.1",
|
|
1534
2192
|
description: "Official CLI for Star8 API \u2014 manage your Star8 hosting from the terminal",
|
|
1535
2193
|
type: "module",
|
|
1536
2194
|
bin: {
|