mirror of
https://github.com/gethomepage/homepage.git
synced 2026-02-07 08:20:53 +08:00
Some checks failed
Crowdin Action / Crowdin Sync (push) Has been cancelled
Docker CI / Linting Checks (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Repository Maintenance / Stale (push) Has been cancelled
Repository Maintenance / Lock Old Threads (push) Has been cancelled
Repository Maintenance / Close Answered Discussions (push) Has been cancelled
Repository Maintenance / Close Outdated Discussions (push) Has been cancelled
Repository Maintenance / Close Unsupported Feature Requests (push) Has been cancelled
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import checkAndCopyConfig, { getSettings } from "utils/config/config";
|
|
import themes from "utils/styles/themes";
|
|
|
|
export async function getServerSideProps({ res }) {
|
|
checkAndCopyConfig("settings.yaml");
|
|
const settings = getSettings();
|
|
|
|
const color = settings.color || "slate";
|
|
const theme = settings.theme || "dark";
|
|
|
|
const pwa = settings.pwa || {};
|
|
|
|
const manifest = {
|
|
name: settings.title || "Homepage",
|
|
short_name: settings.title || "Homepage",
|
|
icons: pwa.icons || [
|
|
{
|
|
src: "/android-chrome-192x192.png?v=2",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "/android-chrome-512x512.png?v=2",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
},
|
|
],
|
|
shortcuts: pwa.shortcuts,
|
|
theme_color: themes[color][theme],
|
|
background_color: themes[color][theme],
|
|
display: "standalone",
|
|
start_url: settings.startUrl || "/",
|
|
};
|
|
|
|
res.setHeader("Content-Type", "application/manifest+json");
|
|
res.write(JSON.stringify(manifest));
|
|
res.end();
|
|
|
|
return {
|
|
props: {},
|
|
};
|
|
}
|
|
|
|
export default function Webmanifest() {
|
|
return null;
|
|
}
|