antenna-fyi 1.3.32 → 1.3.34
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/lib/cli.js +16 -5
- package/lib/core.js +5 -7
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function handleScan(f) {
|
|
|
67
67
|
export async function handleProfile(f) {
|
|
68
68
|
const id = resolveId(f);
|
|
69
69
|
if (!id) return console.error("Usage: antenna profile --id <platform>:<user_id> [--name Yi --personal-description '...' --looking-for '...' --conversation-style '...' --hide --visible true]");
|
|
70
|
-
if (f.name || f["personal-description"] !== undefined || f.line1 !== undefined || f["looking-for"] !== undefined || f.line2 !== undefined || f["conversation-style"] !== undefined || f.line3 !== undefined || f["more-information"] !== undefined || f.contact !== undefined || f.visible !== undefined || f.hide !== undefined) {
|
|
70
|
+
if (f.name || f["personal-description"] !== undefined || f.line1 !== undefined || f["looking-for"] !== undefined || f.line2 !== undefined || f["conversation-style"] !== undefined || f.line3 !== undefined || f["more-information"] !== undefined || f.contact !== undefined || f.slug !== undefined || f.visible !== undefined || f.hide !== undefined) {
|
|
71
71
|
const visible = f.hide ? false : (f.visible !== undefined ? f.visible === 'true' || f.visible === true : undefined);
|
|
72
72
|
const payload = { device_id: id };
|
|
73
73
|
if (f.name) payload.display_name = f.name;
|
|
@@ -79,10 +79,24 @@ export async function handleProfile(f) {
|
|
|
79
79
|
else if (f.line3 !== undefined) payload.line3 = f.line3;
|
|
80
80
|
if (f["more-information"] !== undefined) payload.matching_context = f["more-information"];
|
|
81
81
|
if (f.contact !== undefined) payload.contact_info = f.contact;
|
|
82
|
+
if (f.slug !== undefined) payload.profile_slug = f.slug;
|
|
82
83
|
if (visible !== undefined) payload.visible = visible;
|
|
83
84
|
const data = await setProfile(payload);
|
|
85
|
+
if (data?.error) {
|
|
86
|
+
console.error("❌ " + data.error);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
84
89
|
console.log("✅ Profile saved");
|
|
85
|
-
console.log(
|
|
90
|
+
if (data?.display_name) console.log(` ${data.display_name}`);
|
|
91
|
+
if (data?.personal_description) console.log(` ${data.personal_description}`);
|
|
92
|
+
if (data?.looking_for) console.log(` Looking for: ${data.looking_for}`);
|
|
93
|
+
if (data?.conversation_style) console.log(` Conversation: ${data.conversation_style}`);
|
|
94
|
+
if (data?.contact_info) console.log(` 📇 Contact: ${data.contact_info}`);
|
|
95
|
+
if (data?.public_url) console.log(` 🔗 ${data.public_url}`);
|
|
96
|
+
else if (data?.profile_slug) console.log(` 🔗 https://www.antenna.fyi/p/${data.profile_slug}`);
|
|
97
|
+
if (data?.warnings?.length) {
|
|
98
|
+
for (const w of data.warnings) console.log(` ⚠️ ${w}`);
|
|
99
|
+
}
|
|
86
100
|
} else {
|
|
87
101
|
const data = await getProfile({ device_id: id });
|
|
88
102
|
if (!data) return console.log("No profile yet. Create one with --name and --personal-description");
|
|
@@ -90,9 +104,6 @@ export async function handleProfile(f) {
|
|
|
90
104
|
if (data.personal_description) console.log(` ${data.personal_description}`);
|
|
91
105
|
if (data.looking_for) console.log(` Looking for: ${data.looking_for}`);
|
|
92
106
|
if (data.conversation_style) console.log(` Conversation: ${data.conversation_style}`);
|
|
93
|
-
if (data.line1 && data.line1 !== data.personal_description) console.log(` Line 1: ${data.line1}`);
|
|
94
|
-
if (data.line2 && data.line2 !== data.looking_for) console.log(` Line 2: ${data.line2}`);
|
|
95
|
-
if (data.line3 && data.line3 !== data.conversation_style) console.log(` Line 3: ${data.line3}`);
|
|
96
107
|
if (data.interest_tags?.length) console.log(` Tags: ${data.interest_tags.join(", ")}`);
|
|
97
108
|
if (data.city) console.log(` 📍 ${data.city}`);
|
|
98
109
|
if (data.contact_info) console.log(` 📇 Contact: ${data.contact_info}`);
|
package/lib/core.js
CHANGED
|
@@ -332,13 +332,11 @@ export async function setProfile({
|
|
|
332
332
|
try {
|
|
333
333
|
const profile = await getProfile({ device_id, supabaseUrl, supabaseKey });
|
|
334
334
|
profileSlug = profile?.profile_slug || null;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
profileSlug = slug;
|
|
341
|
-
}
|
|
335
|
+
// Use explicitly passed slug, or auto-generate from display_name
|
|
336
|
+
const targetSlug = profile_slug || (!profileSlug && display_name ? display_name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").substring(0, 30) : null);
|
|
337
|
+
if (targetSlug && targetSlug !== profileSlug) {
|
|
338
|
+
const { data: slugResult } = await sb.rpc("set_profile_slug", { p_device_id: device_id, p_slug: targetSlug });
|
|
339
|
+
if (slugResult?.set) profileSlug = targetSlug;
|
|
342
340
|
}
|
|
343
341
|
if (profileSlug) {
|
|
344
342
|
publicUrl = `https://www.antenna.fyi/p/${profileSlug}`;
|