ai on mobile

This commit is contained in:
Michael Freno
2025-12-28 14:40:38 -05:00
parent 5552bed2c0
commit ced9166b54
2 changed files with 80 additions and 27 deletions

View File

@@ -1,14 +1,6 @@
import { publicProcedure, createTRPCRouter } from "~/server/api/utils";
import { env } from "~/env/server";
// Helper to detect mobile devices from User-Agent
const isMobileDevice = (userAgent: string | undefined): boolean => {
if (!userAgent) return false;
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
userAgent
);
};
export const infillRouter = createTRPCRouter({
getConfig: publicProcedure.query(({ ctx }) => {
// Only admins get the config
@@ -16,15 +8,8 @@ export const infillRouter = createTRPCRouter({
return { endpoint: null, token: null };
}
// Get User-Agent from request headers
const userAgent = ctx.event.nativeEvent.node.req.headers["user-agent"];
// Block mobile devices - infill is desktop only
if (isMobileDevice(userAgent)) {
return { endpoint: null, token: null };
}
// Return endpoint and token (or null if not configured)
// Now supports both desktop and mobile (fullscreen mode)
return {
endpoint: env.VITE_INFILL_ENDPOINT || null,
token: env.INFILL_BEARER_TOKEN || null