lovieme 0.1.0 → 0.1.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/client.d.ts +4 -5
- package/dist/client.js +12 -4
- package/dist/config.d.ts +7 -7
- package/dist/config.js +40 -40
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/ui.d.ts +17 -17
- package/dist/ui.js +38 -38
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -77,12 +77,11 @@ export declare class CliClient {
|
|
|
77
77
|
presets: Array<{
|
|
78
78
|
id: string;
|
|
79
79
|
name: string;
|
|
80
|
+
category?: string;
|
|
80
81
|
description: string;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
content: string;
|
|
85
|
-
}>;
|
|
82
|
+
requiresCustomInput?: boolean;
|
|
83
|
+
inputLabel?: string;
|
|
84
|
+
documentationUrl?: string;
|
|
86
85
|
}>;
|
|
87
86
|
}>;
|
|
88
87
|
applyPreset(subdomain: string, preset: string, customTarget?: string): Promise<{
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import dns from "node:dns";
|
|
1
2
|
import { getConfig } from "./config.js";
|
|
3
|
+
try {
|
|
4
|
+
dns.setDefaultResultOrder?.("ipv4first");
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
// Ignore in environments where setDefaultResultOrder is unsupported
|
|
8
|
+
}
|
|
2
9
|
export class CliClient {
|
|
3
10
|
baseUrl;
|
|
4
11
|
apiKey;
|
|
@@ -11,7 +18,7 @@ export class CliClient {
|
|
|
11
18
|
const url = `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
|
|
12
19
|
const headers = {
|
|
13
20
|
"Content-Type": "application/json",
|
|
14
|
-
"User-Agent": "LovieMe-CLI/0.1.
|
|
21
|
+
"User-Agent": "LovieMe-CLI/0.1.1",
|
|
15
22
|
...(options.headers || {}),
|
|
16
23
|
};
|
|
17
24
|
if (this.apiKey) {
|
|
@@ -80,11 +87,12 @@ export class CliClient {
|
|
|
80
87
|
});
|
|
81
88
|
}
|
|
82
89
|
async verifyDoH(domain, type = "A") {
|
|
83
|
-
const
|
|
90
|
+
const clean = domain.trim().toLowerCase();
|
|
91
|
+
const fqdn = clean === "lovie.me" || clean.endsWith(".lovie.me") ? clean : `${clean}.lovie.me`;
|
|
84
92
|
const resolvers = [
|
|
85
93
|
{ name: "Google Public DNS", url: `https://dns.google/resolve?name=${encodeURIComponent(fqdn)}&type=${type}` },
|
|
86
|
-
{ name: "Cloudflare 1.1.1.1", url: `https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(fqdn)}&type=${type}` },
|
|
87
|
-
{ name: "
|
|
94
|
+
{ name: "Cloudflare (1.1.1.1)", url: `https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(fqdn)}&type=${type}` },
|
|
95
|
+
{ name: "AliDNS Global", url: `https://dns.alidns.com/resolve?name=${encodeURIComponent(fqdn)}&type=${type}` },
|
|
88
96
|
];
|
|
89
97
|
const settled = await Promise.allSettled(resolvers.map(async (r) => {
|
|
90
98
|
const start = Date.now();
|
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface LovieMeConfig {
|
|
2
|
-
apiKey?: string;
|
|
3
|
-
apiUrl?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function getConfig(): LovieMeConfig;
|
|
6
|
-
export declare function saveApiKey(key: string, url?: string): void;
|
|
7
|
-
export declare function clearConfig(): void;
|
|
1
|
+
export interface LovieMeConfig {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
apiUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function getConfig(): LovieMeConfig;
|
|
6
|
+
export declare function saveApiKey(key: string, url?: string): void;
|
|
7
|
+
export declare function clearConfig(): void;
|
package/dist/config.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import * as os from "node:os";
|
|
4
|
-
const CONFIG_DIR = path.join(os.homedir(), ".lovieme");
|
|
5
|
-
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
6
|
-
export function getConfig() {
|
|
7
|
-
const envKey = process.env.LOVIE_API_KEY;
|
|
8
|
-
const envUrl = process.env.LOVIE_API_URL;
|
|
9
|
-
let fileConfig = {};
|
|
10
|
-
if (fs.existsSync(CONFIG_FILE)) {
|
|
11
|
-
try {
|
|
12
|
-
const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
13
|
-
fileConfig = JSON.parse(raw);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
// Ignore corrupted config
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
apiKey: envKey || fileConfig.apiKey || "",
|
|
21
|
-
apiUrl: envUrl || fileConfig.apiUrl || "https://www.lovie.me",
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export function saveApiKey(key, url) {
|
|
25
|
-
if (!fs.existsSync(CONFIG_DIR)) {
|
|
26
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
const existing = getConfig();
|
|
29
|
-
const nextConfig = {
|
|
30
|
-
...existing,
|
|
31
|
-
apiKey: key.trim(),
|
|
32
|
-
apiUrl: url || existing.apiUrl || "https://www.lovie.me",
|
|
33
|
-
};
|
|
34
|
-
fs.writeFileSync(CONFIG_FILE, JSON.stringify(nextConfig, null, 2), "utf-8");
|
|
35
|
-
}
|
|
36
|
-
export function clearConfig() {
|
|
37
|
-
if (fs.existsSync(CONFIG_FILE)) {
|
|
38
|
-
fs.unlinkSync(CONFIG_FILE);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
const CONFIG_DIR = path.join(os.homedir(), ".lovieme");
|
|
5
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
6
|
+
export function getConfig() {
|
|
7
|
+
const envKey = process.env.LOVIE_API_KEY;
|
|
8
|
+
const envUrl = process.env.LOVIE_API_URL;
|
|
9
|
+
let fileConfig = {};
|
|
10
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
11
|
+
try {
|
|
12
|
+
const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
13
|
+
fileConfig = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Ignore corrupted config
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
apiKey: envKey || fileConfig.apiKey || "",
|
|
21
|
+
apiUrl: envUrl || fileConfig.apiUrl || "https://www.lovie.me",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function saveApiKey(key, url) {
|
|
25
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
26
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
const existing = getConfig();
|
|
29
|
+
const nextConfig = {
|
|
30
|
+
...existing,
|
|
31
|
+
apiKey: key.trim(),
|
|
32
|
+
apiUrl: url || existing.apiUrl || "https://www.lovie.me",
|
|
33
|
+
};
|
|
34
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(nextConfig, null, 2), "utf-8");
|
|
35
|
+
}
|
|
36
|
+
export function clearConfig() {
|
|
37
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
38
|
+
fs.unlinkSync(CONFIG_FILE);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { CliClient } from "./client.js";
|
|
3
|
-
export declare function createProgram(client?: CliClient): Command;
|
|
4
|
-
export declare function main(): Promise<void>;
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { CliClient } from "./client.js";
|
|
3
|
+
export declare function createProgram(client?: CliClient): Command;
|
|
4
|
+
export declare function main(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export function createProgram(client) {
|
|
|
8
8
|
program
|
|
9
9
|
.name("lovieme")
|
|
10
10
|
.description("Official CLI for LovieMe — Developer & AI-Agent Custom Subdomains & Anycast DNS Cloud")
|
|
11
|
-
.version("0.1.
|
|
11
|
+
.version("0.1.1");
|
|
12
12
|
// 1. Auth: login / logout / whoami
|
|
13
13
|
program
|
|
14
14
|
.command("login")
|
|
@@ -188,12 +188,12 @@ export function createProgram(client) {
|
|
|
188
188
|
.action(async () => {
|
|
189
189
|
try {
|
|
190
190
|
const { presets: list } = await cli.listPresets();
|
|
191
|
-
const headers = ["ID", "PLATFORM", "
|
|
191
|
+
const headers = ["ID", "PLATFORM", "CATEGORY", "DESCRIPTION"];
|
|
192
192
|
const rows = list.map((p) => [
|
|
193
193
|
p.id,
|
|
194
194
|
p.name,
|
|
195
|
+
p.category || "cloud",
|
|
195
196
|
p.description,
|
|
196
|
-
p.records.map((r) => `${r.type} ${r.content}`).join("; "),
|
|
197
197
|
]);
|
|
198
198
|
console.log(`\n${formatTable(headers, rows)}\n`);
|
|
199
199
|
}
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export declare const colors: {
|
|
2
|
-
reset: string;
|
|
3
|
-
bold: string;
|
|
4
|
-
dim: string;
|
|
5
|
-
green: string;
|
|
6
|
-
yellow: string;
|
|
7
|
-
blue: string;
|
|
8
|
-
magenta: string;
|
|
9
|
-
cyan: string;
|
|
10
|
-
red: string;
|
|
11
|
-
white: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function logSuccess(msg: string): void;
|
|
14
|
-
export declare function logInfo(msg: string): void;
|
|
15
|
-
export declare function logWarn(msg: string): void;
|
|
16
|
-
export declare function logError(msg: string): void;
|
|
17
|
-
export declare function formatTable(headers: string[], rows: string[][]): string;
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
reset: string;
|
|
3
|
+
bold: string;
|
|
4
|
+
dim: string;
|
|
5
|
+
green: string;
|
|
6
|
+
yellow: string;
|
|
7
|
+
blue: string;
|
|
8
|
+
magenta: string;
|
|
9
|
+
cyan: string;
|
|
10
|
+
red: string;
|
|
11
|
+
white: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function logSuccess(msg: string): void;
|
|
14
|
+
export declare function logInfo(msg: string): void;
|
|
15
|
+
export declare function logWarn(msg: string): void;
|
|
16
|
+
export declare function logError(msg: string): void;
|
|
17
|
+
export declare function formatTable(headers: string[], rows: string[][]): string;
|
package/dist/ui.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
export const colors = {
|
|
2
|
-
reset: "\x1b[0m",
|
|
3
|
-
bold: "\x1b[1m",
|
|
4
|
-
dim: "\x1b[2m",
|
|
5
|
-
green: "\x1b[32m",
|
|
6
|
-
yellow: "\x1b[33m",
|
|
7
|
-
blue: "\x1b[34m",
|
|
8
|
-
magenta: "\x1b[35m",
|
|
9
|
-
cyan: "\x1b[36m",
|
|
10
|
-
red: "\x1b[31m",
|
|
11
|
-
white: "\x1b[37m",
|
|
12
|
-
};
|
|
13
|
-
export function logSuccess(msg) {
|
|
14
|
-
console.log(`${colors.green}✔${colors.reset} ${msg}`);
|
|
15
|
-
}
|
|
16
|
-
export function logInfo(msg) {
|
|
17
|
-
console.log(`${colors.cyan}ℹ${colors.reset} ${msg}`);
|
|
18
|
-
}
|
|
19
|
-
export function logWarn(msg) {
|
|
20
|
-
console.log(`${colors.yellow}⚠${colors.reset} ${msg}`);
|
|
21
|
-
}
|
|
22
|
-
export function logError(msg) {
|
|
23
|
-
console.error(`${colors.red}✖${colors.reset} ${msg}`);
|
|
24
|
-
}
|
|
25
|
-
export function formatTable(headers, rows) {
|
|
26
|
-
const colWidths = headers.map((h, i) => {
|
|
27
|
-
const maxRowLen = rows.reduce((max, row) => Math.max(max, (row[i] || "").length), 0);
|
|
28
|
-
return Math.max(h.length, maxRowLen);
|
|
29
|
-
});
|
|
30
|
-
const headerLine = headers.map((h, i) => h.padEnd(colWidths[i])).join(" ");
|
|
31
|
-
const separator = colWidths.map((w) => "─".repeat(w)).join(" ");
|
|
32
|
-
const rowLines = rows.map((row) => row.map((cell, i) => (cell || "").padEnd(colWidths[i])).join(" "));
|
|
33
|
-
return [
|
|
34
|
-
`${colors.bold}${headerLine}${colors.reset}`,
|
|
35
|
-
`${colors.dim}${separator}${colors.reset}`,
|
|
36
|
-
...rowLines,
|
|
37
|
-
].join("\n");
|
|
38
|
-
}
|
|
1
|
+
export const colors = {
|
|
2
|
+
reset: "\x1b[0m",
|
|
3
|
+
bold: "\x1b[1m",
|
|
4
|
+
dim: "\x1b[2m",
|
|
5
|
+
green: "\x1b[32m",
|
|
6
|
+
yellow: "\x1b[33m",
|
|
7
|
+
blue: "\x1b[34m",
|
|
8
|
+
magenta: "\x1b[35m",
|
|
9
|
+
cyan: "\x1b[36m",
|
|
10
|
+
red: "\x1b[31m",
|
|
11
|
+
white: "\x1b[37m",
|
|
12
|
+
};
|
|
13
|
+
export function logSuccess(msg) {
|
|
14
|
+
console.log(`${colors.green}✔${colors.reset} ${msg}`);
|
|
15
|
+
}
|
|
16
|
+
export function logInfo(msg) {
|
|
17
|
+
console.log(`${colors.cyan}ℹ${colors.reset} ${msg}`);
|
|
18
|
+
}
|
|
19
|
+
export function logWarn(msg) {
|
|
20
|
+
console.log(`${colors.yellow}⚠${colors.reset} ${msg}`);
|
|
21
|
+
}
|
|
22
|
+
export function logError(msg) {
|
|
23
|
+
console.error(`${colors.red}✖${colors.reset} ${msg}`);
|
|
24
|
+
}
|
|
25
|
+
export function formatTable(headers, rows) {
|
|
26
|
+
const colWidths = headers.map((h, i) => {
|
|
27
|
+
const maxRowLen = rows.reduce((max, row) => Math.max(max, (row[i] || "").length), 0);
|
|
28
|
+
return Math.max(h.length, maxRowLen);
|
|
29
|
+
});
|
|
30
|
+
const headerLine = headers.map((h, i) => h.padEnd(colWidths[i])).join(" ");
|
|
31
|
+
const separator = colWidths.map((w) => "─".repeat(w)).join(" ");
|
|
32
|
+
const rowLines = rows.map((row) => row.map((cell, i) => (cell || "").padEnd(colWidths[i])).join(" "));
|
|
33
|
+
return [
|
|
34
|
+
`${colors.bold}${headerLine}${colors.reset}`,
|
|
35
|
+
`${colors.dim}${separator}${colors.reset}`,
|
|
36
|
+
...rowLines,
|
|
37
|
+
].join("\n");
|
|
38
|
+
}
|
package/package.json
CHANGED