mirror of https://github.com/buster-so/buster.git
Require auth for github endpoints
This commit is contained in:
parent
9c1b86b171
commit
9c1a2f9c37
|
@ -13,10 +13,12 @@ const app = new Hono<{
|
|||
Variables: {
|
||||
busterUser: User;
|
||||
};
|
||||
}>();
|
||||
}>()
|
||||
// Apply authentication middleware to all routes
|
||||
.use('*', requireAuth);
|
||||
|
||||
// Get organization datasets endpoint
|
||||
app.get('/', requireAuth, async (c) => {
|
||||
app.get('/', async (c) => {
|
||||
const user = c.get('busterUser');
|
||||
const dataSourceId = c.req.query('dataSourceId');
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ const app = new Hono()
|
|||
return c.json(response);
|
||||
})
|
||||
|
||||
// OAuth callback - no auth needed since GitHub redirects here
|
||||
.get('/auth/callback', zValidator('query', AuthCallbackSchema), async (c) => {
|
||||
const query = c.req.valid('query');
|
||||
const result = await authCallbackHandler({
|
||||
|
|
|
@ -42,17 +42,19 @@ const app = new Hono().get(
|
|||
today.getFullYear() === updatedDate.getFullYear() &&
|
||||
today.getMonth() === updatedDate.getMonth() &&
|
||||
today.getDate() === updatedDate.getDate();
|
||||
|
||||
|
||||
if (isToday) {
|
||||
return c.json(currentSuggestedPrompts);
|
||||
}
|
||||
}
|
||||
|
||||
const timeoutMs = 10000; // 10 seconds timeout
|
||||
|
||||
|
||||
const timeoutPromise = new Promise<never>((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error('Request timeout after 10 seconds. Returning current suggested prompts.'));
|
||||
reject(
|
||||
new Error('Request timeout after 10 seconds. Returning current suggested prompts.')
|
||||
);
|
||||
}, timeoutMs);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue