diff --git a/src/app/about.txt b/src/app/about.txt new file mode 100644 index 0000000..c09552f --- /dev/null +++ b/src/app/about.txt @@ -0,0 +1,6 @@ +This favicon was generated using the following font: + +- Font Title: League Spartan +- Font Author: undefined +- Font Source: https://fonts.gstatic.com/s/leaguespartan/v11/kJEnBuEW6A0lliaV_m88ja5Twtx8BWhtkDVmjZvMV4PpBMdcFguczA.ttf +- Font License: undefined diff --git a/src/app/android-chrome-192x192.png b/src/app/android-chrome-192x192.png new file mode 100644 index 0000000..09c4d9d Binary files /dev/null and b/src/app/android-chrome-192x192.png differ diff --git a/src/app/android-chrome-512x512.png b/src/app/android-chrome-512x512.png new file mode 100644 index 0000000..a00624c Binary files /dev/null and b/src/app/android-chrome-512x512.png differ diff --git a/src/app/api/collage/route.ts b/src/app/api/collage/route.ts deleted file mode 100644 index 4318e2f..0000000 --- a/src/app/api/collage/route.ts +++ /dev/null @@ -1,15 +0,0 @@ -// import { createCollage } from "@/util"; - -// export async function POST(req: Request) { -// try { -// const { images, options } = await req.json(); - -// const collage = await createCollage(images, options); -// return Response.json({ dataUrl: collage }); -// } catch (err) { -// console.error(err); -// return new Response("Failed to create collage", { status: 500 }); -// } -// } - -export async function POST() {} diff --git a/src/app/apple-touch-icon.png b/src/app/apple-touch-icon.png new file mode 100644 index 0000000..1831549 Binary files /dev/null and b/src/app/apple-touch-icon.png differ diff --git a/src/app/favicon-16x16.png b/src/app/favicon-16x16.png new file mode 100644 index 0000000..f521dcd Binary files /dev/null and b/src/app/favicon-16x16.png differ diff --git a/src/app/favicon-32x32.png b/src/app/favicon-32x32.png new file mode 100644 index 0000000..4ca97b1 Binary files /dev/null and b/src/app/favicon-32x32.png differ diff --git a/src/app/favicon.ico b/src/app/favicon.ico index 718d6fe..c02d0e9 100644 Binary files a/src/app/favicon.ico and b/src/app/favicon.ico differ diff --git a/src/app/manifest.ts b/src/app/manifest.ts new file mode 100644 index 0000000..4b2c6bf --- /dev/null +++ b/src/app/manifest.ts @@ -0,0 +1,28 @@ +import { MetadataRoute } from "next"; + +export default function manifest(): MetadataRoute.Manifest { + return { + name: "Flave", + short_name: "Flave", + description: "A recipe search engine", + start_url: "/browse", + lang: "en", + dir: "auto", + icons: [ + { + src: "/android-chrome-192x192.png", + sizes: "192x192", + type: "image/png", + }, + { + src: "/android-chrome-512x512.png", + sizes: "512x512", + type: "image/png", + }, + ], + theme_color: "#f5c518", + background_color: "#ffffff", + display: "standalone", + orientation: "portrait-secondary", + }; +} diff --git a/src/axios/client.ts b/src/axios/client.ts deleted file mode 100644 index 0d5a823..0000000 --- a/src/axios/client.ts +++ /dev/null @@ -1,18 +0,0 @@ -import axios from "axios"; - -export const client = axios.create({ - baseURL: "https://api.flave.ee", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - withCredentials: true, - timeout: 10000, -}); - -client.interceptors.request.use( - (config) => { - return config; - }, - (error) => Promise.reject(error), -); diff --git a/src/axios/interceptors.ts b/src/axios/interceptors.ts deleted file mode 100644 index b21f741..0000000 --- a/src/axios/interceptors.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { client } from "./client"; -import { cookies } from "next/headers"; - -client.interceptors.response.use( - (response) => response, - async (error) => { - if (error.response?.status === 401) { - if (typeof window !== "undefined") { - window.location.href = "/login"; - } - } - return Promise.reject(error); - }, -); - -// In your axios/request setup -client.interceptors.request.use(async (config) => { - if (typeof window === "undefined") { - // Server-side - const sessionToken = (await cookies()).get("session_token")?.value; - - if (sessionToken) { - config.headers.Authorization = `Bearer ${sessionToken}`; - } - } else { - // Client-side - const sessionToken = document.cookie - .split("; ") - .find((row) => row.startsWith("session_token=")) - ?.split("=")[1]; - - if (sessionToken) { - config.headers.Authorization = `Bearer ${sessionToken}`; - } - } - - return config; -}); diff --git a/src/axios/request.ts b/src/axios/request.ts deleted file mode 100644 index fc82899..0000000 --- a/src/axios/request.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { - AxiosError, - AxiosRequestConfig, - AxiosRequestHeaders, - AxiosResponse, - Method, -} from "axios"; - -import { client } from "./client"; - -type RequestOptions = { - method: Method; - endpoint: string; - data?: unknown; - params?: unknown; - headers?: AxiosRequestHeaders; - timeout?: number; -}; - -type ErrorInfo = { - message: string; - code?: string; - cause?: string; - status?: number; - isAxiosError?: boolean; - isNetworkError?: boolean; - config?: AxiosRequestConfig; - data?: unknown; -}; - -export class ApiError extends Error { - public readonly code: string; - status!: number; - url!: string; - - constructor( - public override message: string, - public details: ErrorInfo, - code?: string, - ) { - super(message); - this.name = "ApiError"; - this.code = code || "GENERIC_API_ERROR"; - Object.setPrototypeOf(this, ApiError.prototype); - } -} - -const DEFAULT_TIMEOUT = 10000; - -export const request = async ({ - method, - endpoint, - data, - params, - headers, - timeout = DEFAULT_TIMEOUT, -}: RequestOptions): Promise> => { - if (!endpoint || typeof endpoint !== "string") { - throw new ApiError("Invalid endpoint provided", { - message: "Endpoint must be a valid string", - isAxiosError: false, - isNetworkError: false, - }); - } - - const cleanedEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`; - - try { - const config: AxiosRequestConfig = { - method, - url: cleanedEndpoint, - headers: headers?.toJSON() || {}, - timeout, - params, - validateStatus: (status) => status >= 200 && status < 300, - }; - - if (data && method !== "GET") { - config.data = data; - } - - // console.log(config); - return await client.request(config); - } catch (error) { - const axiosError = error as AxiosError; - - const errorInfo: ErrorInfo = { - message: axiosError.message, - code: axiosError.code, - status: axiosError.response?.status, - isAxiosError: axiosError.isAxiosError || false, - isNetworkError: !axiosError.response, - config: axiosError.config, - data: axiosError.response?.data, - }; - - console.error("Request failed:", { - method, - endpoint: cleanedEndpoint, - error: errorInfo, - }); - - throw new ApiError( - axiosError.response?.data && - typeof axiosError.response.data === "object" && - "message" in axiosError.response.data - ? (axiosError.response.data as { message: string }).message - : axiosError.message, - errorInfo, - ); - } -};