diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..ff6c763 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,21 @@ +name: Build and Deploy +on: + push: + branches: [ master, action ] +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + + - name: Install and Build + run: | + npm install + npm run preview + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: preview # The branch the action should deploy to. + folder: dist # The folder the action should deploy. diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml deleted file mode 100644 index e858f86..0000000 --- a/.github/workflows/workflow.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Build and Deploy -on: - push: - branches: [ master, action ] -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v2.3.1 - - - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. - run: | - npm install - npm run prebuild - - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@4.1.5 - with: - branch: preview # The branch the action should deploy to. - folder: dist # The folder the action should deploy. diff --git a/README.md b/README.md index 44b085d..3affc2a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Run `npm install` to install all dependencies for development. Run `npm run build` to compile for production. -Run `npm run prebuild` to compile for GitHub Pages. +Run `npm run preview` to compile for GitHub Pages. Run `npm run serve` to start the development server. @@ -30,8 +30,7 @@ Run `npm run serve` to start the development server. > > ... > ``` -3. Run `public/configs/scripts/gendoc/genjson.py`, this should generate a new `index.json`. Replace old `index.json` - with it. +3. Add your new documentation and its route to `index.json`. 4. Create a merge/pull request to let us know. You can preview this project on [https://iori2333.github.io/Mira](https://iori2333.github.io/Mira/). diff --git a/package.json b/package.json index f001818..3e4e255 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "nju-mirror-vue3", + "name": "mira", "version": "0.1.0", "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", - "prebuild": "vue-tsc --noEmit && vite build --base=/Mira/", + "preview": "vue-tsc --noEmit && vite build --base=/Mira/", "serve": "vite preview" }, "dependencies": { diff --git a/public/configs/news/new.md "b/public/configs/news/2021-08-15-\347\254\254\344\270\200\346\235\241\346\226\260\351\227\273.md" similarity index 100% rename from public/configs/news/new.md rename to "public/configs/news/2021-08-15-\347\254\254\344\270\200\346\235\241\346\226\260\351\227\273.md" diff --git a/public/configs/news/index.json b/public/configs/news/index.json index 0df13a7..2989628 100644 --- a/public/configs/news/index.json +++ b/public/configs/news/index.json @@ -1,7 +1 @@ -[ - { - "name": "第一条新闻", - "time": 1628999604, - "content": "new.md" - } -] \ No newline at end of file +[{"name": "\u7b2c\u4e00\u6761\u65b0\u95fb", "time": 1628956800.0, "content": "2021-08-15-\u7b2c\u4e00\u6761\u65b0\u95fb.md"}] \ No newline at end of file diff --git a/public/configs/scripts/gennews/gennews.py b/public/configs/scripts/gennews/gennews.py new file mode 100644 index 0000000..4847b52 --- /dev/null +++ b/public/configs/scripts/gennews/gennews.py @@ -0,0 +1,20 @@ +import re +import json +import os +import datetime + +FILE_REG = re.compile(r'(\d{4})\-(\d{2})\-(\d{2})-(.+).md') + +if __name__ == '__main__': + entries = [] + for file in os.listdir(): + if (m := FILE_REG.match(file)) != None: + y, m, d, name = m.groups() + date = datetime.datetime(int(y), int(m), int(d)) + entries.append({ + "name": name, + "time": date.timestamp(), + "content": file + }) + with open('index.json', 'w') as f: + json.dump(entries, f) diff --git a/src/assets/Markdown.css b/src/assets/Markdown.css index 029dbf0..82c3f84 100644 --- a/src/assets/Markdown.css +++ b/src/assets/Markdown.css @@ -5,7 +5,10 @@ */ .markdown-body.dark-scheme { - color-scheme: dark; + --color-scheme: dark; + --color-canvas-default: transparent; + --color-canvas-subtle: rgba(45, 45, 45, 0.75); + --color-text-primary: #ffffff; --color-prettylights-syntax-comment: #8b949e; --color-prettylights-syntax-constant: #79c0ff; --color-prettylights-syntax-entity: #d2a8ff; @@ -40,15 +43,18 @@ --color-fg-muted: #8b949e; --color-fg-subtle: #484f58; --color-border-default: #30363d; - --color-border-muted: #21262d; - --color-neutral-muted: rgba(110,118,129,0.4); + --color-border-muted: #676767; + --color-neutral-muted: rgba(45, 45, 45, 0.75); --color-accent-fg: #fcfcfc; --color-accent-emphasis: #fcfcfc; --color-danger-fg: #f85149; } .markdown-body.light-scheme { - color-scheme: light; + --color-scheme: light; + --color-canvas-default: transparent; + --color-canvas-subtle: rgba(235, 235, 235, 0.5); + --color-text-primary: #ffffff; --color-prettylights-syntax-comment: #6e7781; --color-prettylights-syntax-constant: #0550ae; --color-prettylights-syntax-entity: #8250df; @@ -83,8 +89,8 @@ --color-fg-muted: #57606a; --color-fg-subtle: #6e7781; --color-border-default: #d0d7de; - --color-border-muted: hsla(210,18%,87%,1); - --color-neutral-muted: rgba(175,184,193,0.2); + --color-border-muted: hsla(210, 18%, 87%, 1); + --color-neutral-muted: rgba(235, 235, 235, 0.5); --color-accent-fg: #6f106e; --color-accent-emphasis: #6f106e; --color-danger-fg: #cf222e; @@ -146,7 +152,6 @@ .markdown-body abbr[title] { border-bottom: none; - -webkit-text-decoration: underline dotted; text-decoration: underline dotted; } @@ -218,8 +223,6 @@ height: .25em; padding: 0; margin: 24px 0; - background-color: var(--color-border-default); - border: 0; } .markdown-body html [type=button], @@ -305,7 +308,7 @@ cursor: pointer; } -.markdown-body details:not([open])>*:not(summary) { +.markdown-body details:not([open]) > *:not(summary) { display: none !important; } @@ -572,11 +575,11 @@ content: ""; } -.markdown-body>*:first-child { +.markdown-body > *:first-child { margin-top: 0 !important; } -.markdown-body>*:last-child { +.markdown-body > *:last-child { margin-bottom: 0 !important; } @@ -612,19 +615,19 @@ margin-bottom: 16px; } -.markdown-body blockquote>:first-child { +.markdown-body blockquote > :first-child { margin-top: 0; } -.markdown-body blockquote>:last-child { +.markdown-body blockquote > :last-child { margin-bottom: 0; } -.markdown-body sup>a::before { +.markdown-body sup > a::before { content: "["; } -.markdown-body sup>a::after { +.markdown-body sup > a::after { content: "]"; } @@ -691,7 +694,7 @@ list-style-type: lower-roman; } -.markdown-body div>ol:not([type]) { +.markdown-body div > ol:not([type]) { list-style-type: decimal; } @@ -703,11 +706,11 @@ margin-bottom: 0; } -.markdown-body li>p { +.markdown-body li > p { margin-top: 16px; } -.markdown-body li+li { +.markdown-body li + li { margin-top: .25em; } @@ -770,7 +773,7 @@ overflow: hidden; } -.markdown-body span.frame>span { +.markdown-body span.frame > span { display: block; float: left; width: auto; @@ -798,7 +801,7 @@ clear: both; } -.markdown-body span.align-center>span { +.markdown-body span.align-center > span { display: block; margin: 13px auto 0; overflow: hidden; @@ -816,7 +819,7 @@ clear: both; } -.markdown-body span.align-right>span { +.markdown-body span.align-right > span { display: block; margin: 13px 0 0; overflow: hidden; @@ -846,7 +849,7 @@ overflow: hidden; } -.markdown-body span.float-right>span { +.markdown-body span.float-right > span { display: block; margin: 13px auto 0; overflow: hidden; @@ -875,7 +878,7 @@ font-size: 100%; } -.markdown-body pre>code { +.markdown-body pre > code { padding: 0; margin: 0; word-break: normal; @@ -906,7 +909,6 @@ .markdown-body pre code, .markdown-body pre tt { display: inline; - max-width: auto; padding: 0; margin: 0; overflow: visible; diff --git a/src/i18n/en.json b/src/i18n/en.json index 71b01dc..b216990 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1,5 +1,5 @@ { - "locale": "English", + "locale": "中文", "mirror": "NJU Open Source Mirror", "header": { "mirrors": "Mirrors", diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 7459f10..743994b 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -4,7 +4,7 @@ import zh from './zh.json'; export const i18n = createI18n({ legacy: false, - locale: 'zh', + locale: 'en', fallbackLocale: 'en', messages: { en, zh } }); diff --git a/src/i18n/zh.json b/src/i18n/zh.json index 3702faf..d315b61 100644 --- a/src/i18n/zh.json +++ b/src/i18n/zh.json @@ -1,5 +1,5 @@ { - "locale": "中文", + "locale": "English", "mirror": "南京大学开源镜像站", "header": { "mirrors": "镜像列表", diff --git a/src/views/MainPage.vue b/src/views/MainPage.vue index 68f1d2c..abc8529 100644 --- a/src/views/MainPage.vue +++ b/src/views/MainPage.vue @@ -1,6 +1,7 @@