@wot-ui/vitepress-theme 2.0.0-alpha.17 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -0
- package/dist/theme/composables/adsData.js +9 -5
- package/dist/theme/composables/banner.js +9 -5
- package/dist/theme/composables/cases.js +27 -25
- package/dist/theme/composables/friendly.js +9 -5
- package/dist/theme/composables/specialSponsor.js +9 -5
- package/dist/theme/composables/sponsor.js +8 -5
- package/dist/theme/composables/team.js +9 -4
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -120,6 +120,7 @@ function createWotVitePressConfig(options) {
|
|
|
120
120
|
head: options.head,
|
|
121
121
|
locales: options.locales,
|
|
122
122
|
themeConfig: options.themeConfig,
|
|
123
|
+
lang: options.lang,
|
|
123
124
|
vite: {
|
|
124
125
|
...userVite,
|
|
125
126
|
plugins: [...internalPlugins, ...normalizePlugins(userVite.plugins)],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useAds() {
|
|
@@ -13,11 +12,16 @@ function useAds() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.ads ? result.ads : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useBanner() {
|
|
@@ -13,11 +12,16 @@ function useBanner() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.data ? result.data : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useCaseData() {
|
|
@@ -10,34 +9,37 @@ function useCaseData() {
|
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
const urls = casesOptions.urls || [];
|
|
12
|
+
const getFullImageUrl = (image, baseUrl) => {
|
|
13
|
+
if (!image)
|
|
14
|
+
return "";
|
|
15
|
+
if (image.startsWith("http://") || image.startsWith("https://")) {
|
|
16
|
+
return image;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const { origin } = new URL(baseUrl);
|
|
20
|
+
return origin + image;
|
|
21
|
+
} catch {
|
|
22
|
+
return baseUrl + image;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
13
25
|
const fetchData = async () => {
|
|
14
26
|
for (const url of urls) {
|
|
15
27
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const data2 = response.data && response.data.data ? response.data.data : [];
|
|
21
|
-
const getFullImageUrl = (image, baseUrl) => {
|
|
22
|
-
if (!image)
|
|
23
|
-
return "";
|
|
24
|
-
if (image.startsWith("http://") || image.startsWith("https://")) {
|
|
25
|
-
return image;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const { origin } = new URL(baseUrl);
|
|
29
|
-
return origin + image;
|
|
30
|
-
} catch {
|
|
31
|
-
return baseUrl + image;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return data2.map((item) => {
|
|
35
|
-
return {
|
|
36
|
-
name: item.name,
|
|
37
|
-
image: getFullImageUrl(item.image, url),
|
|
38
|
-
description: item.description
|
|
39
|
-
};
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
30
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
31
|
+
signal: controller.signal
|
|
40
32
|
});
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
if (!response.ok)
|
|
35
|
+
continue;
|
|
36
|
+
const result = await response.json();
|
|
37
|
+
const caseData = result && result.data ? result.data : [];
|
|
38
|
+
return caseData.map((item) => ({
|
|
39
|
+
name: item.name,
|
|
40
|
+
image: getFullImageUrl(item.image, url),
|
|
41
|
+
description: item.description
|
|
42
|
+
}));
|
|
41
43
|
} catch (error) {
|
|
42
44
|
console.warn(`Failed to fetch from ${url}`);
|
|
43
45
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useFriendly() {
|
|
@@ -13,11 +12,16 @@ function useFriendly() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.links ? result.links : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useSpecialSponsor() {
|
|
@@ -13,11 +12,16 @@ function useSpecialSponsor() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result?.data;
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref();
|
|
5
4
|
function useSponsor() {
|
|
@@ -13,11 +12,15 @@ function useSponsor() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
return await response.json();
|
|
21
24
|
} catch (error) {
|
|
22
25
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
26
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useTeam() {
|
|
@@ -28,10 +27,16 @@ function useTeam() {
|
|
|
28
27
|
const fetchData = async () => {
|
|
29
28
|
for (const url of urls) {
|
|
30
29
|
try {
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
32
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
33
|
+
signal: controller.signal
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
if (!response.ok)
|
|
37
|
+
continue;
|
|
38
|
+
const result = await response.json();
|
|
39
|
+
const members = result && result.members ? result.members : [];
|
|
35
40
|
return normalizeMembers(members);
|
|
36
41
|
} catch (error) {
|
|
37
42
|
console.warn(`Failed to fetch team from ${url}`);
|
package/dist/types.d.ts
CHANGED