diff --git a/src/constants.ts b/src/constants.ts
index 98d5dac..eb23bd5 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -270,3 +270,27 @@ export function isStrongPassword(password: string) {
password.match(/[0-9]/)
);
}
+
+export const isInChina = () =>
+ doFetchGet('/api/ip')
+ .then((res) => {
+ if (res.ok) {
+ return res.json();
+ }
+ return Promise.resolve({});
+ })
+ .then(
+ (data: {
+ ip: string;
+ mm?: {
+ country_code?: string;
+ };
+ }) => {
+ if (data.mm?.country_code === 'CN') {
+ // 判断中国ip只是用来防止有墙的网站,没别的意思
+ console.log('ip', data.ip, 'is in china.');
+ return true;
+ }
+ return false;
+ },
+ );
diff --git a/src/views/yisibite/Download.vue b/src/views/yisibite/Download.vue
index 04fd7e0..4759d67 100644
--- a/src/views/yisibite/Download.vue
+++ b/src/views/yisibite/Download.vue
@@ -24,13 +24,15 @@ type MachineDef = {
hasX?: boolean;
hasY?: boolean;
hasZ?: boolean;
+ link?: string;
+ linkChina?: string;
};
type Machine = MachineDef & {
conditions: { [key: string]: ((v: number) => any)[] };
};
-const names = ref<{ [key: string]: Machine }>({});
+const generators = ref<{ [key: string]: Machine }>({});
const updateDownloads = () =>
doFetchGet('/api/mc-services/yisibite/')
@@ -63,8 +65,8 @@ const updateDownloads = () =>
},
};
}
- names.value = machines;
- if (name.value === '') name.value = Object.keys(names.value)[0];
+ generators.value = machines;
+ if (name.value === '') name.value = Object.keys(generators.value)[0];
}
})
.catch((e) => console.error(e));
@@ -105,9 +107,9 @@ function submit(e: SubmitEventPromise) {
{{
$t('litematica_generator.download_count', {
- count: names[name]?.downloads ?? '查询失败',
+ count: generators[name]?.downloads ?? '查询失败',
})
}}
-
-
+
+
mdi-link
- https://www.bilibili.com/video/BV1za4y1P7cw
+ {{ generators[name]?.link }}
@@ -138,13 +140,17 @@ function submit(e: SubmitEventPromise) {
{{ $t('litematica_generator.size_description') }}
-
+
{{ $t('litematica_generator.size_x') }}
@@ -152,10 +158,10 @@ function submit(e: SubmitEventPromise) {
density="compact"
variant="underlined"
v-model="xSize"
- :rules="names[name]?.conditions?.x || []"
+ :rules="generators[name]?.conditions?.x || []"
/>
-
+
{{ $t('litematica_generator.size_y') }}
@@ -163,10 +169,10 @@ function submit(e: SubmitEventPromise) {
density="compact"
variant="underlined"
v-model="ySize"
- :rules="names[name]?.conditions?.y || []"
+ :rules="generators[name]?.conditions?.y || []"
/>
-
+
{{ $t('litematica_generator.size_z') }}
@@ -174,14 +180,14 @@ function submit(e: SubmitEventPromise) {
density="compact"
variant="underlined"
v-model="zSize"
- :rules="names[name]?.conditions?.z || []"
+ :rules="generators[name]?.conditions?.z || []"
/>