mirror of
https://github.com/gkd-kit/docs.git
synced 2024-12-26 13:45:38 +08:00
feat: refactor image and APK data handling; replace mirror.data with mirror.load and update related components
This commit is contained in:
parent
6370c3abbe
commit
79bf73f544
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import DownloadText from './DownloadText.vue';
|
import DownloadText from './DownloadText.vue';
|
||||||
import { data } from '../data/apk.data';
|
import { betaRelease, stableRelease } from '../data/apk.load';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<table>
|
<table>
|
||||||
|
@ -16,17 +16,20 @@ import { data } from '../data/apk.data';
|
||||||
<tr>
|
<tr>
|
||||||
<td>正式版</td>
|
<td>正式版</td>
|
||||||
<td>
|
<td>
|
||||||
<DownloadText :href="data.stable.href" :name="data.stable.filename" />
|
<DownloadText
|
||||||
|
:href="stableRelease.href"
|
||||||
|
:name="stableRelease.filename"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ data.stable.date }}</td>
|
<td>{{ stableRelease.date }}</td>
|
||||||
<td>稳定版</td>
|
<td>稳定版</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>测试版</td>
|
<td>测试版</td>
|
||||||
<td>
|
<td>
|
||||||
<DownloadText :href="data.beta.href" :name="data.beta.filename" />
|
<DownloadText :href="betaRelease.href" :name="betaRelease.filename" />
|
||||||
</td>
|
</td>
|
||||||
<td>{{ data.beta.date }}</td>
|
<td>{{ betaRelease.date }}</td>
|
||||||
<td>更新快不稳定</td>
|
<td>更新快不稳定</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { cutsomFetch } from './fetch';
|
||||||
|
|
||||||
export interface VersionInfo {
|
export interface VersionInfo {
|
||||||
name: string;
|
name: string;
|
||||||
date: string;
|
date: string;
|
||||||
|
@ -10,7 +12,7 @@ export interface ApkData {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getVersionInfo = async (url: string): Promise<VersionInfo> => {
|
const getVersionInfo = async (url: string): Promise<VersionInfo> => {
|
||||||
const r = await fetch(url).then((r) => r.json());
|
const r = await cutsomFetch(url).then((r) => r.json());
|
||||||
return {
|
return {
|
||||||
name: r.versionName,
|
name: r.versionName,
|
||||||
href: new URL(r.downloadUrl, url).href,
|
href: new URL(r.downloadUrl, url).href,
|
||||||
|
@ -19,21 +21,10 @@ const getVersionInfo = async (url: string): Promise<VersionInfo> => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const stableRelease = await getVersionInfo(
|
export const stableRelease = await getVersionInfo(
|
||||||
'https://registry.npmmirror.com/@gkd-kit/app/latest/files/index.json',
|
'https://registry.npmmirror.com/@gkd-kit/app/latest/files/index.json',
|
||||||
);
|
);
|
||||||
const betaRelease = await getVersionInfo(
|
|
||||||
|
export const betaRelease = await getVersionInfo(
|
||||||
'https://registry.npmmirror.com/@gkd-kit/app-beta/latest/files/index.json',
|
'https://registry.npmmirror.com/@gkd-kit/app-beta/latest/files/index.json',
|
||||||
);
|
);
|
||||||
|
|
||||||
const load = async (): Promise<ApkData> => {
|
|
||||||
return {
|
|
||||||
stable: stableRelease,
|
|
||||||
beta: betaRelease,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
load,
|
|
||||||
};
|
|
||||||
export declare const data: ApkData;
|
|
19
docs/.vitepress/data/fetch.ts
Normal file
19
docs/.vitepress/data/fetch.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
const retryCount = 10;
|
||||||
|
|
||||||
|
export const cutsomFetch = async (
|
||||||
|
input: string | URL | globalThis.Request,
|
||||||
|
init?: RequestInit,
|
||||||
|
) => {
|
||||||
|
let i = retryCount;
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
return await fetch(input, init);
|
||||||
|
} catch (e) {
|
||||||
|
i--;
|
||||||
|
if (i <= 0) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
await new Promise((r) => setTimeout(r, 500));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,12 +0,0 @@
|
||||||
const load = async (): Promise<string> => {
|
|
||||||
const version = await fetch(
|
|
||||||
'https://registry.npmmirror.com/@gkd-kit/assets/latest/files/package.json',
|
|
||||||
).then((r) => r.json().then((j) => j.version as string));
|
|
||||||
|
|
||||||
return `https://registry.npmmirror.com/@gkd-kit/assets/${version}/files/assets/`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
load,
|
|
||||||
};
|
|
||||||
export declare const data: string;
|
|
8
docs/.vitepress/data/mirror.load.ts
Normal file
8
docs/.vitepress/data/mirror.load.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { cutsomFetch } from './fetch';
|
||||||
|
|
||||||
|
const version = await cutsomFetch(
|
||||||
|
'https://registry.npmmirror.com/@gkd-kit/assets/latest/files/package.json',
|
||||||
|
).then((r) => r.json().then((j) => j.version as string));
|
||||||
|
const data = `https://registry.npmmirror.com/@gkd-kit/assets/${version}/files/assets/`;
|
||||||
|
|
||||||
|
export default data;
|
|
@ -1,4 +1,4 @@
|
||||||
import { data as mirrorHost } from '../data/mirror.data';
|
import mirrorHost from '../data/mirror.load';
|
||||||
const imgHost = 'https://a.gkd.li/';
|
const imgHost = 'https://a.gkd.li/';
|
||||||
|
|
||||||
export const convertSrc = (name: string): string => {
|
export const convertSrc = (name: string): string => {
|
||||||
|
|
|
@ -54,24 +54,28 @@
|
||||||
|
|
||||||
## 受限制的设置 {#restriction}
|
## 受限制的设置 {#restriction}
|
||||||
|
|
||||||
无障碍列表界面提示 `受限制的设置(出于安全考虑,此设置目前不可用)`
|
无障碍列表界面提示
|
||||||
|
|
||||||
这是 Android13 的限制, 对于不在应用商店等可信任来源安装的应用不能直接开启无障碍权限
|
> 受限制的设置(出于安全考虑,此设置目前不可用)
|
||||||
|
|
||||||
您需要解除这个限制, 到系统设置-应用管理-找到并点击GKD-右上角-允许受限制的设置
|
某些系统对于不在应用商店等可信任来源安装的应用不能直接开启无障碍权限
|
||||||
|
|
||||||
以 LineageOS 20 为例, 下面为完整的解除限制流程截图
|
解除步骤: GKD 应用信息-右上角-允许受限制的设置
|
||||||
|
|
||||||
<ImageTable :images="[['0013.png', '0014.png', '0015.png', '0016.png'], ['0017.png', '0018.png']]" />
|
<ImageTable :images="[['0014.png', '0015.png', '0016.png','0017.png',]]" />
|
||||||
|
|
||||||
如果您按照以上步骤设置后回到 无障碍列表 仍然提示不可用, 您可以试试 **重启手机**, 或尝试下面一条方案
|
如果按步骤开启后 无障碍列表 仍然提示不可用, 可尝试 **重启设备**
|
||||||
|
|
||||||
|
如果应用信息右上角没有 `允许受限制的设置` 选项, 请参考下一节方案
|
||||||
|
|
||||||
## 无法开启无障碍 {#unable_open_a11y}
|
## 无法开启无障碍 {#unable_open_a11y}
|
||||||
|
|
||||||
有的手机如 ColorOS 会魔改系统收紧权限, 如果你是浏览器下载后安装或着 GKD 内部自更新安装后会无法开启无障碍, 并且表现以下行为之一
|
某些系统如 ColorOS 有更严格的无障碍限制
|
||||||
|
|
||||||
- 显示 受限制的设置 但是根据 [解决方法](#restriction) 没有找到 `允许受限制的设置` 的选项
|
如果你是其他来源安装或 GKD 内部更新后也会无法开启无障碍, 表现以下行为
|
||||||
- 直接点击开启无障碍按钮后但无法开启无障碍没有响应
|
|
||||||
|
- 提示 受限制的设置, 但是没有找到 允许受限制的设置 的选项
|
||||||
|
- 不提示 受限制的设置, 无障碍开启按钮可点击, 但点击后没有响应, 无法开启
|
||||||
|
|
||||||
可以通过以下方式解决, 可在 [开始使用](/guide/) 获取 APK 文件
|
可以通过以下方式解决, 可在 [开始使用](/guide/) 获取 APK 文件
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,4 @@
|
||||||
|
|
||||||
<ImageTable :images="[['0001.png','0002.png','0003.png','0004.png'], ['0005.png','0006.png','0007.png','0008.png']]" />
|
<ImageTable :images="[['0001.png','0002.png','0003.png','0004.png'], ['0005.png','0006.png','0007.png','0008.png']]" />
|
||||||
|
|
||||||
如果您的手机的无障碍列表界面无法授权 GKD 或者显示 `受限制的设置(出于安全考虑,此设置目前不可用)`
|
如遇到问题可在 [常见问题](/guide/faq) 查阅解决方案
|
||||||
|
|
||||||
这是 Android13 的限制, 对于不在应用商店等可信任来源安装的应用不能直接开启无障碍权限
|
|
||||||
|
|
||||||
您需要解除这个限制, 解除限制的方法在 [常见问题](/guide/faq)
|
|
||||||
|
|
||||||
限制解除后, 重新按照上面的授权流程即可开启无障碍权限
|
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
import unocss from 'unocss/vite';
|
import unocss from 'unocss/vite';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { mirror } from './.vitepress/plugins';
|
import { mirror } from './.vitepress/plugins';
|
||||||
|
import data from 'unplugin-data/vite';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [unocss(), mirror()],
|
plugins: [
|
||||||
|
data({
|
||||||
|
include: (v) => v.endsWith('.load.ts'),
|
||||||
|
}),
|
||||||
|
unocss(),
|
||||||
|
mirror(),
|
||||||
|
],
|
||||||
server: {
|
server: {
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8633,
|
port: 8633,
|
||||||
|
|
25
package.json
25
package.json
|
@ -13,28 +13,29 @@
|
||||||
"@gkd-kit/selector": "0.4.2",
|
"@gkd-kit/selector": "0.4.2",
|
||||||
"@types/file-saver": "2.0.7",
|
"@types/file-saver": "2.0.7",
|
||||||
"@types/jsdom": "21.1.7",
|
"@types/jsdom": "21.1.7",
|
||||||
"@types/node": "22.9.0",
|
"@types/node": "22.10.1",
|
||||||
"acorn-walk": "8.3.4",
|
"acorn-walk": "8.3.4",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"jsdom": "25.0.1",
|
"jsdom": "25.0.1",
|
||||||
"magic-string": "0.30.12",
|
"magic-string": "0.30.14",
|
||||||
"markdown-it-mathjax3": "4.3.2",
|
"markdown-it-mathjax3": "4.3.2",
|
||||||
"naive-ui": "2.40.1",
|
"naive-ui": "2.40.3",
|
||||||
"prettier": "3.3.3",
|
"prettier": "3.4.2",
|
||||||
"tsx": "4.19.2",
|
"tsx": "4.19.2",
|
||||||
"typedoc": "0.26.11",
|
"typedoc": "0.27.3",
|
||||||
"typedoc-plugin-markdown": "4.2.10",
|
"typedoc-plugin-markdown": "4.3.1",
|
||||||
"typedoc-vitepress-theme": "1.0.2",
|
"typedoc-vitepress-theme": "1.1.1",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.7.2",
|
||||||
"unocss": "0.64.0",
|
"unocss": "0.65.1",
|
||||||
|
"unplugin-data": "0.1.1",
|
||||||
"vitepress": "1.5.0"
|
"vitepress": "1.5.0"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "22.8.0",
|
"node": "22.12.0",
|
||||||
"pnpm": "9.12.0"
|
"pnpm": "9.14.4"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.12.0",
|
"packageManager": "pnpm@9.14.4",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
"ignoreMissing": [
|
"ignoreMissing": [
|
||||||
|
|
598
pnpm-lock.yaml
598
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user