@commonpub/layer 0.3.28 → 0.3.30
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"vue": "^3.4.0",
|
|
45
45
|
"vue-router": "^4.3.0",
|
|
46
46
|
"zod": "^4.3.6",
|
|
47
|
-
"@commonpub/config": "0.7.1",
|
|
48
|
-
"@commonpub/protocol": "0.9.5",
|
|
49
47
|
"@commonpub/auth": "0.5.0",
|
|
50
|
-
"@commonpub/
|
|
48
|
+
"@commonpub/docs": "0.5.2",
|
|
49
|
+
"@commonpub/config": "0.7.1",
|
|
51
50
|
"@commonpub/learning": "0.5.0",
|
|
51
|
+
"@commonpub/editor": "0.5.0",
|
|
52
|
+
"@commonpub/protocol": "0.9.5",
|
|
52
53
|
"@commonpub/schema": "0.8.13",
|
|
53
|
-
"@commonpub/server": "2.
|
|
54
|
-
"@commonpub/docs": "0.5.2",
|
|
54
|
+
"@commonpub/server": "2.18.0",
|
|
55
55
|
"@commonpub/ui": "0.7.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
package/pages/index.vue
CHANGED
|
@@ -294,7 +294,8 @@ async function handleHubJoin(hubSlug: string): Promise<void> {
|
|
|
294
294
|
<div class="cpub-sb-head">Trending Hubs <NuxtLink to="/hubs">Browse</NuxtLink></div>
|
|
295
295
|
<div v-for="hub in communities.items" :key="hub.id" class="cpub-hub-item">
|
|
296
296
|
<div class="cpub-hub-icon">
|
|
297
|
-
<
|
|
297
|
+
<img v-if="hub.iconUrl" :src="hub.iconUrl" :alt="hub.name" class="cpub-hub-icon-img" />
|
|
298
|
+
<i v-else class="fa-solid fa-users"></i>
|
|
298
299
|
</div>
|
|
299
300
|
<div class="cpub-hub-info">
|
|
300
301
|
<NuxtLink :to="`/hubs/${hub.slug}`" class="cpub-hub-name">{{ hub.name }}</NuxtLink>
|
|
@@ -877,6 +878,12 @@ async function handleHubJoin(hubSlug: string): Promise<void> {
|
|
|
877
878
|
border: var(--border-width-default) solid var(--teal);
|
|
878
879
|
background: var(--teal-bg);
|
|
879
880
|
color: var(--teal);
|
|
881
|
+
overflow: hidden;
|
|
882
|
+
}
|
|
883
|
+
.cpub-hub-icon-img {
|
|
884
|
+
width: 100%;
|
|
885
|
+
height: 100%;
|
|
886
|
+
object-fit: cover;
|
|
880
887
|
}
|
|
881
888
|
|
|
882
889
|
.cpub-hub-info { flex: 1; min-width: 0; }
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { getHubBySlug, getHubFederatedFollowers, getHubActorUri } from '@commonpub/server';
|
|
2
|
+
import { hubMembers, users } from '@commonpub/schema';
|
|
3
|
+
import { eq, and } from 'drizzle-orm';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
* Hub Group actor followers collection.
|
|
5
|
-
* Returns an OrderedCollection of
|
|
6
|
+
* Hub Group actor followers/members collection.
|
|
7
|
+
* Returns an OrderedCollection of both local members (as Person actor URIs)
|
|
8
|
+
* and remote AP followers. Remote instances use this to populate member lists.
|
|
6
9
|
*/
|
|
7
10
|
export default defineEventHandler(async (event) => {
|
|
8
11
|
const config = useConfig();
|
|
@@ -24,16 +27,29 @@ export default defineEventHandler(async (event) => {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const hubActorUri = getHubActorUri(domain, slug);
|
|
30
|
+
|
|
31
|
+
// Get remote AP followers
|
|
27
32
|
const followers = await getHubFederatedFollowers(db, hub.id);
|
|
28
33
|
const followerUris = followers.map((f) => f.followerActorUri);
|
|
29
34
|
|
|
35
|
+
// Get local hub members as Person actor URIs
|
|
36
|
+
const localMembers = await db
|
|
37
|
+
.select({ username: users.username })
|
|
38
|
+
.from(hubMembers)
|
|
39
|
+
.innerJoin(users, eq(hubMembers.userId, users.id))
|
|
40
|
+
.where(and(eq(hubMembers.hubId, hub.id), eq(hubMembers.status, 'active')));
|
|
41
|
+
const memberUris = localMembers.map((m) => `https://${domain}/users/${m.username}`);
|
|
42
|
+
|
|
43
|
+
// Combine and deduplicate
|
|
44
|
+
const allUris = [...new Set([...memberUris, ...followerUris])];
|
|
45
|
+
|
|
30
46
|
setResponseHeader(event, 'content-type', 'application/activity+json');
|
|
31
47
|
|
|
32
48
|
return {
|
|
33
49
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
34
50
|
id: `${hubActorUri}/followers`,
|
|
35
51
|
type: 'OrderedCollection',
|
|
36
|
-
totalItems:
|
|
37
|
-
orderedItems:
|
|
52
|
+
totalItems: allUris.length,
|
|
53
|
+
orderedItems: allUris,
|
|
38
54
|
};
|
|
39
55
|
});
|