Skip to content

Commit

Permalink
style: Modify 404 page.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 11, 2021
1 parent 42b5453 commit a0f6728
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/utils/404.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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, <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 64 64"><path fill="transparent" stroke="currentColor" stroke-width="4px" stroke-miterlimit="10" d="M56,53.71H8.17L8,21.06a2.13,2.13,0,0,1,2.13-2.13h2.33l2.13-4.28A4.78,4.78,0,0,1,18.87,12h9.65a4.78,4.78,0,0,1,4.28,2.65l2.13,4.28H52.29a3.55,3.55,0,0,1,3.55,3.55Z"/></svg>'); }
.files li a.file::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="12" height="14" viewBox="0 0 12 14"> <g fill="none" fill-rule="evenodd"> <path fill="transparent" stroke="currentColor" d="M10.6150009,13 L1.385,12.9999991 L1.385,0.999999057 L6.9625,1 C7.25305777,0.999618992 7.53185416,1.11473492 7.7375,1.32 L10.295,3.88 C10.5002651,4.08564584 10.615381,4.36444223 10.615,4.655 L10.6150009,13 Z"/> <rect width="4" height=".2" x="3.85" y="7.5" fill="transparent" stroke="currentColor"/> <rect width="4" height=".2" x="3.85" y="10" fill="transparent" stroke="currentColor"/> <polyline fill="transparent" stroke="currentColor" fill-rule="nonzero" stroke-width=".5" points="6.822 1.077 6.822 4.758 10.338 4.758"/> </g> </svg>'); }
.files li a.license::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7 4c-.83 0-1.5-.67-1.5-1.5S6.17 1 7 1s1.5.67 1.5 1.5S7.83 4 7 4zm7 6c0 1.11-.89 2-2 2h-1c-1.11 0-2-.89-2-2l2-4h-1c-.55 0-1-.45-1-1H8v8c.42 0 1 .45 1 1h1c.42 0 1 .45 1 1H3c0-.55.58-1 1-1h1c0-.55.58-1 1-1h.03L6 5H5c0 .55-.45 1-1 1H3l2 4c0 1.11-.89 2-2 2H2c-1.11 0-2-.89-2-2l2-4H1V5h3c0-.55.45-1 1-1h4c.55 0 1 .45 1 1h3v1h-1l2 4zM2.5 7L1 10h3L2.5 7zM13 10l-1.5-3-1.5 3h3z"></path></svg>'); }
.files li a.js::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 48 48"> <path d="M0,0 L42,0 L42,42 L0,42 L0,0 Z M11.0366667,35.0933333 C11.97,37.0766667 13.8133333,38.71 16.9633333,38.71 C20.4633333,38.71 22.8666667,36.8433333 22.8666667,32.76 L22.8666667,19.2733333 L18.9,19.2733333 L18.9,32.6666667 C18.9,34.6733333 18.0833333,35.1866667 16.8,35.1866667 C15.4466667,35.1866667 14.8866667,34.2533333 14.2566667,33.1566667 L11.0366667,35.0933333 Z M24.99,34.6733333 C26.1566667,36.96 28.5133333,38.71 32.2,38.71 C35.9333333,38.71 38.7333333,36.7733333 38.7333333,33.2033333 C38.7333333,29.9133333 36.8433333,28.4433333 33.4833333,26.9966667 L32.5033333,26.5766667 C30.8,25.8533333 30.0766667,25.3633333 30.0766667,24.1966667 C30.0766667,23.24 30.8,22.4933333 31.9666667,22.4933333 C33.0866667,22.4933333 33.8333333,22.9833333 34.51,24.1966667 L37.5666667,22.1666667 C36.2833333,19.9266667 34.4633333,19.0633333 31.9666667,19.0633333 C28.4433333,19.0633333 26.18,21.3033333 26.18,24.2666667 C26.18,27.4866667 28.07,29.0033333 30.9166667,30.2166667 L31.8966667,30.6366667 C33.7166667,31.43 34.79,31.92 34.79,33.2733333 C34.79,34.3933333 33.74,35.21 32.1066667,35.21 C30.17,35.21 29.05,34.2066667 28.21,32.8066667 L24.99,34.6733333 Z" transform="translate(3 3)"/> </svg>'); }
.files li a.json::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="16" height="14" viewBox="0 0 48 48"> <path fill="currentColor" d="M11.2857143,8 L15,8 L15,11.6666667 L11.2857143,11.6666667 L11.2857143,20.8333333 C11.2857143,22.8583774 9.62277193,24.5 7.57142857,24.5 C9.62277193,24.5 11.2857143,26.1416226 11.2857143,28.1666667 L11.2857143,37.3333333 L15,37.3333333 L15,41 L11.2857143,41 C9.29857143,40.505 7.57142857,39.35 7.57142857,37.3333333 L7.57142857,30 C7.57142857,27.9749559 5.90848621,26.3333333 3.85714286,26.3333333 L2,26.3333333 L2,22.6666667 L3.85714286,22.6666667 C5.90848621,22.6666667 7.57142857,21.0250441 7.57142857,19 L7.57142857,11.6666667 C7.57142857,9.64162258 9.23437093,8 11.2857143,8 Z M36.7142857,8 C38.7656291,8 40.4285714,9.64162258 40.4285714,11.6666667 L40.4285714,19 C40.4285714,21.0250441 42.0915138,22.6666667 44.1428571,22.6666667 L46,22.6666667 L46,26.3333333 L44.1428571,26.3333333 C42.0915138,26.3333333 40.4285714,27.9749559 40.4285714,30 L40.4285714,37.3333333 C40.4285714,39.3583774 38.7656291,41 36.7142857,41 L33,41 L33,37.3333333 L36.7142857,37.3333333 L36.7142857,28.1666667 C36.7142857,26.1416226 38.3772281,24.5 40.4285714,24.5 C38.3772281,24.5 36.7142857,22.8583774 36.7142857,20.8333333 L36.7142857,11.6666667 L33,11.6666667 L33,8 L36.7142857,8 Z M22.5,30 C23.3284271,30 24,30.6715729 24,31.5 C24,32.3284271 23.3284271,33 22.5,33 C21.6715729,33 21,32.3284271 21,31.5 C21,30.6715729 21.6715729,30 22.5,30 Z M16.5,30 C17.3284271,30 18,30.6715729 18,31.5 C18,32.3284271 17.3284271,33 16.5,33 C15.6715729,33 15,32.3284271 15,31.5 C15,30.6715729 15.6715729,30 16.5,30 Z M31.5,30 C32.3284271,30 33,30.6715729 33,31.5 C33,32.3284271 32.3284271,33 31.5,33 C30.6715729,33 30,32.3284271 30,31.5 C30,30.6715729 30.6715729,30 31.5,30 Z"/> </svg>'); }
.files li a.svg::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="14" height="14"><path d="M354.401 0c-87.04 0-157.44 70.559-157.44 157.599V433.28H78.72c-21.658 0-39.363 17.7-39.363 39.363V708.96c0 21.658 17.7 39.358 39.363 39.358h118.241V866.4c0 87.04 70.4 157.599 157.44 157.599H827.04c87.04 0 157.598-70.559 157.598-157.599V315.034c0-41.749-38.988-81.93-107.52-149.28L848 136.633l-29.123-29.112C751.54 38.989 711.393 0 669.6 0H354.406z m0 78.72h287.202c28.354 7.091 27.996 42.138 27.996 76.8v120.161c0 21.658 17.7 39.358 39.362 39.358H827.04c39.388 0 78.878-0.026 78.878 39.362v512c0 43.32-35.553 78.879-78.878 78.879H354.406c-43.325 0-78.72-35.558-78.72-78.879V748.32h393.918c21.663 0 39.362-17.695 39.362-39.358V472.643c0-21.663-17.7-39.363-39.362-39.363H275.68V157.599c0-43.32 35.395-78.879 78.72-78.879z m-115.2 426.721c17.28 0 32.64 3.2 46.08 9.6l-7.68 18.238c-13.44-5.76-26.24-8.638-38.4-8.638-10.24 0-17.92 2.238-23.04 6.718s-7.68 10.562-7.68 18.242c0 8.96 1.92 15.678 5.76 20.158 4.48 3.84 15.038 9.6 31.678 17.28 17.28 7.04 28.482 14.402 33.602 22.082 5.76 7.04 8.638 16 8.638 26.88 0 14.72-5.12 26.558-15.36 35.518s-24.96 13.44-44.16 13.44c-18.56 0-33.28-2.56-44.16-7.68v-21.12c15.36 6.4 30.08 9.6 44.16 9.6 12.8 0 22.082-2.238 27.842-6.718 6.4-4.48 9.6-11.52 9.6-21.12 0-7.68-2.242-14.08-6.722-19.2-3.2-3.2-15.038-9.282-35.518-18.242-13.44-6.4-23.04-13.44-28.8-21.12S186.4 561.76 186.4 549.6c0-13.44 4.48-24.002 13.44-31.682 9.6-8.32 22.722-12.478 39.362-12.478z m295.68 0c17.92 0 33.92 3.2 48 9.6L574.24 535.2c-14.08-7.04-27.838-10.558-41.278-10.558-18.56 0-33.28 6.078-44.16 18.238S472.48 572.64 472.48 595.68s4.802 40.638 14.402 52.798c10.24 11.52 25.6 17.28 46.08 17.28 9.6 0 19.84-1.28 30.72-3.84v-51.84H528.16V589.92h57.6v86.4c-17.92 5.76-37.438 8.638-58.558 8.638-23.68 0-42.562-7.68-56.642-23.04s-21.12-37.76-21.12-67.2c0-28.16 7.362-49.92 22.082-65.28 15.36-16 36.48-23.998 63.36-23.998z m-235.202 1.92h24.002l35.518 111.36c3.2 10.88 6.722 24.32 10.562 40.32 1.92-11.52 5.438-25.282 10.558-41.282L415.84 507.36h23.04L380.314 683.04h-22.068L299.674 507.36z"></path></svg>'); }
.files li a.gitignore::before, .files li a.git::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 1024 1024"><path d="M1004.702047 466.392861L557.607139 19.313953c-25.737937-25.753937-67.495835-25.753937-93.267773 0l-103.881746 103.875746 78.169809 78.169809A95.623767 95.623767 0 0 1 480.011328 191.999531c53.019871 0 95.999766 42.979895 95.999766 95.999766 0 14.819964-3.363992 28.85393-9.361977 41.385899l127.975687 127.973687A95.631767 95.631767 0 0 1 736.010703 447.998906c53.019871 0 95.999766 42.979895 95.999766 95.999766s-42.979895 95.999766-95.999766 95.999766-95.999766-42.979895-95.999765-95.999766c0-14.819964 3.363992-28.85393 9.361977-41.385899l-127.975688-127.973688a95.253767 95.253767 0 0 1-9.383977 3.875991v266.967348c37.281909 13.181968 63.999844 48.717881 63.999844 90.515779 0 53.019871-42.979895 95.999766-95.999766 95.999766s-95.999766-42.979895-95.999766-95.999766c0-41.795898 26.717935-77.333811 63.999844-90.515779V378.515076c-37.281909-13.179968-63.999844-48.719881-63.999844-90.515779 0-14.819964 3.363992-28.85193 9.359978-41.383899l-78.16981-78.169809L19.312453 464.320866c-25.749937 25.775937-25.749937 67.533835 0 93.287773l447.118908 447.078908c25.737937 25.749937 67.483835 25.749937 93.267773 0l445.004913-445.004913c25.757937-25.761937 25.757937-67.539835-0.002-93.289773z"></path></svg>'); }
.files li a.md::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 48 48"> <path fill="currentColor" d="M42.8236518,9 L5.17634821,9 C3.4245,9 2,10.4031375 2,12.1298375 L2,36.8667719 C2,38.5946344 3.4245,40 5.17634821,40 L42.8236518,40 C44.5755,40 46,38.5946344 46,36.866675 L46,12.1298375 C46,10.4031375 44.5755,9 42.8236518,9 Z M26.7522589,33.8 L21.2475446,33.8 L21.2475446,24.5 L17.1186161,29.7194312 L12.9914554,24.5 L12.9914554,33.8 L7.48713393,33.8 L7.48713393,15.2 L12.9914554,15.2 L17.1186161,21.7855625 L21.2475446,15.2 L26.7522589,15.2 L26.7522589,33.8 Z M34.9685714,33.8 L28.1294196,24.5 L32.2544196,24.5 L32.2544196,15.2 L37.7586429,15.2 L37.7586429,24.5 L41.8862946,24.5 L34.9668036,33.8 L34.9685714,33.8 Z"/> </svg>'); }
.files li a.ts::before, .files li a.tsx::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 48 48"> <path fill="currentColor" fill-rule="evenodd" d="M2,2 L2,46 L46,46 L46,2 L2,2 Z M35.4507885,23 L35.4507885,23.000639 C35.8678929,23.0019759 36.3419062,23.023928 36.6984556,23.0634681 C38.1503891,23.2241367 39.281104,23.8648481 40.243054,25.0716616 C40.7220993,25.672822 40.8859922,25.9358848 40.8510665,26.0483877 C40.828563,26.1209732 40.4998902,26.3617863 39.4548904,27.0713385 C38.4283663,27.7683723 38.0976274,27.9771411 38.0208675,27.9771411 C37.9429936,27.9771411 37.7808118,27.8064076 37.5469502,27.4785495 C37.0965832,26.8472597 36.6367812,26.559138 35.9259318,26.4630574 C35.1614892,26.3595072 34.4758107,26.6059624 34.1399864,27.1051974 C33.852958,27.5316986 33.8095993,28.2181221 34.0377477,28.7167901 C34.3020574,29.2944728 34.7805163,29.6138253 36.6141061,30.4362294 C38.7288394,31.3846581 39.800492,32.0338642 40.5809902,32.839497 C41.421489,33.7071007 41.8473142,34.7088747 41.9781257,36.1258201 C42.0419931,36.816431 41.9639635,37.6350185 41.7707356,38.300527 C41.2968822,39.9319661 40.0181594,41.1265664 38.1438336,41.6888082 C37.6257367,41.8441772 37.1436317,41.9369972 36.6667399,41.9727098 C35.9387795,42.0275317 34.8966795,41.9973237 34.2694877,41.903917 C32.6826915,41.6675377 30.8914155,40.7230565 29.9982296,39.6521145 C29.5597604,39.1264576 29,38.2613402 29,38.1091118 C29,38.0356681 29.0355782,37.9939918 29.1765689,37.9023058 C29.5946222,37.630661 31.9904564,36.2297563 32.0369387,36.2297563 C32.0650254,36.2297563 32.1901705,36.3806543 32.3149159,36.5649859 C32.5975627,36.9823927 33.2925377,37.699829 33.6458461,37.9391852 C33.9344844,38.1346831 34.3035393,38.2916986 34.7416993,38.4049757 C34.9926506,38.468964 35.1255198,38.4803713 35.6730839,38.4803713 C36.2325245,38.4801794 36.3473231,38.4705463 36.5976027,38.4017807 C37.2596136,38.2195319 37.7763992,37.8424504 37.9953779,37.3818177 C38.0913693,37.1827649 38.0932435,37.1579133 38.0932435,36.6751443 L38.0932435,36.1746444 L37.9755984,35.9358988 C37.6905849,35.3572237 37.0764636,34.9602195 35.1349516,34.0999982 C34.2430984,33.7048478 33.1508166,33.1476984 32.7243731,32.8705032 C31.7512077,32.2379266 31.076702,31.5147327 30.6340537,30.6294962 C30.1937508,29.7491668 30.1280891,29.4214832 30.127023,28.0977723 C30.1259388,27.0615724 30.1242597,27.0742872 30.3339974,26.4129006 C30.5242978,25.8127325 30.9138539,25.1422951 31.3438902,24.6748144 C32.202225,23.7415758 33.4561715,23.1418439 34.7987223,23.0225475 C34.9704511,23.0059245 35.200432,22.999421 35.4506691,23.0001843 L35.4507885,23 Z M23.9020909,24.0001913 L23.9025033,24.0001913 C26.4603506,24.0014888 27.9266331,24.010364 27.9501519,24.025182 C27.9944852,24.0527074 28,24.275882 28,25.7003928 L28,27.3437743 L25.4476369,27.3530683 L22.8952738,27.3623622 L22.8952738,34.6284117 C22.8952738,38.6248289 22.8872015,41.9182539 22.8761171,41.9473338 C22.8580668,41.9962397 22.6617591,42 21.0010515,42 L19.1461297,42 L19.126973,41.9248217 C19.1145861,41.8835696 19.1055551,38.5900504 19.1053442,34.6058997 L19.1047262,27.3619508 L16.5523631,27.3528631 L14,27.3435692 L14,25.7196447 C14,24.4316718 14.0088738,24.0867319 14.0430509,24.0524706 C14.0781708,24.0161641 15.3807714,24.0068025 20.9934179,24.0012509 C22.0755962,24.0001575 23.0494618,23.999689 23.9021479,24.0002178 L23.9020909,24.0001913 Z"/> </svg>'); }
.files li a.ts::before, .files li a.tsx::before { content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 1024 1024"><path d="M0 512v512h1024V0H0z m825.216-40.8a127.424 127.424 0 0 1 64.032 36.896c9.44 10.08 23.424 28.416 24.544 32.864 0.352 1.28-44.192 31.136-71.168 47.904-0.992 0.64-4.896-3.584-9.248-10.08-13.216-19.2-27.008-27.488-48.128-28.928-31.072-2.144-51.04 14.112-50.848 41.248l-0.032 1.6c0 6.432 1.632 12.512 4.48 17.824l-0.096-0.192c6.816 14.112 19.552 22.624 59.296 39.808 73.344 31.584 104.704 52.352 124.192 81.92 21.76 32.992 26.656 85.664 11.872 124.832-16.224 42.592-56.544 71.52-113.28 81.056-17.536 3.104-59.136 2.656-77.984-0.768-41.12-7.328-80.128-27.648-104.192-54.304-9.44-10.368-27.808-37.536-26.656-39.456 0.48-0.672 4.704-3.296 9.376-6.016 4.608-2.592 21.792-12.544 38.048-21.984l29.44-17.056 6.176 9.12c8.608 13.152 27.424 31.2 38.816 37.216 32.672 17.248 77.536 14.816 99.616-5.024a37.6 37.6 0 0 0 13.344-30.784v0.096c0-11.872-1.504-17.056-7.68-26.016-7.936-11.36-24.192-20.896-70.368-40.96-52.832-22.752-75.552-36.864-96.384-59.296a134.88 134.88 0 0 1-27.872-50.24l-0.256-0.96c-3.872-14.464-4.864-50.72-1.792-65.312 10.88-51.072 49.408-86.624 104.992-97.184 18.048-3.424 60-2.144 77.696 2.272z m-240.384 42.752l0.352 41.952H451.84v378.72h-94.304V555.904H224.32v-41.12c0-22.784 0.48-41.824 1.12-42.24 0.512-0.672 81.632-1.024 179.936-0.864l178.976 0.512z" fill="currentColor"></path></svg>'); }
.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, <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 48 48"> <path fill="currentColor" d="M27,17 L39,17 L27,5 L27,17 Z M11.3744396,2.00045085 L28.8746638,2.00045085 L42,15.2005861 L42,41.5999549 C42,44.0300327 40.0411956,46 37.6248879,46 L11.3751121,46 C8.94693496,46 7,44.019991 7,41.5999549 L7,6.40004508 C7,3.95803021 8.94691254,2 11.3751121,2 L11.3744396,2.00045085 Z M11.0009222,41.9997823 L38,41.9997823 L38,25 L29,33.5 L24.5,29.25 L11,42 L11.0009222,41.9997823 Z M15.5,17 C13.0147186,17 11,19.0147186 11,21.5 C11,23.9852814 13.0147186,26 15.5,26 C17.9852814,26 20,23.9852814 20,21.5 C20,19.0147186 17.9852814,17 15.5,17 Z"/> </svg>'); }
Expand Down Expand Up @@ -77,7 +81,7 @@
</ul>
</main>
<footer>
Powered by <a target="_blank" href="https://github.com/jaywcjlove/ssr">sgo</a>
Powered by <a target="_blank" href="https://github.com/jaywcjlove/ssr">SGO v<%= version %></a>
</footer>
</body>
</html>
4 changes: 3 additions & 1 deletion src/utils/notFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ 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();
if (res.fileDir && res.projectDir) {
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,
Expand Down

0 comments on commit a0f6728

Please sign in to comment.