Skip to content

Commit

Permalink
feat: dynamic help url
Browse files Browse the repository at this point in the history
  • Loading branch information
ztelliot committed Feb 29, 2024
1 parent 5073e29 commit fe28cac
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 71 deletions.
94 changes: 27 additions & 67 deletions src/assets/MirrorDetail.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,47 @@
"icon": "icon-almalinux"
},
"alpine": {
"icon": "icon-alpine",
"help": "archlinux"
"icon": "icon-alpine"
},
"anaconda": {
"icon": "icon-anaconda",
"help": "anaconda",
"fill": "#3faf4b"
},
"aosp-monthly": {
"icon": "icon-aosp",
"help": "AOSP"
"icon": "icon-aosp"
},
"apache": {
"icon": "icon-apache"
},
"archlinux": {
"icon": "icon-archlinux",
"help": "archlinux",
"fill": "#1793d1"
},
"archlinuxarm": {
"icon": "icon-archlinux",
"help": "archlinuxarm"
"icon": "icon-archlinux"
},
"archlinuxcn": {
"icon": "icon-archlinux",
"help": "archlinuxcn",
"fill": "#1793d1"
},
"armbian": {
"icon": "icon-armbian",
"help": "armbian"
"icon": "icon-armbian"
},
"armbian-dl": {
"icon": "icon-armbian"
},
"centos": {
"icon": "icon-centos",
"help": "centos",
"fill": "#95267c"
},
"centos-altarch": {
"icon": "icon-centos",
"help": "centos-altarch"
"icon": "icon-centos"
},
"centos-stream": {
"icon": "icon-centos",
"help": "centos-stream"
"icon": "icon-centos"
},
"centos-vault": {
"icon": "icon-centos",
"help": "centos-vault"
"icon": "icon-centos"
},
"ceph": {
"icon": "icon-ceph"
Expand All @@ -64,26 +53,21 @@
"icon": "icon-cmake"
},
"cygwin": {
"icon": "icon-cygwin",
"help": "cygwin"
"icon": "icon-cygwin"
},
"debian": {
"icon": "icon-debian",
"help": "debian",
"fill": "#d70751"
},
"debian-cd": {
"icon": "icon-debian",
"help": "debian-cd",
"fill": "#d70751"
},
"debian-nonfree": {
"icon": "icon-debian",
"help": "debian"
"icon": "icon-debian"
},
"debian-security": {
"icon": "icon-debian",
"help": "debian",
"fill": "#d70751"
},
"deepin": {
Expand All @@ -95,8 +79,7 @@
"fill": "#31bff7"
},
"docker-ce": {
"icon": "icon-docker",
"help": "docker-ce"
"icon": "icon-docker"
},
"dockerhub": {
"icon": "icon-docker"
Expand All @@ -106,16 +89,13 @@
},
"epel": {
"icon": "icon-epel",
"help": "epel",
"fill": "#d70751"
},
"fedora": {
"icon": "icon-fedora",
"help": "fedora"
"icon": "icon-fedora"
},
"fedora-altarch": {
"icon": "icon-fedora",
"help": "fedora"
"icon": "icon-fedora"
},
"gcc": {
"icon": "icon-gcc"
Expand All @@ -130,15 +110,13 @@
"icon": "icon-golang"
},
"homebrew": {
"icon": "icon-homebrew",
"help": "homebrew"
"icon": "icon-homebrew"
},
"homebrew-autoupdate": {
"icon": "icon-homebrew"
},
"homebrew-bottles": {
"icon": "icon-homebrew",
"help": "homebrew-bottles"
"icon": "icon-homebrew"
},
"homebrew-bundle": {
"icon": "icon-homebrew"
Expand Down Expand Up @@ -169,7 +147,6 @@
},
"kali": {
"icon": "icon-kali",
"help": "kali",
"fill": "#4f7992"
},
"kali-images": {
Expand All @@ -180,12 +157,10 @@
"icon": "icon-kde"
},
"kicad": {
"icon": "icon-kicad",
"help": "kicad"
"icon": "icon-kicad"
},
"kubernetes": {
"icon": "icon-kubernetes",
"help": "kubernetes"
"icon": "icon-kubernetes"
},
"linux": {
"icon": "icon-linux"
Expand All @@ -204,8 +179,7 @@
"fill": "#313131"
},
"manjaro": {
"icon": "icon-manjaro",
"help": "manjaro"
"icon": "icon-manjaro"
},
"manjaro-arm": {
"icon": "icon-manjaro"
Expand All @@ -217,16 +191,13 @@
"icon": "icon-maven"
},
"nix": {
"icon": "icon-nix",
"help": "nix"
"icon": "icon-nix"
},
"nix-channels": {
"icon": "icon-nix",
"help": "nix-channels"
"icon": "icon-nix"
},
"nixos-images": {
"icon": "icon-nix",
"help": "nixos-images"
"icon": "icon-nix"
},
"npm": {
"icon": "icon-npm",
Expand All @@ -239,64 +210,53 @@
"icon": "icon-nvidia"
},
"openbsd": {
"icon": "icon-openbsd",
"help": "openbsd"
"icon": "icon-openbsd"
},
"openeuler": {
"icon": "icon-openeuler"
},
"opensuse": {
"icon": "icon-opensuse",
"help": "opensuse"
"icon": "icon-opensuse"
},
"openwrt": {
"icon": "icon-openwrt",
"help": "openwrt"
"icon": "icon-openwrt"
},
"postmarketos": {
"icon": "icon-postmarketos",
"help": "postmarketOS"
"icon": "icon-postmarketos"
},
"postmarketos-images": {
"icon": "icon-postmarketos"
},
"proxmox": {
"icon": "icon-proxmox",
"help": "proxmox"
"icon": "icon-proxmox"
},
"pypi": {
"icon": "icon-pypi",
"help": "pypi",
"fill": "#4277a6"
},
"quay": {
"icon": "icon-quay"
},
"raspberry-pi-os-images": {
"icon": "icon-raspberrypi",
"help": "raspberry-pi-os-images",
"fill": "#b61040"
},
"raspberrypi": {
"icon": "icon-raspberrypi",
"help": "raspberrypi"
"icon": "icon-raspberrypi"
},
"raspbian": {
"icon": "icon-raspberrypi",
"help": "raspbian",
"fill": "#b61040"
},
"ubuntu": {
"icon": "icon-ubuntu",
"help": "ubuntu",
"fill": "#d64613"
},
"ubuntu-cdimage": {
"icon": "icon-ubuntu"
},
"ubuntu-ports": {
"icon": "icon-ubuntu",
"help": "ubuntu-ports"
"icon": "icon-ubuntu"
},
"ubuntu-releases": {
"icon": "icon-ubuntu",
Expand Down
7 changes: 3 additions & 4 deletions src/components/MirrorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<span v-if="size!=='unknown'" class="size-num">{{ size }}</span>
<span v-else class="size-num" />
<svg
v-if="infoMap[id ?? '']?.help!==undefined"
v-if="helpUrl"
id="i-howto"
class="iconfont icon-i"
@click.stop="jumpHelpUrl">
Expand Down Expand Up @@ -82,6 +82,7 @@ export default {
name: String,
description: String,
url: String,
helpUrl: String,
isShrinked: Boolean
},
data () {
Expand All @@ -108,9 +109,7 @@ export default {
window.location.href = this.genSourceUrl()
},
jumpHelpUrl: function () {
window.location.href = `https://help.mirrors.cqupt.edu.cn/${
this.infoMap[this.id]['help']
}/?mirror=CQUPT`
window.location.href = `https://help.mirrors.cqupt.edu.cn/${this.helpUrl}/?mirror=CQUPT`
},
copy: function () {
event.stopPropagation()
Expand Down
3 changes: 3 additions & 0 deletions src/components/MirrorList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:status="item.status"
:size="item.sizeString"
:url="item.url"
:help-url="item.helpUrl"
:description="item.desc"
:is-shrinked="isShrinked" />
</div>
Expand All @@ -29,6 +30,7 @@
:type="choice"
:name="item.alias"
:url="item.url"
:help-url="item.helpUrl"
:description="item.desc"
:upstream="item.upstream" />
</div>
Expand All @@ -44,6 +46,7 @@
:status="item.status"
:size="item.sizeString"
:url="item.url"
:help-url="item.helpUrl"
:description="item.desc"
:is-shrinked="isShrinked" />
</div>
Expand Down
1 change: 1 addition & 0 deletions src/types/MirrorItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type MirrorItem = {
size?: number,
sizeStr?: string,
url?: string,
helpUrl?: string,
type: 'mirror' | 'proxy' | 'git',
errorMsg?: string,
lastOnline?: number,
Expand Down

0 comments on commit fe28cac

Please sign in to comment.