Skip to content

Commit

Permalink
Add deployment workflow and new components for app integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayideyia committed Jan 21, 2025
1 parent bb44e8e commit 760aab6
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ jobs:
run: |
pnpm run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
touch .vitepress/dist/.nojekyll
- name: Build Apps
run: |
git clone --depth=1 https://github.com/GUI-for-Cores/GUI.for.SingBox.git
(
cd GUI.for.SingBox/frontend
pnpm install && pnpm build-only
)
mkdir -p .vitepress/dist/apps
mv GUI.for.SingBox/frontend/dist .vitepress/dist/apps/gfs
mv public/fakeruntime.js .vitepress/dist/apps/gfs
sed -i '/<title>/a <script src="./fakeruntime.js"></script>' .vitepress/dist/apps/gfsindex.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
30 changes: 30 additions & 0 deletions .vitepress/theme/components/HomeLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup>
import DefaultTheme from "vitepress/theme";
</script>

<template>
<DefaultTheme.Layout>
<template #home-features-before>
<div class="app-preview">
<iframe src="/apps/gfs/"></iframe>
</div>
</template>
</DefaultTheme.Layout>
</template>

<style scoped>
.app-preview {
display: flex;
align-items: center;
justify-content: center;
padding: 0 0 40px 0;
iframe {
width: 800px;
height: 540px;
border: none;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 16px rgba(0, 0, 0, 0.4);
}
}
</style>
7 changes: 7 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import DefaultTheme from "vitepress/theme";
import HomeLayout from "./components/HomeLayout.vue";

export default {
extends: DefaultTheme,
Layout: HomeLayout,
};
42 changes: 42 additions & 0 deletions public/fakeruntime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
window.runtime = {
WindowSetSystemDefaultTheme() {},
EventsOnMultiple(id, fn) {
console.log(id, fn)
},
WindowIsMaximised() {},
WindowIsMinimised() {},
}

const events = {
data: [],
on() {},
}

window.go = {
bridge: {
App: {
UpdateTray() {},
UpdateTrayMenus() {},
GetEnv() {
return { os: 'darwin' }
},
Readdir() {
return { flag: true, data: '' }
},
IsStartup() {
return true
},
Requests() {},
Writefile(path, content) {
localStorage.setItem(path, content)
return { flag: true }
},
Readfile(path) {
return { flag: true, data: localStorage.getItem(path) }
},
ExecBackground(path, args, out, end) {
return { flag: true, data: 999 }
},
},
},
}

0 comments on commit 760aab6

Please sign in to comment.