From a0f67281c253a26534dca52d24db03e9e876ca49 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sat, 11 Sep 2021 23:30:21 +0800 Subject: [PATCH] style: Modify 404 page. --- src/utils/404.ejs | 10 +++++++--- src/utils/notFound.ts | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/404.ejs b/src/utils/404.ejs index 4f8f44a..0c29f6c 100644 --- a/src/utils/404.ejs +++ b/src/utils/404.ejs @@ -22,14 +22,18 @@ .files li a { color: #1A00F2; white-space: nowrap; overflow: hidden; display: block; text-overflow: ellipsis; line-height: 24px; align-items: center; display: flex; } .files li a span { overflow: hidden; text-overflow: ellipsis; } .files li a:hover { color: #000; } - .files li a::before { margin-right: 5px; width: 16px; text-align: center; line-height: 14px; margin-top: 1px; } + .files li a::before { + margin-right: 5px; width: 16px; text-align: center; line-height: 14px; margin-top: 1px; + } .files li a.dir::before { color: #333; content: url('data:image/svg+xml; utf8, '); } .files li a.file::before { content: url('data:image/svg+xml; utf8, '); } .files li a.license::before { content: url('data:image/svg+xml; utf8, '); } .files li a.js::before { content: url('data:image/svg+xml; utf8, '); } .files li a.json::before { content: url('data:image/svg+xml; utf8, '); } + .files li a.svg::before { content: url('data:image/svg+xml; utf8, '); } + .files li a.gitignore::before, .files li a.git::before { content: url('data:image/svg+xml; utf8, '); } .files li a.md::before { content: url('data:image/svg+xml; utf8, '); } - .files li a.ts::before, .files li a.tsx::before { content: url('data:image/svg+xml; utf8, '); } + .files li a.ts::before, .files li a.tsx::before { content: url('data:image/svg+xml; utf8, '); } .files li a.png::before, .files li a.jpg::before, .files li a.jpeg::before, .files li a.bmp::before, .files li a.svgz::before { content: url('data:image/svg+xml; utf8, '); } @@ -77,7 +81,7 @@ \ No newline at end of file diff --git a/src/utils/notFound.ts b/src/utils/notFound.ts index d29e7e3..19666af 100644 --- a/src/utils/notFound.ts +++ b/src/utils/notFound.ts @@ -11,6 +11,7 @@ export default async (res: IServerResponse, resource: string, message: string = const filename: string = path.join(__dirname, '404.ejs'); const projectName: string = path.basename(res.projectDir) let html: string = ''; + const pgk = require('../../package.json'); try { let nav = [{ name: projectName, path: '/' }]; html = (await fs.readFile(filename)).toString(); @@ -18,9 +19,10 @@ export default async (res: IServerResponse, resource: string, message: string = let dirs = await getFileDirectory(res.fileDir, res.projectDir); dirs = sortDirs(dirs); nav = [...nav, ...splitPath(res.pathname)]; - html = await ejs.render(html, { + html = ejs.render(html, { title: `Files within sgo${(nav[nav.length - 1] && nav[nav.length - 1].path) || '/'}`, nav, + version: pgk.version, projectName, date: [...dirs], message,