Skip to content

Commit a7ae582

Browse files
authored
Feat/staging anchr setup (#253)
* chore: remove file * chore: add things to gitignore * chore: add debug hosts
1 parent dfd92b5 commit a7ae582

File tree

8 files changed

+28
-335
lines changed

8 files changed

+28
-335
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ node_modules
55
.pnp
66
.pnp.js
77

8+
.env.development
9+
810
# Local env files
911
.env
1012
.env.local

pglite-debug.log

Whitespace-only changes.

platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from "path";
44
import dotenv from "dotenv";
55
import { getFirestore } from "firebase-admin/firestore";
66
import { Timestamp } from "firebase-admin/firestore";
7+
import axios from "axios";
78

89
// Define types locally since we can't import from @blabsy/types
910
type User = {
@@ -86,7 +87,9 @@ export class WebhookController {
8687
try {
8788
const { data, schemaId, id } = req.body;
8889

89-
console.log("received webhook????", req.body);
90+
if (process.env.ANCHR_URL) {
91+
return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_BLABSY_BASE_URL).toString(), req.body)
92+
}
9093

9194
if (adapter.lockedIds.includes(id)) return;
9295
console.log("processing -- not skipped");
@@ -248,15 +251,15 @@ export class WebhookController {
248251
createdBy,
249252
images: data.images
250253
? data.images.map((i: string) => ({
251-
src: i,
252-
}))
254+
src: i,
255+
}))
253256
: null,
254257
parent:
255258
data.parent && user
256259
? {
257-
id: data.parent.split("(")[1].split(")")[0],
258-
username: user.username,
259-
}
260+
id: data.parent.split("(")[1].split(")")[0],
261+
username: user.username,
262+
}
260263
: null,
261264
createdAt: Timestamp.fromDate(new Date(Date.now())),
262265
userRetweets: [],
@@ -279,11 +282,11 @@ export class WebhookController {
279282
updatedAt: now,
280283
lastMessage: data.lastMessage
281284
? {
282-
...data.lastMessage,
283-
timestamp: Timestamp.fromDate(
284-
new Date(data.lastMessage.timestamp),
285-
),
286-
}
285+
...data.lastMessage,
286+
timestamp: Timestamp.fromDate(
287+
new Date(data.lastMessage.timestamp),
288+
),
289+
}
287290
: null,
288291
};
289292
}

platforms/blabsy/.env.development

Lines changed: 0 additions & 21 deletions
This file was deleted.

platforms/blabsy/pglite-debug.log

Whitespace-only changes.

platforms/pictique-api/src/controllers/WebhookController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { User } from "database/entities/User";
88
import { Chat } from "database/entities/Chat";
99
import { MessageService } from "../services/MessageService";
1010
import { Post } from "database/entities/Post";
11+
import axios from "axios";
1112

1213
export class WebhookController {
1314
userService: UserService;
@@ -28,7 +29,9 @@ export class WebhookController {
2829

2930
handleWebhook = async (req: Request, res: Response) => {
3031
try {
31-
console.log("raw hook", req.body);
32+
if (process.env.ANCHR_URL) {
33+
return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_PICTIQUE_BASE_URL).toString(), req.body)
34+
}
3235
const schemaId = req.body.schemaId;
3336
const globalId = req.body.id;
3437
const mapping = Object.values(this.adapter.mapping).find(

0 commit comments

Comments
 (0)