add discovery of people's profiles, and update profile endpoints for latest server version

This commit is contained in:
2025-01-18 20:02:20 -07:00
parent 8eb8b746d7
commit f3f8aeefc3
6 changed files with 339 additions and 178 deletions

View File

@@ -82,13 +82,12 @@
<div v-else class="text-center">
<div class @click="openImageDialog()">
<fa
icon="camera"
icon="image-portrait"
class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-2 rounded-l"
/>
<fa
icon="image-portrait"
icon="camera"
class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-2 rounded-r"
@click="openImageDialog()"
/>
</div>
</div>
@@ -250,16 +249,15 @@
<div
id="sectionSearchLocation"
class="bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8"
class="flex justify-between bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8"
>
<!-- label -->
<div class="mb-2 font-bold">Location for Searches</div>
<span class="mb-2 font-bold">Location for Searches</span>
<router-link
:to="{ name: 'search-area' }"
class="block w-full text-center text-m bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-2 mt-6"
class="text-m bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-2"
>
Set Search Area
<!-- If already set, change button label to "Change Search Area" -->
{{ isSearchAreasSet ? "Change" : "Set" }} Search Area
</router-link>
</div>
@@ -285,10 +283,7 @@
:class="{ 'bg-slate-100': loadingProfile || savingProfile }"
></textarea>
<div
class="flex items-center mb-4"
@click="toggleUserProfileLocation"
>
<div class="flex items-center mb-4" @click="toggleUserProfileLocation">
<input
type="checkbox"
class="mr-2"
@@ -680,7 +675,7 @@
<h2 class="text-slate-500 text-sm font-bold mb-2">
Notification Push Server
</h2>
<div id="sectionNotificationPushServer" class="px-3 py-4">
<div class="px-3 py-4">
<input
type="text"
class="block w-full rounded border border-slate-400 px-3 py-2"
@@ -757,7 +752,7 @@
{{ DEFAULT_PARTNER_API_SERVER }}
</span>
<div id="sectionImageServerURL" class="mt-2">
<div class="mt-2">
<span class="text-slate-500 text-sm font-bold">Image Server URL</span>
&nbsp;
<span class="text-sm">{{ DEFAULT_IMAGE_API_SERVER }}</span>
@@ -930,6 +925,7 @@ import {
DIRECT_PUSH_TITLE,
retrieveAccountMetadata,
} from "@/libs/util";
import { UserProfile } from "@/libs/partnerServer";
const inputImportFileNameRef = ref<Blob>();
@@ -964,9 +960,9 @@ export default class AccountViewView extends Vue {
givenName = "";
hideRegisterPromptOnNewContact = false;
imageLimits: ImageRateLimits | null = null;
imageServer = "";
includeUserProfileLocation = false;
isRegistered = false;
isSearchAreasSet = false;
limitsMessage = "";
loadingLimits = false;
loadingProfile = true;
@@ -975,8 +971,8 @@ export default class AccountViewView extends Vue {
notifyingReminder = false;
notifyingReminderMessage = "";
notifyingReminderTime = "";
partnerApiServer = "";
partnerApiServerInput = "";
partnerApiServer = DEFAULT_PARTNER_API_SERVER;
partnerApiServerInput = DEFAULT_PARTNER_API_SERVER;
passkeyExpirationDescription = "";
passkeyExpirationMinutes = DEFAULT_PASSKEY_EXPIRATION_MINUTES;
previousPasskeyExpirationMinutes = DEFAULT_PASSKEY_EXPIRATION_MINUTES;
@@ -997,8 +993,8 @@ export default class AccountViewView extends Vue {
subscription: PushSubscription | null = null;
warnIfProdServer = false;
warnIfTestServer = false;
webPushServer = "";
webPushServerInput = "";
webPushServer = DEFAULT_PUSH_SERVER;
webPushServerInput = DEFAULT_PUSH_SERVER;
userProfileDesc = "";
userProfileLatitude = 0;
userProfileLongitude = 0;
@@ -1021,7 +1017,7 @@ export default class AccountViewView extends Vue {
try {
const headers = await getHeaders(this.activeDid);
const response = await this.axios.get(
this.apiServer + "/api/partner/user-profile/" + this.activeDid,
this.apiServer + "/api/partner/userProfile/" + this.activeDid,
{ headers },
);
if (response.status === 200) {
@@ -1127,14 +1123,15 @@ export default class AccountViewView extends Vue {
this.hideRegisterPromptOnNewContact =
!!settings.hideRegisterPromptOnNewContact;
this.isRegistered = !!settings?.isRegistered;
this.imageServer = settings.imageServer || "";
this.isSearchAreasSet = !!settings.searchBoxes;
this.notifyingNewActivity = !!settings.notifyingNewActivityTime;
this.notifyingNewActivityTime = settings.notifyingNewActivityTime || "";
this.notifyingReminder = !!settings.notifyingReminderTime;
this.notifyingReminderMessage = settings.notifyingReminderMessage || "";
this.notifyingReminderTime = settings.notifyingReminderTime || "";
this.partnerApiServer = settings.partnerApiServer || "";
this.partnerApiServerInput = settings.partnerApiServer || "";
this.partnerApiServer = settings.partnerApiServer || this.partnerApiServer;
this.partnerApiServerInput =
settings.partnerApiServer || this.partnerApiServerInput;
this.profileImageUrl = settings.profileImageUrl;
this.showContactGives = !!settings.showContactGivesInline;
this.passkeyExpirationMinutes =
@@ -1144,8 +1141,8 @@ export default class AccountViewView extends Vue {
this.showShortcutBvc = !!settings.showShortcutBvc;
this.warnIfProdServer = !!settings.warnIfProdServer;
this.warnIfTestServer = !!settings.warnIfTestServer;
this.webPushServer = settings.webPushServer || "";
this.webPushServerInput = settings.webPushServer || "";
this.webPushServer = settings.webPushServer || this.webPushServer;
this.webPushServerInput = settings.webPushServer || this.webPushServerInput;
}
// call fn, copy text to the clipboard, then redo fn after 2 seconds
@@ -1793,15 +1790,25 @@ export default class AccountViewView extends Vue {
this.savingProfile = true;
try {
const headers = await getHeaders(this.activeDid);
const payload = {
const payload: UserProfile = {
description: this.userProfileDesc,
};
if (this.userProfileLatitude && this.userProfileLongitude) {
payload.locLat = this.userProfileLatitude;
payload.locLon = this.userProfileLongitude;
} else if (this.includeUserProfileLocation) {
this.$notify(
{
group: "alert",
type: "toast",
title: "",
text: "No profile location is saved.",
},
3000,
);
}
const response = await this.axios.post(
this.apiServer + "/api/partner/user-profile",
this.apiServer + "/api/partner/userProfile",
payload,
{ headers },
);
@@ -1845,6 +1852,7 @@ export default class AccountViewView extends Vue {
if (!this.includeUserProfileLocation) {
this.userProfileLatitude = 0;
this.userProfileLongitude = 0;
this.zoom = 2;
}
}
@@ -1866,6 +1874,7 @@ export default class AccountViewView extends Vue {
eraseLatLong() {
this.userProfileLatitude = 0;
this.userProfileLongitude = 0;
this.zoom = 2;
this.includeUserProfileLocation = false;
}
}