Skip to content

Commit 92284df

Browse files
committed
Merge branch 'feature/whatsapp-mcp' of https://github.com/existence-master/Sentient into feature/whatsapp-mcp
2 parents f4ece15 + d6210fe commit 92284df

12 files changed

Lines changed: 62 additions & 47 deletions

File tree

src/client/app/api/auth/refresh-session/route.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import { auth0 } from "@lib/auth0"
44
// This route is only for Auth0 environments
55
export async function GET(request) {
66
if (process.env.NEXT_PUBLIC_ENVIRONMENT === "selfhost") {
7-
return NextResponse.json({
8-
status: "ok",
9-
message: "Self-host mode, no refresh needed."
10-
}, {
11-
headers: { 'Cache-Control': 'no-store, max-age=0' }
12-
})
7+
return NextResponse.json(
8+
{
9+
status: "ok",
10+
message: "Self-host mode, no refresh needed."
11+
},
12+
{
13+
headers: { "Cache-Control": "no-store, max-age=0" }
14+
}
15+
)
1316
}
1417

1518
const res = new NextResponse()
@@ -29,7 +32,7 @@ export async function GET(request) {
2932
})
3033

3134
const newHeaders = new Headers(res.headers)
32-
newHeaders.set('Cache-Control', 'no-store, max-age=0')
35+
newHeaders.set("Cache-Control", "no-store, max-age=0")
3336
// The new session cookie is now on the `res` object.
3437
// Return a success response with the new headers.
3538
return NextResponse.json(

src/client/app/api/auth/token/route.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ export async function GET() {
1515
{ status: 500 }
1616
)
1717
}
18-
return NextResponse.json({ accessToken: token }, {
19-
headers: { 'Cache-Control': 'no-store, max-age=0' }
20-
})
18+
return NextResponse.json(
19+
{ accessToken: token },
20+
{
21+
headers: { "Cache-Control": "no-store, max-age=0" }
22+
}
23+
)
2124
}
2225
try {
2326
const tokenResult = await auth0.getAccessToken()
@@ -29,9 +32,12 @@ export async function GET() {
2932
{ status: 401 }
3033
)
3134
}
32-
return NextResponse.json({ accessToken: token }, {
33-
headers: { 'Cache-Control': 'no-store, max-age=0' }
34-
})
35+
return NextResponse.json(
36+
{ accessToken: token },
37+
{
38+
headers: { "Cache-Control": "no-store, max-age=0" }
39+
}
40+
)
3541
} catch (error) {
3642
console.error("Error in /api/auth/token:", error)
3743
return NextResponse.json(

src/client/app/api/settings/google-auth/route.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
2020
const data = await response.json()
2121
const googleAuthMode = data?.data?.googleAuth?.mode || "default"
2222

23-
return NextResponse.json({ mode: googleAuthMode }, {
24-
headers: { "Cache-Control": "no-store, max-age=0" }
25-
})
23+
return NextResponse.json(
24+
{ mode: googleAuthMode },
25+
{
26+
headers: { "Cache-Control": "no-store, max-age=0" }
27+
}
28+
)
2629
} catch (error) {
2730
console.error("API Error in /settings/google-auth (GET):", error)
2831
return NextResponse.json(

src/client/app/api/settings/privacy-filters/route.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
4949
labels: serviceFilters.labels || []
5050
}
5151

52-
return NextResponse.json({ filters: finalFilters }, {
53-
headers: { "Cache-Control": "no-store, max-age=0" }
54-
})
52+
return NextResponse.json(
53+
{ filters: finalFilters },
54+
{
55+
headers: { "Cache-Control": "no-store, max-age=0" }
56+
}
57+
)
5558
} catch (error) {
5659
console.error(
5760
`API Error in /settings/privacy-filters?service=${serviceName} (GET):`,

src/client/app/api/tasks/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const appServerUrl =
77
? process.env.INTERNAL_APP_SERVER_URL
88
: process.env.NEXT_PUBLIC_APP_SERVER_URL
99

10-
export const GET = withAuth(async function GET(request, { authHeader }) {
10+
export const POST = withAuth(async function POST(request, { authHeader }) {
1111
try {
1212
// The backend endpoint is a POST, but it doesn't require a body.
1313
// We use POST here to align with the backend's expectation.

src/client/app/api/user/profile/route.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ import { auth0 } from "@lib/auth0"
44

55
export async function GET() {
66
if (process.env.NEXT_PUBLIC_ENVIRONMENT === "selfhost") {
7-
return NextResponse.json({
8-
sub: "self-hosted-user",
9-
given_name: "User",
10-
name: "Self-Hosted User",
11-
picture: "/images/half-logo-dark.svg" // A default picture
12-
}, {
13-
headers: { 'Cache-Control': 'no-store, max-age=0' }
14-
})
7+
return NextResponse.json(
8+
{
9+
sub: "self-hosted-user",
10+
given_name: "User",
11+
name: "Self-Hosted User",
12+
picture: "/images/half-logo-dark.svg" // A default picture
13+
},
14+
{
15+
headers: { "Cache-Control": "no-store, max-age=0" }
16+
}
17+
)
1518
}
1619

1720
const session = await auth0.getSession()
@@ -34,6 +37,6 @@ export async function GET() {
3437
}
3538

3639
return NextResponse.json(userProfile, {
37-
headers: { 'Cache-Control': 'no-store, max-age=0' }
40+
headers: { "Cache-Control": "no-store, max-age=0" }
3841
})
3942
}

src/client/app/chat/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export default function ChatPage() {
364364

365365
const fetchIntegrations = useCallback(async () => {
366366
try {
367-
const res = await fetch("/api/settings/integrations", {method: POST})
367+
const res = await fetch("/api/settings/integrations", { method: "POST" })
368368
if (!res.ok) throw new Error("Failed to fetch integrations")
369369
const data = await res.json()
370370
setIntegrations(data.integrations || [])

src/client/app/integrations/page.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const UpgradeToProModal = ({ isOpen, onClose }) => {
188188

189189
const MANUAL_INTEGRATION_CONFIGS = {} // Manual integrations removed for Slack and Notion
190190

191-
const WhatsAppQRCodeModal = ({ onClose, onSuccess }) => {
191+
const WhatsAppQRCodeModal = ({ onClose }) => {
192192
const [qrCode, setQrCode] = useState(null)
193193
const [status, setStatus] = useState("initiating") // initiating, scanning, working, error
194194
const [error, setError] = useState("")
@@ -214,7 +214,6 @@ const WhatsAppQRCodeModal = ({ onClose, onSuccess }) => {
214214
setStatus("working")
215215
stopPolling()
216216
toast.success("WhatsApp connected successfully!")
217-
onSuccess()
218217
setTimeout(onClose, 1500)
219218
} else if (data.status === "FAILED") {
220219
setError("Connection failed. Please close this and try again.")
@@ -228,7 +227,7 @@ const WhatsAppQRCodeModal = ({ onClose, onSuccess }) => {
228227
setStatus("error")
229228
stopPolling()
230229
}
231-
}, [onSuccess, onClose, stopPolling])
230+
}, [onClose, stopPolling])
232231

233232
const initiateConnection = useCallback(async () => {
234233
setStatus("initiating")
@@ -765,6 +764,7 @@ const IntegrationsPage = () => {
765764

766765
const handleWhatsAppModalClose = useCallback(() => {
767766
setIsWhatsAppQRModalOpen(false)
767+
fetchIntegrations() // Always refetch on close to ensure UI is up-to-date
768768
}, [])
769769

770770
const googleServices = [
@@ -782,8 +782,8 @@ const IntegrationsPage = () => {
782782
setLoading(true)
783783
try {
784784
const response = await fetch("/api/settings/integrations", {
785-
cache: "no-store",
786-
method: "POST"
785+
method: "POST",
786+
cache: "no-store"
787787
})
788788
const data = await response.json()
789789
if (!response.ok)
@@ -1546,10 +1546,7 @@ const IntegrationsPage = () => {
15461546
</div>
15471547
<AnimatePresence>
15481548
{isWhatsAppQRModalOpen && (
1549-
<WhatsAppQRCodeModal
1550-
onClose={handleWhatsAppModalClose}
1551-
onSuccess={fetchIntegrations}
1552-
/>
1549+
<WhatsAppQRCodeModal onClose={handleWhatsAppModalClose} />
15531550
)}
15541551
</AnimatePresence>
15551552
<AnimatePresence>

src/client/app/tasks/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ function TasksPageContent() {
290290
const fetchTasks = useCallback(async () => {
291291
setIsLoading(true)
292292
try {
293-
const tasksRes = await fetch("/api/tasks")
293+
const tasksRes = await fetch("/api/tasks", { method: "POST" })
294294
if (!tasksRes.ok) throw new Error("Failed to fetch tasks")
295295
const tasksData = await tasksRes.json()
296296
const rawTasks = Array.isArray(tasksData.tasks)
297297
? tasksData.tasks
298298
: []
299299
setAllTasks(rawTasks)
300300

301-
const integrationsRes = await fetch("/api/settings/integrations")
301+
const integrationsRes = await fetch("/api/settings/integrations", { method: "POST" })
302302
if (!integrationsRes.ok)
303303
throw new Error("Failed to fetch integrations")
304304
const integrationsData = await integrationsRes.json()

src/docker-compose.selfhost.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ services:
102102

103103
# WAHA (WhatsApp HTTP API) Service
104104
waha:
105-
image: devlikeapro/waha:noweb
105+
image: itsskofficial/waha-multisession
106106
container_name: sentient-waha-selfhost
107107
restart: unless-stopped
108108
volumes:

0 commit comments

Comments
 (0)