MCPcopy
hub / github.com/fccview/jotty / generateMetadata

Function generateMetadata

app/layout.tsx:50–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48import { isEnvEnabled } from "./_utils/env-utils";
49
50export const generateMetadata = async (): Promise<Metadata> => {
51 const settings = await getSettings();
52 const user = await getCurrentUser();
53 const ogName = settings?.isRwMarkable ? "rwMarkable" : "jotty·page";
54 const appName = settings?.appName || ogName;
55 const appVersion = new Date().getTime().toString();
56 const appDescription =
57 settings?.appDescription ||
58 "A simple, fast, and lightweight checklist and notes application";
59 const app16x16Icon =
60 settings?.["16x16Icon"] || "/app-icons/favicon-16x16.png";
61 const app32x32Icon =
62 settings?.["32x32Icon"] || "/app-icons/favicon-32x32.png";
63 const app180x180Icon =
64 settings?.["180x180Icon"] || "/app-icons/apple-touch-icon.png";
65 const app512x512Icon =
66 settings?.["512x512Icon"] || "/app-icons/android-chrome-512x512.png";
67 const app192x192Icon =
68 settings?.["192x192Icon"] || "/app-icons/android-chrome-192x192.png";
69
70 const defaultTheme = settings?.isRwMarkable
71 ? "rwmarkable-dark"
72 : user?.preferredTheme || "dark";
73
74 const themeColor = getThemeBackgroundColor(defaultTheme);
75
76 const manifest = JSON.parse(
77 generateWebManifest(
78 appName,
79 appDescription,
80 app16x16Icon,
81 app32x32Icon,
82 app180x180Icon,
83 app512x512Icon,
84 app192x192Icon,
85 themeColor,
86 appVersion,
87 ),
88 );
89
90 try {
91 await writeJsonFile(manifest, path.join("data", "site.webmanifest"));
92 } catch (error) {
93 console.error(
94 "Your data and/or config folders seem to be using the wrong permissions, please fix them by following the instructions here: https://github.com/fccview/jotty/blob/main/howto/DOCKER.md and/or setting the correct env variables from here: https://github.com/fccview/jotty/blob/main/howto/ENV-VARIABLES.md",
95 error,
96 );
97 }
98
99 return {
100 title: appName,
101 description: appDescription,
102 manifest: "/api/manifest",
103 icons: {
104 icon: [
105 {
106 url: app16x16Icon,
107 sizes: "16x16",

Callers

nothing calls this directly

Calls 5

getSettingsFunction · 0.90
getCurrentUserFunction · 0.90
getThemeBackgroundColorFunction · 0.90
generateWebManifestFunction · 0.90
writeJsonFileFunction · 0.90

Tested by

no test coverage detected