Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Iori Ichinose committed Dec 7, 2021
2 parents 8781224 + aaba42f commit 1c6562c
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 64 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

- name: Install and Build
run: |
npm install
npm run preview
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: preview # The branch the action should deploy to.
folder: dist # The folder the action should deploy.
23 changes: 0 additions & 23 deletions .github/workflows/workflow.yml

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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/).
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
File renamed without changes.
8 changes: 1 addition & 7 deletions public/configs/news/index.json
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
[
{
"name": "第一条新闻",
"time": 1628999604,
"content": "new.md"
}
]
[{"name": "\u7b2c\u4e00\u6761\u65b0\u95fb", "time": 1628956800.0, "content": "2021-08-15-\u7b2c\u4e00\u6761\u65b0\u95fb.md"}]
20 changes: 20 additions & 0 deletions public/configs/scripts/gennews/gennews.py
Original file line number Diff line number Diff line change
@@ -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)
52 changes: 27 additions & 25 deletions src/assets/Markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -146,7 +152,6 @@

.markdown-body abbr[title] {
border-bottom: none;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}

Expand Down Expand Up @@ -218,8 +223,6 @@
height: .25em;
padding: 0;
margin: 24px 0;
background-color: var(--color-border-default);
border: 0;
}

.markdown-body html [type=button],
Expand Down Expand Up @@ -305,7 +308,7 @@
cursor: pointer;
}

.markdown-body details:not([open])>*:not(summary) {
.markdown-body details:not([open]) > *:not(summary) {
display: none !important;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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: "]";
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -770,7 +773,7 @@
overflow: hidden;
}

.markdown-body span.frame>span {
.markdown-body span.frame > span {
display: block;
float: left;
width: auto;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -875,7 +878,7 @@
font-size: 100%;
}

.markdown-body pre>code {
.markdown-body pre > code {
padding: 0;
margin: 0;
word-break: normal;
Expand Down Expand Up @@ -906,7 +909,6 @@
.markdown-body pre code,
.markdown-body pre tt {
display: inline;
max-width: auto;
padding: 0;
margin: 0;
overflow: visible;
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"locale": "English",
"locale": "中文",
"mirror": "NJU Open Source Mirror",
"header": {
"mirrors": "Mirrors",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import zh from './zh.json';

export const i18n = createI18n({
legacy: false,
locale: 'zh',
locale: 'en',
fallbackLocale: 'en',
messages: { en, zh }
});
2 changes: 1 addition & 1 deletion src/i18n/zh.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"locale": "中文",
"locale": "English",
"mirror": "南京大学开源镜像站",
"header": {
"mirrors": "镜像列表",
Expand Down
7 changes: 6 additions & 1 deletion src/views/MainPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed, onMounted, nextTick, ref, onBeforeUnmount } from 'vue';
import { RouterView } from 'vue-router';
import { useI18n } from 'vue-i18n';
import {
NLayout,
NLayoutHeader,
Expand All @@ -23,7 +24,7 @@ const store = useStore();
const loadingBar = useLoadingBar();
const message = useMessage();
const isMobile = computed(() => store.state.isMobile);
const { locale } = useI18n();
const containerRef = ref<{ $el: HTMLDivElement } | null>(null);
let observer: ResizeObserver | undefined;
Expand All @@ -36,6 +37,10 @@ onMounted(() =>
)
);
onMounted(
() => (locale.value = navigator.language.startsWith('zh') ? 'zh' : 'en')
);
nextTick(() => {
window.onresize = () => store.commit('setWidth', document.body.clientWidth);
if (containerRef.value?.$el) {
Expand Down

0 comments on commit 1c6562c

Please sign in to comment.