From 3f03f6786e0a9890648cee2a8253b06e49bfe7d7 Mon Sep 17 00:00:00 2001 From: JeremyGamer13 <69337718+JeremyGamer13@users.noreply.github.com> Date: Mon, 12 May 2025 21:53:21 -0600 Subject: [PATCH 1/9] add the profile settings for hiding following --- src/resources/projectapi.js | 31 +++++++++++++++++++++++++++++++ src/routes/settings/+page.svelte | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/resources/projectapi.js b/src/resources/projectapi.js index f98cf053..be98c1ef 100644 --- a/src/resources/projectapi.js +++ b/src/resources/projectapi.js @@ -1832,6 +1832,37 @@ class ProjectApi { }) }); } + updatePrivateFollowing(profileHideFollowing) { + const url = `${OriginApiUrl}/api/v1/users/privateFollowSettings`; + + const body = JSON.stringify({ + username: this.username, + token: this.token, + profileHideFollowing, + }); + + return new Promise((resolve, reject) => { + fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body + }).then(res => { + res.json().then(json => { + if (!res.ok) { + reject(json.error); + return; + } + resolve(); + }).catch(err => { + reject(err); + }) + }).catch(err => { + reject(err); + }) + }); + } ipBanUser(username, toggle) { const url = `${OriginApiUrl}/api/v1/users/banuserip`; diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index a2457c76..69ec259d 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -40,6 +40,7 @@ private: false, privateToNonFollowers: false, showCubesOnProfile: false, + profileHideFollowing: false, }, }; @@ -185,6 +186,10 @@ ProjectClient.updatePrivateProfile(privateProfile, privateToNonFollowers); } + function updatePrivateFollowing() { + const hideFollowing = accountInformation.settings.profileHideFollowing || false; + ProjectClient.updatePrivateFollowing(hideFollowing); + } function setPFP() { // open file menu @@ -669,6 +674,21 @@ />

+
+ +

+ +

+

+ (Moderators can always see who you are following, ignoring these settings.) +

+ + + + +
+ {/if} + + {#if ((pageType === "followers" || pageType === "following") && pageProfilePrivate) || (pageType === "following" && pageProfilePrivateFollowingList)} +
+ Private + + {#if pageProfilePrivateToFollowers} +

+ +

+ {:else if pageProfilePrivateFollowingList} +

+ +

+ {:else} +

+ +

+ {/if} +
+ {:else} + {#each pageUsers as follower} + + + + {/each} +

TODO: List followers or following based on type.

+ {/if} {/if} -

TODO: Add a "type" parameter that this page can have, and if it is "following" or "followers" then also have a "target" parameter.

-

TODO: Private profiles or hidden following lists require a sign in button & requirement.

@@ -136,4 +251,49 @@ width: 100%; min-width: 1000px; } + + .profile-section { + width: 100%; + height: 6em; + + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + } + .profile-section > h1 { + margin: 0 8px; + } + .profile-section > h1 a { + color: black; + text-decoration: none; + } + :global(body.dark-mode) .profile-section > h1 a { + color: white; + } + .profile-picture { + height: 100%; + + border-radius: 8px; + } + .profile-switches button { + margin: 8px 0; + + display: flex; + flex-direction: column; + align-items: center; + + background: transparent; + border: 0; + font-size: large; + color: black; + + cursor: pointer; + } + :global(body.dark-mode) .profile-switches button { + color: white; + } + .profile-switches a { + text-decoration: none; + } From ff436e97ec68d39fc84b0c44f004ead7b6dcc21c Mon Sep 17 00:00:00 2001 From: JeremyGamer13 <69337718+JeremyGamer13@users.noreply.github.com> Date: Sat, 26 Jul 2025 17:44:55 -0600 Subject: [PATCH 7/9] nicer user list & show errors --- src/routes/userlist/+page.svelte | 84 +++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/src/routes/userlist/+page.svelte b/src/routes/userlist/+page.svelte index c55314dc..0a54699c 100644 --- a/src/routes/userlist/+page.svelte +++ b/src/routes/userlist/+page.svelte @@ -169,6 +169,24 @@
{#if pageLoading} + {:else if pageError} + {#if pageError === "User not found"} +

+ +

+ {:else} +

+ +

+ {/if} {:else} {#if pageType === "followers" || pageType === "following"}
@@ -227,12 +245,22 @@ {/if}
{:else} - {#each pageUsers as follower} - - - - {/each} -

TODO: List followers or following based on type.

+
+ {#each pageUsers as follower} + + + + {/each} +
{/if} {/if} @@ -249,7 +277,49 @@ left: 0px; top: 0px; width: 100%; - min-width: 1000px; + min-width: 730px; + } + + .error-message { + width: 100%; + text-align: center; + } + + .list-users { + width: 100%; + + display: flex; + flex-direction: column; + align-items: center; + } + .list-user { + width: 90%; + height: 3em; + max-width: 684px; + margin: 4px 0; + + text-decoration: none; + } + .list-user button { + width: 100%; + height: 100%; + + display: flex; + flex-direction: row; + align-items: center; + + background: none; + border: 0; + text-align: left; + font-size: large; + + cursor: pointer; + } + .list-user-picture { + height: 100%; + margin-right: 8px; + + border-radius: 8px; } .profile-section { From 558f5bb39ccb534bcda1b30ce6f156e7d75474be Mon Sep 17 00:00:00 2001 From: JeremyGamer13 <69337718+JeremyGamer13@users.noreply.github.com> Date: Sat, 26 Jul 2025 18:23:12 -0600 Subject: [PATCH 8/9] add pagination & nicer error screen --- src/routes/userlist/+page.svelte | 107 ++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 10 deletions(-) diff --git a/src/routes/userlist/+page.svelte b/src/routes/userlist/+page.svelte index 0a54699c..aa574089 100644 --- a/src/routes/userlist/+page.svelte +++ b/src/routes/userlist/+page.svelte @@ -26,6 +26,7 @@ let loggedIn = null; let paginationPage = 0; + let paginationWantedPage = 1; let currentLang = "en"; onMount(() => { @@ -142,6 +143,24 @@ break; } }; + let pageUpdateTimeout = null; + const pageCheckPagination = () => { + // fix number, note that paginationWantedPage starts at 1 + if (paginationWantedPage < 1) paginationWantedPage = 1; + if (isNaN(paginationWantedPage)) paginationWantedPage = 1; + if (!isFinite(paginationWantedPage)) paginationWantedPage = 1; + // queue an update to the page + const realPage = paginationWantedPage - 1; + if (pageUpdateTimeout) { + clearTimeout(pageUpdateTimeout); + pageUpdateTimeout = null; + } + pageUpdateTimeout = setTimeout(() => { + if (realPage === paginationPage) return; + paginationPage = realPage; + pageShouldReload(); + }, 500); + }; onMount(() => { page.subscribe(store => { if (store.url.searchParams.get("type") !== pageType) return window.location.reload(); @@ -170,23 +189,24 @@ {#if pageLoading} {:else if pageError} - {#if pageError === "User not found"} -

+

+ +
+

+ {#if pageError === "User not found"} -

- {:else} -

+ {:else} -

- {/if} + {/if} +

{:else} {#if pageType === "followers" || pageType === "following"}
@@ -199,9 +219,24 @@ {pageTarget}
- - - + + + + + +
@@ -245,6 +280,13 @@ {/if} {:else} +
+
+ + + +
+
{#each pageUsers as follower} @@ -284,6 +326,51 @@ width: 100%; text-align: center; } + .error-penguin { + width: 100%; + + display: flex; + flex-direction: column; + align-items: center; + } + + .list-paging { + width: 100%; + height: 2em; + + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + } + .list-paging-buttons { + height: 100%; + } + .list-paging-buttons > button, + .list-paging-buttons > input { + margin-top: 0; + margin-bottom: 0; + } + .list-paging-buttons > button { + height: calc(100% - 2px); + padding: 0 8px; + + background: #00c3ff; + color: white; + border: 1px solid rgba(0, 0, 0, 0.25); + border-radius: 4px; + + cursor: pointer; + } + .list-paging-buttons > input { + width: 3em; + height: calc(100% - 2px); + padding: 0 8px; + + background: white; + border: 1px solid rgba(0, 0, 0, 0.25); + border-radius: 4px; + } .list-users { width: 100%; From b5120fbbfea54afe6d89e9db0040376600169f3e Mon Sep 17 00:00:00 2001 From: JeremyGamer13 <69337718+JeremyGamer13@users.noreply.github.com> Date: Sat, 26 Jul 2025 18:25:53 -0600 Subject: [PATCH 9/9] make private profile error look nicer --- src/routes/userlist/+page.svelte | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/routes/userlist/+page.svelte b/src/routes/userlist/+page.svelte index aa574089..8362430f 100644 --- a/src/routes/userlist/+page.svelte +++ b/src/routes/userlist/+page.svelte @@ -121,6 +121,7 @@ pageUsers = followers; }) .catch(err => { + if (err === "PrivateProfile") { pageProfilePrivate = true; return; } pageError = err; }) .finally(() => { @@ -453,4 +454,12 @@ .profile-switches a { text-decoration: none; } + + .section-private { + width: 100%; + + display: flex; + flex-direction: column; + align-items: center; + }