jeawin-astro 3.0.37 → 3.0.39
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/package.json +1 -1
- package/src/components/detail_images.astro +10 -13
- package/src/components/iframe_video.astro +21 -0
- package/src/components/index.ts +1 -0
- package/src/components/vimeo.astro +15 -8
- package/src/components/youtube.astro +17 -10
- package/src/integrations/jeawin-astro-toolbar/toolbar.ts +12 -1
- package/src/integrations/jeawin-common-route/index.ts +16 -13
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import Youtube from "./youtube.astro";
|
|
|
15
15
|
import Vimeo from "./vimeo.astro";
|
|
16
16
|
import { img_add_link, render_value,img_change_attrs } from "../scripts/util.js";
|
|
17
17
|
import view360img from "../assets/images/360_view.svg";
|
|
18
|
+
import IframeVideo from "./iframe_video.astro";
|
|
18
19
|
|
|
19
20
|
type JWVIDEO = {
|
|
20
21
|
poster: string; // 图片
|
|
@@ -40,6 +41,12 @@ const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
|
40
41
|
x-data={`{
|
|
41
42
|
isVideoPoppedUp:false,
|
|
42
43
|
closeVideo(){
|
|
44
|
+
if(this.$refs.video){
|
|
45
|
+
const iframe = this.$refs.video.querySelector('iframe');
|
|
46
|
+
if(iframe){
|
|
47
|
+
iframe.src = iframe.src;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
43
50
|
this.isVideoPoppedUp = false;
|
|
44
51
|
},
|
|
45
52
|
openVideo(){
|
|
@@ -150,7 +157,7 @@ const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
|
150
157
|
</swiper-container>
|
|
151
158
|
{
|
|
152
159
|
video ? (
|
|
153
|
-
<div
|
|
160
|
+
<div x-ref="video"
|
|
154
161
|
x-bind:class="{ 'flex': isVideoPoppedUp, 'hidden': !isVideoPoppedUp }"
|
|
155
162
|
class="fixed inset-0 w-full h-full flex items-center justify-center hidden z-10"
|
|
156
163
|
>
|
|
@@ -186,17 +193,7 @@ const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
|
186
193
|
) : video.platform == 'vimeo' ? (
|
|
187
194
|
<Vimeo id={render_value(video, 'id')} />
|
|
188
195
|
) : (
|
|
189
|
-
<
|
|
190
|
-
x-ref="video"
|
|
191
|
-
width="560"
|
|
192
|
-
height="315"
|
|
193
|
-
src={video.id}
|
|
194
|
-
title="video player"
|
|
195
|
-
frameborder="0"
|
|
196
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
197
|
-
referrerpolicy="strict-origin-when-cross-origin"
|
|
198
|
-
allowfullscreen>
|
|
199
|
-
</iframe>
|
|
196
|
+
<IframeVideo id={render_value(video, 'id')} />
|
|
200
197
|
)
|
|
201
198
|
}
|
|
202
199
|
</Fragment>
|
|
@@ -206,7 +203,7 @@ const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
|
206
203
|
) : video.type == 'code' ? (
|
|
207
204
|
<Fragment set:html={video.code} />
|
|
208
205
|
) : (
|
|
209
|
-
<video
|
|
206
|
+
<video class="rounded-lg w-full max-w-2xl" controls>
|
|
210
207
|
<source src={video.local_url} type="video/mp4" />
|
|
211
208
|
</video>
|
|
212
209
|
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
const { id, width = 560, height = 315, title = 'Video player' } = Astro.props;
|
|
4
|
+
let url = id;
|
|
5
|
+
|
|
6
|
+
const currenttime = dayjs().unix();
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<div id={`iframe-video-placeholder${currenttime}`} style={`width:${width}px;height:${height}px;`}></div>
|
|
10
|
+
|
|
11
|
+
<script is:inline define:vars={{currenttime, url: url, width, height, title}}>
|
|
12
|
+
window.addEventListener('load', function() {
|
|
13
|
+
let iframe = document.createElement('iframe');
|
|
14
|
+
iframe.src = url;
|
|
15
|
+
iframe.width = width;
|
|
16
|
+
iframe.height = height;
|
|
17
|
+
iframe.title = title;
|
|
18
|
+
iframe.allowFullscreen = true;
|
|
19
|
+
document.getElementById(`iframe-video-placeholder${currenttime}`).appendChild(iframe);
|
|
20
|
+
});
|
|
21
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export {default as Tabs} from "./tabs.astro";
|
|
|
57
57
|
export {default as TagsCategoryList} from "./tags_category_list.astro";
|
|
58
58
|
export {default as Vimeo} from "./vimeo.astro";
|
|
59
59
|
export {default as Youtube} from "./youtube.astro";
|
|
60
|
+
export {default as IframeVideo} from "./iframe_video.astro";
|
|
60
61
|
export {default as Chatbot} from "./chatbot.astro";
|
|
61
62
|
|
|
62
63
|
export * from "./bgs/index.ts";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
const { id, width = 640, height = 360, title = 'Vimeo player' } = Astro.props;
|
|
3
4
|
let url = "";
|
|
4
5
|
if (id.indexOf("https") !== -1) {
|
|
5
6
|
// 是url形式
|
|
@@ -8,12 +9,18 @@ if (id.indexOf("https") !== -1) {
|
|
|
8
9
|
// 是id形式
|
|
9
10
|
url = `https://player.vimeo.com/video/${id}`;
|
|
10
11
|
}
|
|
12
|
+
const currenttime = dayjs().unix();
|
|
11
13
|
---
|
|
14
|
+
<div id={`vimeo-placeholder${currenttime}`} style={`width:${width}px;height:${height}px;`}></div>
|
|
12
15
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
<script is:inline define:vars={{currenttime, url: url, width, height, title}}>
|
|
17
|
+
window.addEventListener('load', function() {
|
|
18
|
+
let iframe = document.createElement('iframe');
|
|
19
|
+
iframe.src = url;
|
|
20
|
+
iframe.width = width;
|
|
21
|
+
iframe.height = height;
|
|
22
|
+
iframe.title = title;
|
|
23
|
+
iframe.allowFullscreen = true;
|
|
24
|
+
document.getElementById(`vimeo-placeholder${currenttime}`).appendChild(iframe);
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
const { id, width = 560, height = 315, title = 'Youtube video player' } = Astro.props;
|
|
3
4
|
let url = "";
|
|
4
5
|
if (id.indexOf("https") !== -1) {
|
|
5
6
|
// 是url形式
|
|
@@ -8,14 +9,20 @@ if (id.indexOf("https") !== -1) {
|
|
|
8
9
|
// 是id形式
|
|
9
10
|
url = `https://www.youtube.com/embed/${id}`;
|
|
10
11
|
}
|
|
12
|
+
|
|
13
|
+
const currenttime = dayjs().unix();
|
|
11
14
|
---
|
|
12
15
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<div id={`youtube-placeholder${currenttime}`} style={`width:${width}px;height:${height}px;`}></div>
|
|
17
|
+
|
|
18
|
+
<script is:inline define:vars={{currenttime, url: url, width, height, title}}>
|
|
19
|
+
window.addEventListener('load', function() {
|
|
20
|
+
let iframe = document.createElement('iframe');
|
|
21
|
+
iframe.src = url;
|
|
22
|
+
iframe.width = width;
|
|
23
|
+
iframe.height = height;
|
|
24
|
+
iframe.title = title;
|
|
25
|
+
iframe.allowFullscreen = true;
|
|
26
|
+
document.getElementById(`youtube-placeholder${currenttime}`).appendChild(iframe);
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -6,7 +6,18 @@ export default defineToolbarApp({
|
|
|
6
6
|
// canvas.appendChild(text);
|
|
7
7
|
app.onToggled(async (options) => {
|
|
8
8
|
// 清除缓存
|
|
9
|
-
|
|
9
|
+
if(window.location.href.indexOf('preview.jeawin')){
|
|
10
|
+
// 是预览,第一段uri
|
|
11
|
+
// 获取路径部分
|
|
12
|
+
const path = window.location.pathname;
|
|
13
|
+
|
|
14
|
+
// 分割路径并获取第一段
|
|
15
|
+
const segments = path.split('/').filter(segment => segment.length > 0); // 过滤掉空字符串
|
|
16
|
+
const firstSegment = segments.length > 0 ? segments[0] : null;
|
|
17
|
+
await fetch(`/${firstSegment ? `${firstSegment}/` : ''}clear_cache`);
|
|
18
|
+
}else{
|
|
19
|
+
await fetch('/clear_cache');
|
|
20
|
+
}
|
|
10
21
|
alert('清除缓存成功');
|
|
11
22
|
|
|
12
23
|
});
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @email chaegumi@jeawin.com
|
|
8
8
|
* @filesource
|
|
9
9
|
*/
|
|
10
|
+
import _ from 'lodash';
|
|
10
11
|
import {writeFile,mkdir} from "node:fs/promises";
|
|
11
12
|
import {fileURLToPath} from "node:url";
|
|
12
13
|
import {defineIntegration, addVirtualImports,createResolver} from "astro-integration-kit";
|
|
@@ -26,53 +27,55 @@ export default defineIntegration({
|
|
|
26
27
|
|
|
27
28
|
const {config, addMiddleware, injectRoute} = params;
|
|
28
29
|
|
|
30
|
+
const viteBase = _.get(config, ['vite.base'], '');
|
|
31
|
+
|
|
29
32
|
// addMiddleware({
|
|
30
33
|
// entrypoint: '',
|
|
31
34
|
// order:'pre'
|
|
32
35
|
// });
|
|
33
36
|
|
|
34
37
|
injectRoute({
|
|
35
|
-
pattern: '
|
|
38
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}robots.txt`,
|
|
36
39
|
entrypoint: resolve('./routes/robots.txt.ts'),
|
|
37
40
|
prerender: true
|
|
38
41
|
});
|
|
39
42
|
injectRoute({
|
|
40
|
-
pattern: '
|
|
43
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}clear_cache`,
|
|
41
44
|
entrypoint: resolve('./routes/clear_cache.ts'),
|
|
42
45
|
prerender: true
|
|
43
46
|
});
|
|
44
47
|
injectRoute({
|
|
45
|
-
pattern: '
|
|
48
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}manifest.json`,
|
|
46
49
|
entrypoint: resolve('./routes/manifest.json.ts'),
|
|
47
50
|
prerender: true
|
|
48
51
|
});
|
|
49
52
|
injectRoute({
|
|
50
|
-
pattern: '
|
|
53
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}opensearch.xml`,
|
|
51
54
|
entrypoint: resolve('./routes/opensearch.xml.ts'),
|
|
52
55
|
prerender: true
|
|
53
56
|
});
|
|
54
57
|
injectRoute({
|
|
55
|
-
pattern: '
|
|
58
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}rss.xml`,
|
|
56
59
|
entrypoint: resolve('./routes/rss.xml.ts'),
|
|
57
60
|
prerender: true
|
|
58
61
|
});
|
|
59
62
|
injectRoute({
|
|
60
|
-
pattern: '
|
|
63
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}site.webmanifest`,
|
|
61
64
|
entrypoint: resolve('./routes/site.webmanifest.ts'),
|
|
62
65
|
prerender: true
|
|
63
66
|
});
|
|
64
67
|
injectRoute({
|
|
65
|
-
pattern: '
|
|
68
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}sitemap.txt`,
|
|
66
69
|
entrypoint: resolve('./routes/sitemap.txt.ts'),
|
|
67
70
|
prerender: true
|
|
68
71
|
});
|
|
69
72
|
injectRoute({
|
|
70
|
-
pattern: '
|
|
73
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}sitemap.xml`,
|
|
71
74
|
entrypoint: resolve('./routes/sitemap.xml.ts'),
|
|
72
75
|
prerender: true
|
|
73
76
|
});
|
|
74
77
|
injectRoute({
|
|
75
|
-
pattern: '
|
|
78
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}sitemap.xsl`,
|
|
76
79
|
entrypoint: resolve('./routes/sitemap.xsl.ts'),
|
|
77
80
|
prerender: true
|
|
78
81
|
});
|
|
@@ -80,12 +83,12 @@ export default defineIntegration({
|
|
|
80
83
|
if(options?.amp){
|
|
81
84
|
// AMP需要的文件
|
|
82
85
|
injectRoute({
|
|
83
|
-
pattern: '
|
|
86
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}sw.js`,
|
|
84
87
|
entrypoint: resolve('./routes/sw.js.ts'),
|
|
85
88
|
prerender: true
|
|
86
89
|
});
|
|
87
90
|
injectRoute({
|
|
88
|
-
pattern: '
|
|
91
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}install_sw.html`,
|
|
89
92
|
entrypoint: resolve('./routes/install_sw.html.ts'),
|
|
90
93
|
prerender: true
|
|
91
94
|
});
|
|
@@ -93,12 +96,12 @@ export default defineIntegration({
|
|
|
93
96
|
|
|
94
97
|
// 谷歌验证文件
|
|
95
98
|
injectRoute({
|
|
96
|
-
pattern: '
|
|
99
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}google644a0e8e598e1092.html`,
|
|
97
100
|
entrypoint: resolve('./routes/google644a0e8e598e1092.html.ts'),
|
|
98
101
|
prerender: true
|
|
99
102
|
});
|
|
100
103
|
injectRoute({
|
|
101
|
-
pattern: '
|
|
104
|
+
pattern: `/${viteBase ? `${viteBase}/` : ''}googlef1564b538eef5383.html`,
|
|
102
105
|
entrypoint: resolve('./routes/googlef1564b538eef5383.html.ts'),
|
|
103
106
|
prerender: true
|
|
104
107
|
});
|