import { get_server_settings } from "@cocalc/database/postgres/server-settings";
import { database } from "./database";
export default function getHandler() {
return async (_req, res) => {
const settings = await get_server_settings(database);
res.header("Content-Type", "text/plain");
res.header("Cache-Control", "public, max-age=3600, must-revalidate");
if (!settings.landing_pages) {
res.write(`User-agent: *
Allow: /share
Disallow: /
`);
} else {
res.write(`User-agent: *
Disallow: /static/
Disallow: /projects/
Disallow: /*/raw/
Disallow: /*/port/
Disallow: /*/server/
Disallow: /haproxy
`);
}
res.end();
};
}