feat: Add presence heartbeat for Matrix online status
- matrix-gateway: POST /internal/matrix/presence/online endpoint - usePresenceHeartbeat hook with activity tracking - Auto away after 5 min inactivity - Offline on page close/visibility change - Integrated in MatrixChatRoom component
This commit is contained in:
30
src/features/messenger/api/getChannelMessages.ts
Normal file
30
src/features/messenger/api/getChannelMessages.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { Message } from '../types/messenger';
|
||||
|
||||
export async function getChannelMessages(
|
||||
channelId: string,
|
||||
limit: number = 50,
|
||||
before?: string
|
||||
): Promise<Message[]> {
|
||||
let url = `/api/messaging/channels/${channelId}/messages?limit=${limit}`;
|
||||
if (before) {
|
||||
url += `&before=${encodeURIComponent(before)}`;
|
||||
}
|
||||
|
||||
const res = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-User-Id': 'user:admin', // TODO: get from auth context
|
||||
},
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to fetch messages: ${res.status}`);
|
||||
}
|
||||
|
||||
return res.json();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user