antenna-fyi 1.3.33 → 1.3.35
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 +4 -3
- package/lib/core.js +11 -7
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -66,8 +66,8 @@ export async function handleScan(f) {
|
|
|
66
66
|
|
|
67
67
|
export async function handleProfile(f) {
|
|
68
68
|
const id = resolveId(f);
|
|
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) {
|
|
69
|
+
if (!id) return console.error("Usage: antenna profile --id <platform>:<user_id> [--name Yi --personal-description '...' --looking-for '...' --conversation-style '...' --more-information '...' --contact 'WeChat: yi' --slug mira --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.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,6 +79,7 @@ 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);
|
|
84
85
|
if (data?.error) {
|
|
@@ -1074,7 +1075,7 @@ export function printHelp() {
|
|
|
1074
1075
|
Usage:
|
|
1075
1076
|
antenna scan --lat 39.99 --lng 116.48 [--radius 500] (max 1000) [--id <platform>:<user_id>]
|
|
1076
1077
|
antenna checkin --id <platform>:<user_id> --lat 39.99 --lng 116.48
|
|
1077
|
-
antenna profile --id <platform>:<user_id> [--name Yi --personal-description '...' --looking-for '...' --conversation-style '...' --contact 'WeChat: yi' --hide --visible true]
|
|
1078
|
+
antenna profile --id <platform>:<user_id> [--name Yi --personal-description '...' --looking-for '...' --conversation-style '...' --more-information '...' --contact 'WeChat: yi' --slug mira --hide --visible true]
|
|
1078
1079
|
antenna accept --id <platform>:<user_id> --target <ref_or_device_id> [--contact 'WeChat: yi']
|
|
1079
1080
|
antenna pass --id <platform>:<user_id> --target <ref_or_device_id> (or --ref 1)
|
|
1080
1081
|
antenna matches --id <platform>:<user_id>
|
package/lib/core.js
CHANGED
|
@@ -265,7 +265,8 @@ export async function setProfile({
|
|
|
265
265
|
|
|
266
266
|
// Pack structured fields into matching_context JSON
|
|
267
267
|
let contextJson = matching_context;
|
|
268
|
-
|
|
268
|
+
const needsContextPack = matching_context || interest_tags || city || links || is_active !== undefined || archetype_override !== undefined || (line1 && !matching_context) || (line2 && !matching_context) || (line3 && !matching_context);
|
|
269
|
+
if (needsContextPack) {
|
|
269
270
|
// Read existing context from DB to merge
|
|
270
271
|
let existing = {};
|
|
271
272
|
try {
|
|
@@ -284,6 +285,10 @@ export async function setProfile({
|
|
|
284
285
|
existing.context = matching_context;
|
|
285
286
|
}
|
|
286
287
|
}
|
|
288
|
+
// If no explicit context but lines are being set, auto-generate context from lines
|
|
289
|
+
if (!matching_context && !existing.context && (line1 || line2 || line3)) {
|
|
290
|
+
existing.context = [line1, line2, line3].filter(Boolean).join(". ");
|
|
291
|
+
}
|
|
287
292
|
if (interest_tags) existing.interestTags = interest_tags;
|
|
288
293
|
if (city) existing.city = city;
|
|
289
294
|
if (links) existing.links = links;
|
|
@@ -332,12 +337,11 @@ export async function setProfile({
|
|
|
332
337
|
try {
|
|
333
338
|
const profile = await getProfile({ device_id, supabaseUrl, supabaseKey });
|
|
334
339
|
profileSlug = profile?.profile_slug || null;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
340
|
+
// Use explicitly passed slug, or auto-generate from display_name
|
|
341
|
+
const targetSlug = profile_slug || (!profileSlug && display_name ? display_name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").substring(0, 30) : null);
|
|
342
|
+
if (targetSlug && targetSlug !== profileSlug) {
|
|
343
|
+
const { data: slugResult } = await sb.rpc("set_profile_slug", { p_device_id: device_id, p_slug: targetSlug });
|
|
344
|
+
if (slugResult?.set) profileSlug = targetSlug;
|
|
341
345
|
}
|
|
342
346
|
if (profileSlug) {
|
|
343
347
|
publicUrl = `https://www.antenna.fyi/p/${profileSlug}`;
|