You can easily generate QRCodes by using the API, with no rate
limitation.
-
-
+
+
If you are not sure how to use the API, you can fill the QRCode form
and copy the generated API URL.
@@ -58,7 +59,7 @@ const { copy: copyBaseApiUrl, icon: baseApiUrlIcon } = useCopyable(baseApiUrl);
("/api/logos");
+
const formSchema = z
.object({
hasLogo: z.boolean(),
- logo: z.enum(LOGOS).optional(),
+ logo: z.string().optional(),
format: z.enum(IMAGE_FORMATS).default("png"),
content: z
.string()
@@ -103,7 +105,7 @@ const {
+ >
{
+ const files = await readdir(logosDir);
+ return files
+ .filter((f) => f.endsWith(".png"))
+ .map((f) => f.replace(/\.png$/, ""))
+ .sort();
+}, {
+ maxAge: 60 * 60 * 24,
+ getKey: async () => {
+ const files = await readdir(logosDir);
+ const key = files.filter((f) => f.endsWith(".png")).sort().join(",");
+ return createHash("sha256").update(key).digest("hex");
+ },
+});
diff --git a/shared/utils/settings.ts b/shared/utils/settings.ts
index 94c8252..135d076 100644
--- a/shared/utils/settings.ts
+++ b/shared/utils/settings.ts
@@ -1,60 +1,12 @@
import { z } from "zod";
-// TODO: might be better to load these dynamically lol
-export const LOGOS = [
- "bereal",
- "bitcoin",
- "buymeacoffee",
- "diaspora",
- "discord",
- "dropbox",
- "ello",
- "facebook",
- "flickr",
- "github",
- "googlemaps",
- "googlemeet",
- "googlemessages",
- "imessage",
- "instagram",
- "kik",
- "line",
- "linkedin",
- "litecoin",
- "mastodon",
- "medium",
- "messenger",
- "monero",
- "onlyfans",
- "patreon",
- "paypal",
- "peertube",
- "pinterest",
- "reddit",
- "session",
- "signal",
- "snapchat",
- "spotify",
- "substack",
- "telegram",
- "threema",
- "twitch",
- "venmo",
- "viber",
- "wechat",
- "whatsapp",
- "x",
- "youtube",
- "zoom",
-] as const;
-
export const IMAGE_FORMATS = ["png", "jpeg", "webp"] as const;
export type ImageFormat = (typeof IMAGE_FORMATS)[number];
export const settingsSchema = z.object({
format: z.enum(IMAGE_FORMATS).default("png"),
- logo: z.enum(LOGOS).optional(),
+ logo: z.string().optional(),
content: z.string().min(1, "Required"),
});