tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
add identity_id col to custom_domains
awarm.space
8 months ago
b3d90897
244504f4
+21
-10
2 changed files
expand all
collapse all
unified
split
actions
domains
addDomain.ts
supabase
migrations
20250704144448_add_identity_id_rel_to_custom_domains.sql
+16
-10
actions/domains/addDomain.ts
···
19
19
20
20
export async function addDomain(domain: string) {
21
21
let identity = await getIdentityData();
22
22
-
if (!identity || !identity.email) return {};
22
22
+
if (!identity || (!identity.email && !identity.atp_did)) return {};
23
23
if (
24
24
domain.includes("leaflet.pub") &&
25
25
-
![
26
26
-
"celine@hyperlink.academy",
27
27
-
"brendan@hyperlink.academy",
28
28
-
"jared@hyperlink.academy",
29
29
-
"brendan.schlagel@gmail.com",
30
30
-
].includes(identity.email)
25
25
+
(!identity.email ||
26
26
+
![
27
27
+
"celine@hyperlink.academy",
28
28
+
"brendan@hyperlink.academy",
29
29
+
"jared@hyperlink.academy",
30
30
+
"brendan.schlagel@gmail.com",
31
31
+
].includes(identity.email))
31
32
)
32
33
return {};
33
33
-
return await createDomain(domain, identity.email);
34
34
+
return await createDomain(domain, identity.email, identity.id);
34
35
}
35
36
36
37
export async function addPublicationDomain(
···
46
47
.single();
47
48
48
49
if (publication?.identity_did !== identity.atp_did) return {};
49
49
-
let { error } = await createDomain(domain, null);
50
50
+
let { error } = await createDomain(domain, null, identity.id);
50
51
if (error) return { error };
51
52
await supabase.from("publication_domains").insert({
52
53
publication: publication_uri,
···
56
57
return {};
57
58
}
58
59
59
59
-
async function createDomain(domain: string, email: string | null) {
60
60
+
async function createDomain(
61
61
+
domain: string,
62
62
+
email: string | null,
63
63
+
identity_id: string,
64
64
+
) {
60
65
try {
61
66
await vercel.projects.addProjectDomain({
62
67
idOrName: "prj_9jX4tmYCISnm176frFxk07fF74kG",
···
87
92
domain,
88
93
identity: email,
89
94
confirmed: false,
95
95
+
identity_id,
90
96
});
91
97
return {};
92
98
}
+5
supabase/migrations/20250704144448_add_identity_id_rel_to_custom_domains.sql
···
1
1
+
alter table "public"."custom_domains" add column "identity_id" uuid;
2
2
+
3
3
+
alter table "public"."custom_domains" add constraint "custom_domains_identity_id_fkey" FOREIGN KEY (identity_id) REFERENCES identities(id) ON DELETE CASCADE not valid;
4
4
+
5
5
+
alter table "public"."custom_domains" validate constraint "custom_domains_identity_id_fkey";