This commit is contained in:
BIN
app/assets/fonts/NotoSansSC-VF.ttf
Normal file
BIN
app/assets/fonts/NotoSansSC-VF.ttf
Normal file
Binary file not shown.
@@ -47,20 +47,32 @@ const findTemplatePathBySite = (site) => {
|
||||
|
||||
const findUnicodeFontPath = (site) => {
|
||||
const safeSite = [1, 2, 3].includes(Number(site)) ? Number(site) : 1;
|
||||
const fileName = "NotoSansCJKsc-Regular.otf";
|
||||
const primaryFileName = "NotoSansSC-VF.ttf";
|
||||
const fallbackFileName = "NotoSansCJKsc-Regular.otf";
|
||||
const cwd = process.cwd();
|
||||
const candidatePaths = [
|
||||
path.join(ROOT_DIR, "app", "assets", "fonts", fileName),
|
||||
path.join(ROOT_DIR, "app", "views", "upload", fileName),
|
||||
path.join(ROOT_DIR, "client", "build", "upload", fileName),
|
||||
path.join(ROOT_DIR, "client", "public", "upload", fileName),
|
||||
path.join(cwd, "app", "assets", "fonts", fileName),
|
||||
path.join(cwd, "app", "views", "upload", fileName),
|
||||
path.join(cwd, "client", "build", "upload", fileName),
|
||||
path.join(cwd, "client", "public", "upload", fileName),
|
||||
path.join("/www/wwwroot/upload", fileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", fileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", fileName)
|
||||
path.join(ROOT_DIR, "app", "assets", "fonts", primaryFileName),
|
||||
path.join(ROOT_DIR, "app", "views", "upload", primaryFileName),
|
||||
path.join(ROOT_DIR, "client", "build", "upload", primaryFileName),
|
||||
path.join(ROOT_DIR, "client", "public", "upload", primaryFileName),
|
||||
path.join(cwd, "app", "assets", "fonts", primaryFileName),
|
||||
path.join(cwd, "app", "views", "upload", primaryFileName),
|
||||
path.join(cwd, "client", "build", "upload", primaryFileName),
|
||||
path.join(cwd, "client", "public", "upload", primaryFileName),
|
||||
path.join("/www/wwwroot/upload", primaryFileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", primaryFileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", primaryFileName),
|
||||
path.join(ROOT_DIR, "app", "assets", "fonts", fallbackFileName),
|
||||
path.join(ROOT_DIR, "app", "views", "upload", fallbackFileName),
|
||||
path.join(ROOT_DIR, "client", "build", "upload", fallbackFileName),
|
||||
path.join(ROOT_DIR, "client", "public", "upload", fallbackFileName),
|
||||
path.join(cwd, "app", "assets", "fonts", fallbackFileName),
|
||||
path.join(cwd, "app", "views", "upload", fallbackFileName),
|
||||
path.join(cwd, "client", "build", "upload", fallbackFileName),
|
||||
path.join(cwd, "client", "public", "upload", fallbackFileName),
|
||||
path.join("/www/wwwroot/upload", fallbackFileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", fallbackFileName),
|
||||
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", fallbackFileName)
|
||||
];
|
||||
return candidatePaths.find((candidate) => fs.existsSync(candidate)) || "";
|
||||
};
|
||||
@@ -278,7 +290,7 @@ exports.exportRouteReportZip = async (req, res) => {
|
||||
return res.status(500).send({ message: `Missing PDF template for site ${site}.` });
|
||||
}
|
||||
if (!unicodeFontPath) {
|
||||
return res.status(500).send({ message: "Missing Unicode font file: NotoSansCJKsc-Regular.otf" });
|
||||
return res.status(500).send({ message: "Missing Unicode font file: NotoSansSC-VF.ttf" });
|
||||
}
|
||||
|
||||
const [routes, drivers, vehicles] = await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user