App store mdx support (#2325)
* Adds initial MDX implementation for App Store pages * Adds endpoint to serve app store static files * Replaces zoom icon with dynamic-served one * Fixes zoom icon * Makes Slider reusable * Adds gray-matter for MDX * Adds zoom screenshots * Update yarn.lock * Slider improvements * WIP * Update TrendingAppsSlider.tsx * WIP * Adds MS teams screenshots * Adds stripe screenshots * Cleanup * Update index.ts * WIP * Cleanup * Cleanup * Adds jitsi screenshot * Adds Google meet screenshots * Adds office 365 calendar screenshots * Adds google calendar screenshots Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
79 files changed
+2291
-1045
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import fs from "fs";
|
||||
import mime from "mime-types";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import path from "path";
|
||||
|
||||
/**
|
||||
* This endpoint should allow us to access to the private files in the static
|
||||
* folder of each individual app in the App Store.
|
||||
* @example
|
||||
* ```text
|
||||
* Requesting: `/api/app-store/zoomvideo/icon.svg` from a public URL should
|
||||
* serve us the file located at: `/packages/app-store/zoomvideo/static/icon.svg`
|
||||
* ```
|
||||
* This will allow us to keep all app-specific static assets in the same directory.
|
||||
*/
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const [appName, fileName] = Array.isArray(req.query.static) ? req.query.static : [req.query.static];
|
||||
const fileNameParts = fileName.split(".");
|
||||
const { [fileNameParts.length - 1]: fileExtentsion } = fileNameParts;
|
||||
const STATIC_PATH = path.join(process.cwd(), "..", "..", "packages/app-store", appName, "static", fileName);
|
||||
|
||||
try {
|
||||
const imageBuffer = fs.readFileSync(STATIC_PATH);
|
||||
const mimeType = mime.lookup(fileExtentsion);
|
||||
if (mimeType) res.setHeader("Content-Type", mimeType);
|
||||
res.send(imageBuffer);
|
||||
} catch (e) {
|
||||
res.status(400).json({ error: true, message: "Image not found" });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user