Skip to content

Commit 760aab6

Browse files
committed
Add deployment workflow and new components for app integration
1 parent bb44e8e commit 760aab6

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ jobs:
5252
run: |
5353
pnpm run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
5454
touch .vitepress/dist/.nojekyll
55+
56+
- name: Build Apps
57+
run: |
58+
git clone --depth=1 https://github.com/GUI-for-Cores/GUI.for.SingBox.git
59+
(
60+
cd GUI.for.SingBox/frontend
61+
pnpm install && pnpm build-only
62+
)
63+
mkdir -p .vitepress/dist/apps
64+
mv GUI.for.SingBox/frontend/dist .vitepress/dist/apps/gfs
65+
mv public/fakeruntime.js .vitepress/dist/apps/gfs
66+
sed -i '/<title>/a <script src="./fakeruntime.js"></script>' .vitepress/dist/apps/gfsindex.html
67+
5568
- name: Upload artifact
5669
uses: actions/upload-pages-artifact@v3
5770
with:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup>
2+
import DefaultTheme from "vitepress/theme";
3+
</script>
4+
5+
<template>
6+
<DefaultTheme.Layout>
7+
<template #home-features-before>
8+
<div class="app-preview">
9+
<iframe src="/apps/gfs/"></iframe>
10+
</div>
11+
</template>
12+
</DefaultTheme.Layout>
13+
</template>
14+
15+
<style scoped>
16+
.app-preview {
17+
display: flex;
18+
align-items: center;
19+
justify-content: center;
20+
padding: 0 0 40px 0;
21+
iframe {
22+
width: 800px;
23+
height: 540px;
24+
border: none;
25+
border-radius: 8px;
26+
overflow: hidden;
27+
box-shadow: 0 0 16px rgba(0, 0, 0, 0.4);
28+
}
29+
}
30+
</style>

.vitepress/theme/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import DefaultTheme from "vitepress/theme";
2+
import HomeLayout from "./components/HomeLayout.vue";
3+
4+
export default {
5+
extends: DefaultTheme,
6+
Layout: HomeLayout,
7+
};

public/fakeruntime.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
window.runtime = {
2+
WindowSetSystemDefaultTheme() {},
3+
EventsOnMultiple(id, fn) {
4+
console.log(id, fn)
5+
},
6+
WindowIsMaximised() {},
7+
WindowIsMinimised() {},
8+
}
9+
10+
const events = {
11+
data: [],
12+
on() {},
13+
}
14+
15+
window.go = {
16+
bridge: {
17+
App: {
18+
UpdateTray() {},
19+
UpdateTrayMenus() {},
20+
GetEnv() {
21+
return { os: 'darwin' }
22+
},
23+
Readdir() {
24+
return { flag: true, data: '' }
25+
},
26+
IsStartup() {
27+
return true
28+
},
29+
Requests() {},
30+
Writefile(path, content) {
31+
localStorage.setItem(path, content)
32+
return { flag: true }
33+
},
34+
Readfile(path) {
35+
return { flag: true, data: localStorage.getItem(path) }
36+
},
37+
ExecBackground(path, args, out, end) {
38+
return { flag: true, data: 999 }
39+
},
40+
},
41+
},
42+
}

0 commit comments

Comments
 (0)