Skip to content

Commit 283285b

Browse files
committed
update ap settings
1 parent 28e3636 commit 283285b

9 files changed

Lines changed: 427 additions & 163 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "ap_entities" DROP COLUMN "listen_timelines";

drizzle/meta/0001_snapshot.json

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"id": "4e00e484-f278-4945-97c6-4140d8d662f6",
3+
"prevId": "c6b93d28-a73d-4640-8543-791e99a1520f",
4+
"version": "7",
5+
"dialect": "postgresql",
6+
"tables": {
7+
"public.ap_entities": {
8+
"name": "ap_entities",
9+
"schema": "",
10+
"columns": {
11+
"id": {
12+
"name": "id",
13+
"type": "text",
14+
"primaryKey": true,
15+
"notNull": true
16+
},
17+
"ccid": {
18+
"name": "ccid",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true
22+
},
23+
"enabled": {
24+
"name": "enabled",
25+
"type": "boolean",
26+
"primaryKey": false,
27+
"notNull": true,
28+
"default": true
29+
},
30+
"c_date": {
31+
"name": "c_date",
32+
"type": "date",
33+
"primaryKey": false,
34+
"notNull": true,
35+
"default": "now()"
36+
}
37+
},
38+
"indexes": {},
39+
"foreignKeys": {},
40+
"compositePrimaryKeys": {},
41+
"uniqueConstraints": {
42+
"ap_entities_ccid_unique": {
43+
"name": "ap_entities_ccid_unique",
44+
"nullsNotDistinct": false,
45+
"columns": [
46+
"ccid"
47+
]
48+
}
49+
},
50+
"policies": {},
51+
"checkConstraints": {},
52+
"isRLSEnabled": false
53+
},
54+
"public.ap_keys": {
55+
"name": "ap_keys",
56+
"schema": "",
57+
"columns": {
58+
"owner_id": {
59+
"name": "owner_id",
60+
"type": "text",
61+
"primaryKey": false,
62+
"notNull": true
63+
},
64+
"key_type": {
65+
"name": "key_type",
66+
"type": "text",
67+
"primaryKey": false,
68+
"notNull": true
69+
},
70+
"private": {
71+
"name": "private",
72+
"type": "text",
73+
"primaryKey": false,
74+
"notNull": true
75+
},
76+
"public": {
77+
"name": "public",
78+
"type": "text",
79+
"primaryKey": false,
80+
"notNull": true
81+
},
82+
"c_date": {
83+
"name": "c_date",
84+
"type": "date",
85+
"primaryKey": false,
86+
"notNull": true,
87+
"default": "now()"
88+
}
89+
},
90+
"indexes": {},
91+
"foreignKeys": {},
92+
"compositePrimaryKeys": {
93+
"ap_keys_owner_id_key_type_pk": {
94+
"name": "ap_keys_owner_id_key_type_pk",
95+
"columns": [
96+
"owner_id",
97+
"key_type"
98+
]
99+
}
100+
},
101+
"uniqueConstraints": {},
102+
"policies": {},
103+
"checkConstraints": {},
104+
"isRLSEnabled": false
105+
},
106+
"public.ap_object_references": {
107+
"name": "ap_object_references",
108+
"schema": "",
109+
"columns": {
110+
"ap_object_id": {
111+
"name": "ap_object_id",
112+
"type": "text",
113+
"primaryKey": true,
114+
"notNull": true
115+
},
116+
"cc_uri": {
117+
"name": "cc_uri",
118+
"type": "text",
119+
"primaryKey": false,
120+
"notNull": true
121+
},
122+
"ref_type": {
123+
"name": "ref_type",
124+
"type": "text",
125+
"primaryKey": false,
126+
"notNull": true
127+
},
128+
"meta": {
129+
"name": "meta",
130+
"type": "jsonb",
131+
"primaryKey": false,
132+
"notNull": false
133+
},
134+
"c_date": {
135+
"name": "c_date",
136+
"type": "date",
137+
"primaryKey": false,
138+
"notNull": true,
139+
"default": "now()"
140+
}
141+
},
142+
"indexes": {
143+
"ap_object_references_cc_uri_idx": {
144+
"name": "ap_object_references_cc_uri_idx",
145+
"columns": [
146+
{
147+
"expression": "cc_uri",
148+
"isExpression": false,
149+
"asc": true,
150+
"nulls": "last"
151+
}
152+
],
153+
"isUnique": false,
154+
"concurrently": false,
155+
"method": "btree",
156+
"with": {}
157+
}
158+
},
159+
"foreignKeys": {},
160+
"compositePrimaryKeys": {},
161+
"uniqueConstraints": {},
162+
"policies": {},
163+
"checkConstraints": {},
164+
"isRLSEnabled": false
165+
}
166+
},
167+
"enums": {},
168+
"schemas": {},
169+
"sequences": {},
170+
"roles": {},
171+
"policies": {},
172+
"views": {},
173+
"_meta": {
174+
"columns": {},
175+
"schemas": {},
176+
"tables": {}
177+
}
178+
}

drizzle/meta/_journal.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
"when": 1784561772924,
99
"tag": "0000_parallel_azazel",
1010
"breakpoints": true
11+
},
12+
{
13+
"idx": 1,
14+
"version": "7",
15+
"when": 1785917007119,
16+
"tag": "0001_lean_the_santerians",
17+
"breakpoints": true
1118
}
1219
]
1320
}

src/app.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const pkg = JSON.parse(
4141
const ccEndpoints: Record<string, string> = {
4242
"net.concrnt.activitypub.info": "/ap/api/info",
4343
"net.concrnt.activitypub.setup": "/ap/api/setup", // POST {id}
44-
"net.concrnt.activitypub.settings": "/ap/api/settings", // GET=取得 / POST=更新
44+
"net.concrnt.activitypub.settings": "/ap/api/settings", // GET=取得 (listenTimelines等のユーザー設定はcckvレコード側)
4545
"net.concrnt.activitypub.stats": "/ap/api/stats",
4646
"net.concrnt.activitypub.followers": "/ap/api/followers",
4747
"net.concrnt.activitypub.following": "/ap/api/following",
@@ -101,14 +101,12 @@ app.post("/ap/api/setup", async (c) => {
101101
id: id.toLowerCase(),
102102
ccid: ccid,
103103
enabled: true,
104-
listenTimelines: [],
105104
})
106105

107106
return c.json({
108107
id: id,
109108
ccid: ccid,
110109
enabled: true,
111-
listenTimelines: [],
112110
})
113111

114112
});
@@ -131,35 +129,9 @@ app.get("/ap/api/settings", async (c) => {
131129
ccid: entity.ccid,
132130
id: entity.id,
133131
enabled: entity.enabled,
134-
listenTimelines: entity.listenTimelines,
135132
});
136133
});
137134

138-
app.post("/ap/api/settings", async (c) => {
139-
140-
const authInfo = receiveAuthInfo(c)
141-
if (!authInfo) {
142-
return c.json({ error: "Missing authentication information" }, 400);
143-
}
144-
145-
const id = authInfo.ccid
146-
147-
const entity = await db.select().from(apEntity).where(eq(apEntity.ccid, id)).limit(1).then(res => res[0]);
148-
if (!entity) {
149-
return c.json({ error: "No ActivityPub entity found for this user" }, 404);
150-
}
151-
152-
const { listenTimelines } = await c.req.json();
153-
154-
await db.update(apEntity)
155-
.set({
156-
listenTimelines: listenTimelines ?? entity.listenTimelines,
157-
})
158-
.where(eq(apEntity.ccid, id));
159-
160-
return c.json({ message: "Settings updated successfully" });
161-
});
162-
163135

164136
app.get("/ap/api/stats", async (c) => {
165137

0 commit comments

Comments
 (0)