antenna-fyi 1.3.30 → 1.3.31
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 +11 -1
- package/lib/core.js +15 -2
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -67,14 +67,18 @@ 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"] || f["looking-for"] || f["conversation-style"] || f["more-information"] || 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.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;
|
|
74
74
|
if (f["personal-description"] !== undefined) payload.line1 = f["personal-description"];
|
|
75
|
+
else if (f.line1 !== undefined) payload.line1 = f.line1;
|
|
75
76
|
if (f["looking-for"] !== undefined) payload.line2 = f["looking-for"];
|
|
77
|
+
else if (f.line2 !== undefined) payload.line2 = f.line2;
|
|
76
78
|
if (f["conversation-style"] !== undefined) payload.line3 = f["conversation-style"];
|
|
79
|
+
else if (f.line3 !== undefined) payload.line3 = f.line3;
|
|
77
80
|
if (f["more-information"] !== undefined) payload.matching_context = f["more-information"];
|
|
81
|
+
if (f.contact !== undefined) payload.contact_info = f.contact;
|
|
78
82
|
if (visible !== undefined) payload.visible = visible;
|
|
79
83
|
const data = await setProfile(payload);
|
|
80
84
|
console.log("✅ Profile saved");
|
|
@@ -86,8 +90,14 @@ export async function handleProfile(f) {
|
|
|
86
90
|
if (data.personal_description) console.log(` ${data.personal_description}`);
|
|
87
91
|
if (data.looking_for) console.log(` Looking for: ${data.looking_for}`);
|
|
88
92
|
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}`);
|
|
89
96
|
if (data.interest_tags?.length) console.log(` Tags: ${data.interest_tags.join(", ")}`);
|
|
90
97
|
if (data.city) console.log(` 📍 ${data.city}`);
|
|
98
|
+
if (data.contact_info) console.log(` 📇 Contact: ${data.contact_info}`);
|
|
99
|
+
if (data.profile_slug) console.log(` 🔗 https://www.antenna.fyi/p/${data.profile_slug}`);
|
|
100
|
+
console.log(` Status: ${data.visible === false ? "hidden" : "visible"}`);
|
|
91
101
|
if (data.context) console.log(` More information: ${data.context}`);
|
|
92
102
|
}
|
|
93
103
|
}
|
package/lib/core.js
CHANGED
|
@@ -250,6 +250,7 @@ export async function setProfile({
|
|
|
250
250
|
line2,
|
|
251
251
|
line3,
|
|
252
252
|
matching_context,
|
|
253
|
+
contact_info,
|
|
253
254
|
visible = true,
|
|
254
255
|
interest_tags,
|
|
255
256
|
city,
|
|
@@ -301,6 +302,7 @@ export async function setProfile({
|
|
|
301
302
|
p_line3: line3 || null,
|
|
302
303
|
p_visible: visible,
|
|
303
304
|
p_matching_context: contextJson || null,
|
|
305
|
+
p_contact_info: contact_info || null,
|
|
304
306
|
});
|
|
305
307
|
if (error) throw new Error(error.message);
|
|
306
308
|
|
|
@@ -326,10 +328,20 @@ export async function setProfile({
|
|
|
326
328
|
let publicUrl = null;
|
|
327
329
|
let bindUrl = null;
|
|
328
330
|
let archetypeResult = null;
|
|
331
|
+
let profileSlug = null;
|
|
329
332
|
try {
|
|
330
333
|
const profile = await getProfile({ device_id, supabaseUrl, supabaseKey });
|
|
331
|
-
|
|
332
|
-
|
|
334
|
+
profileSlug = profile?.profile_slug || null;
|
|
335
|
+
if (!profileSlug && display_name) {
|
|
336
|
+
const slug = display_name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").substring(0, 30);
|
|
337
|
+
if (slug) {
|
|
338
|
+
const { error: slugError } = await sb.from("profiles").update({ profile_slug: slug }).eq("device_id", device_id);
|
|
339
|
+
if (slugError) throw new Error(slugError.message);
|
|
340
|
+
profileSlug = slug;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (profileSlug) {
|
|
344
|
+
publicUrl = `https://www.antenna.fyi/p/${profileSlug}`;
|
|
333
345
|
}
|
|
334
346
|
} catch {}
|
|
335
347
|
|
|
@@ -386,6 +398,7 @@ export async function setProfile({
|
|
|
386
398
|
|
|
387
399
|
return {
|
|
388
400
|
...data,
|
|
401
|
+
profile_slug: profileSlug || data?.profile_slug || null,
|
|
389
402
|
public_url: publicUrl,
|
|
390
403
|
gps_bind_url: bindUrl,
|
|
391
404
|
archetype: archetypeResult || null,
|