34 changed files with 621 additions and 324 deletions
@ -0,0 +1,113 @@ |
|||
# https://zhuanlan.zhihu.com/p/164901026 |
|||
# https://www.antmoe.com/posts/18c087cf/ |
|||
# https://zhuanlan.zhihu.com/p/348712087 |
|||
# https://cloud.tencent.com/developer/article/1949574 |
|||
# 此工作流的名字 |
|||
name: Build |
|||
# 工作流的执行时机,可以设定为定时执行,每次push后执行,手动执行等 |
|||
on: |
|||
# workflow_dispatch为在Github仓库的Actions面板中手动执行 |
|||
# workflow_dispatch: |
|||
push: |
|||
branches: |
|||
- master |
|||
# 工作/任务,这里的工作是可以并行的。 |
|||
jobs: |
|||
# 工作的名称“编译windows版” |
|||
build: |
|||
# 运行的操作系统 windows |
|||
runs-on: ${{ matrix.os }} |
|||
env: |
|||
GH_TOKEN: ${{ secrets.ELECTRON_TOKEN }} |
|||
IS_ACTIONS: true |
|||
strategy: |
|||
matrix: |
|||
# https://www.likecs.com/ask-314443.html |
|||
node-version: [18.17.1] |
|||
os: [windows-2022, ubuntu-latest] |
|||
# 步骤 |
|||
steps: |
|||
# 使用预制action:拉取最新的代码 |
|||
- uses: actions/checkout@v3 |
|||
with: |
|||
ref: master |
|||
# https://pnpm.io/zh/continuous-integration/#github-actions |
|||
- uses: pnpm/action-setup@v2.2.4 |
|||
name: Install pnpm |
|||
id: pnpm-install |
|||
with: |
|||
version: 8.7.6 |
|||
# 安装node |
|||
- name: Use Node.js ${{ matrix.node-version }} |
|||
uses: actions/setup-node@v3 |
|||
with: |
|||
node-version: ${{ matrix.node-version }} |
|||
cache: 'pnpm' |
|||
- name: Install dependencies |
|||
run: pnpm install |
|||
# 安装python |
|||
- name: Use Python 3.9.13 |
|||
uses: actions/setup-python@v4 |
|||
with: |
|||
python-version: 3.9.13 |
|||
env: |
|||
PYTHON_VERSION: 3.9.13 |
|||
# https://docs.microsoft.com/zh-cn/visualstudio/releases/2017/vs2017-system-requirements-vs |
|||
# 将windows设置成windows-2016,2016要取消支持了,可换成2022 |
|||
# - name: set msvs |
|||
# run: npm config set msvs_version 2022 |
|||
# https://github.com/wxWidgets/wxWidgets/blob/master/.github/workflows/ci_msw.yml |
|||
# https://github.com/microsoft/setup-msbuild |
|||
- name: Add msbuild to PATH |
|||
if: matrix.os == 'windows-2022' |
|||
uses: microsoft/setup-msbuild@v1.1 |
|||
with: |
|||
vs-prerelease: true |
|||
# 步骤一的名称: |
|||
- name: Build |
|||
# 该步骤运行的终端命令,运行编译命令 |
|||
run: npm run build |
|||
# 步骤二的名称:将编译后的结果上传 |
|||
# - name: Upload File |
|||
# # 使用预制action:上传文件,可以将执行路径打包成zip上传 |
|||
# uses: actions/upload-artifact@v3 |
|||
# with: |
|||
# # 上传后文件的名称 |
|||
# name: windows |
|||
# # 打包的路径以及文件过滤,此为仅打包dist目录下的exe文件 |
|||
# path: out/*exe |
|||
- name: 读取当前版本号 |
|||
id: version |
|||
uses: ashley-taylor/read-json-property-action@v1.1 |
|||
with: |
|||
path: ./dist/package.json |
|||
property: version |
|||
- name: 读取描述文件 |
|||
id: description |
|||
uses: juliangruber/read-file-action@v1 |
|||
with: |
|||
path: ./changelog/${{steps.version.outputs.value}}.md |
|||
# step5: cleanup artifacts in dist_electron |
|||
# - name: 清理不必要的资产 |
|||
# run: | |
|||
# npx rimraf "out/!(*.exe|*.dmg)" |
|||
# - name: Generate release tag |
|||
# id: tag |
|||
# run: | |
|||
# echo "::set-output name=release_tag::UserBuild_$(date +"%Y.%m.%d_%H-%M")" |
|||
- name: Generate release tag |
|||
id: tag |
|||
run: | |
|||
echo "::set-output name=release_tag::v${{steps.version.outputs.value}}" |
|||
# echo "release_tag=v${{steps.version.outputs.value}}" >> $GITHUB_OUTPUT |
|||
- name: release # https://github.com/softprops/action-gh-release/issues/20 |
|||
uses: softprops/action-gh-release@v1 |
|||
with: |
|||
tag_name: ${{ steps.tag.outputs.release_tag }} |
|||
name: ${{ steps.tag.outputs.release_tag }} |
|||
files: "out/*exe,out/*dmg,out/*AppImage,out/*yml" |
|||
body: ${{steps.description.outputs.content}} |
|||
draft: false |
|||
prerelease: false |
|||
env: |
|||
GITHUB_TOKEN: ${{ secrets.ELECTRON_TOKEN }} |
@ -0,0 +1,3 @@ |
|||
## 0.0.1 |
|||
|
|||
第一个版本 |
@ -1,27 +1,13 @@ |
|||
import { injectable } from "inversify" |
|||
import Setting from "setting/main" |
|||
import { CustomAdapter, CustomLow } from "./custom" |
|||
import path from "node:path" |
|||
import BaseClass from "main/base/base" |
|||
import _logger from "logger/main" |
|||
// import _logger from "logger/main"
|
|||
|
|||
const logger = _logger.createNamespace("db") |
|||
// const logger = _logger.createNamespace("db")
|
|||
|
|||
@injectable() |
|||
class DB extends BaseClass { |
|||
destroy() { |
|||
logger.debug(`DB destroy`) |
|||
} |
|||
class DB { |
|||
Modules: Record<string, CustomLow<any>> = {} |
|||
|
|||
constructor() { |
|||
super() |
|||
} |
|||
|
|||
init() { |
|||
console.log("DB Init") |
|||
} |
|||
|
|||
create(filepath) { |
|||
const adapter = new CustomAdapter<any>(filepath) |
|||
const db = new CustomLow<object>(adapter, {}) |
@ -1,3 +1,15 @@ |
|||
import { UpdateInfo } from "electron-updater" |
|||
|
|||
export interface UpdaterCommand { |
|||
checkForUpdates: () => void |
|||
} |
|||
|
|||
export type EventMaps = { |
|||
"update-progress": (data: { percent: number; all: number; now: number }) => void |
|||
"update-progress": (data: { speed: number; percent: number; all: number; now: number }) => void |
|||
error: (err: any) => void |
|||
"updater:error": (info: UpdateInfo) => void |
|||
"checking-for-update": () => void |
|||
"update-available": (info: UpdateInfo) => void |
|||
"update-not-available": (info: UpdateInfo) => void |
|||
"updater:downloaded": (p: any) => void |
|||
} |
|||
|
@ -1,5 +1,41 @@ |
|||
import { LogLevel } from "logger/common" |
|||
import { PlatForm } from "." |
|||
|
|||
export function usePlatForm() { |
|||
return PlatForm.getInstance<PlatForm>() |
|||
const plat = PlatForm.getInstance<PlatForm>() |
|||
|
|||
// 全屏状态
|
|||
const isFullScreen = ref(false) |
|||
;(async () => { |
|||
isFullScreen.value = await plat.isFullScreen() |
|||
})() |
|||
|
|||
const toggleFullScreen = async () => { |
|||
await plat.toggleFullScreen() |
|||
isFullScreen.value = !isFullScreen.value |
|||
} |
|||
// 全屏状态 END
|
|||
|
|||
const curLogLevel = ref<LogLevel>() |
|||
;(async () => { |
|||
curLogLevel.value = await plat.logGetLevel() |
|||
})() |
|||
const isOpenDebug = computed(() => curLogLevel.value === LogLevel.TRACE) |
|||
const toggleDebugMode = async () => { |
|||
if (curLogLevel.value === LogLevel.TRACE) { |
|||
await plat.logSetLevel(LogLevel.INFO) |
|||
curLogLevel.value = LogLevel.INFO |
|||
return |
|||
} |
|||
await plat.logSetLevel(LogLevel.TRACE) |
|||
curLogLevel.value = LogLevel.TRACE |
|||
} |
|||
|
|||
return { |
|||
power: plat, |
|||
isOpenDebug, |
|||
toggleDebugMode, |
|||
toggleFullScreen, |
|||
isFullScreen, |
|||
} |
|||
} |
|||
|
@ -1,7 +1,23 @@ |
|||
<script setup lang="ts"></script> |
|||
<script setup lang="ts"> |
|||
import { useUpdaterStore } from "common/event/Updater/hook" |
|||
|
|||
const UpdaterStore = useUpdaterStore() |
|||
</script> |
|||
|
|||
<template> |
|||
<div h-full flex flex-col>sad</div> |
|||
<div gap="20px" h-full> |
|||
<div p="20px" flex flex-wrap items-start gap="20px" justify-start> |
|||
<div w="calc((100%-4*20px)/5)" shadow v-for="i in 10" :key="i"> |
|||
<div p-2 text-lg font-bold>导航站</div> |
|||
<div p-2 pt-0 text-sm>这是一个导航站</div> |
|||
<div flex gap="10px" px-4 py-2 tex border-t="1px solid #E5E5E5"> |
|||
<div cursor="pointer" text-sm leading-1 py-2 px-3 border="1px solid #E5E5E5" rounded>查看</div> |
|||
<div cursor="pointer" text-sm leading-1 py-2 px-3 border="1px solid #E5E5E5" rounded>访问</div> |
|||
</div> |
|||
</div> |
|||
<button @click="UpdaterStore.checkForUpdates()">更新</button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<style lang="scss" scoped></style> |
|||
|
@ -0,0 +1,3 @@ |
|||
provider: "github" |
|||
owner: "npmrun" |
|||
repo: "wood-desktop" |
Loading…
Reference in new issue