From 1c6c53caa11c29c04ede41f4359ede96ba15e2d5 Mon Sep 17 00:00:00 2001 From: Jim-Lin-4549 Date: Thu, 30 Jan 2025 02:39:03 +0800 Subject: [PATCH] chore: update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #5 现在不再允许部分 Web 快捷键 修复 CompCard 默认展开模式下第一次收起动画缺失的问题 改进 CI 逻辑,分离了开发 CI 和发版 CI --- .github/workflows/pr_build.yml | 46 +++++++++++++ .github/workflows/publish.yml | 10 +-- package.json | 62 +++++++++--------- ...PCLNova.Release.png => PCLNova.Stable.png} | Bin src-tauri/tauri.conf.json | 4 +- src/main.ts | 20 +++++- src/metadata.json | 4 ++ src/ui/components/CompCard.vue | 38 +++++++---- src/ui/layouts/LayoutHeader.vue | 6 +- src/ui/views/others/ViewAbout.vue | 53 +++++---------- 10 files changed, 150 insertions(+), 93 deletions(-) create mode 100644 .github/workflows/pr_build.yml rename public/{PCLNova.Release.png => PCLNova.Stable.png} (100%) create mode 100644 src/metadata.json diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml new file mode 100644 index 0000000..7a55eee --- /dev/null +++ b/.github/workflows/pr_build.yml @@ -0,0 +1,46 @@ +name: 'Build App for Development' + +on: + push: + branches: + - dev + - beta + - release + +jobs: + build-app: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust Nightly + uses: dtolnay/rust-toolchain@nightly + + - name: install frontend dependencies + run: | + npm install -g pnpm + pnpm install + + - name: build + run: pnpm tauri build + + - name: upload + uses: actions/upload-artifact@v4 + with: + name: Windows Embedded App + path: src-tauri/target/release/Plain_Craft_Launcher_2_Nova.exe + if-no-files-found: error + retention-days: 7 + + - name: upload + uses: actions/upload-artifact@v4 + with: + name: Windows Bundled Installer + path: src-tauri/target/release/bundle/ + if-no-files-found: error + retention-days: 7 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9c40db1..e8f60fb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,13 @@ -name: 'publish' +name: 'Publish App' on: push: branches: - - release - - beta - - dev + - build/dev + - build/beta + - build/release -# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release. +# This workflow will trigger on each push to the build branchs to create or update a GitHub release, build your app, and upload the artifacts to the release. jobs: publish-tauri: diff --git a/package.json b/package.json index 47b30f6..b33976e 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,33 @@ { - "name": "pcl2-nova-app", - "private": true, - "version": "0.1.1", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vue-tsc --noEmit && vite build", - "preview": "vite preview", - "tauri": "tauri" - }, - "dependencies": { - "@tauri-apps/api": "^2", - "@tauri-apps/plugin-opener": "^2", - "vue": "^3.5.13" - }, - "devDependencies": { - "@tailwindcss/postcss": "^4.0.0", - "@tailwindcss/vite": "^4.0.0", - "@tauri-apps/cli": "^2", - "@vitejs/plugin-vue": "^5.2.1", - "autoprefixer": "^10.4.20", - "daisyui": "5.0.0-beta.2", - "postcss": "^8.4.49", - "sass": "^1.83.4", - "sass-loader": "^16.0.4", - "tailwindcss": "^4.0.0", - "typescript": "~5.6.2", - "vite": "^6.0.11", - "vue-router": "^4.5.0", - "vue-tsc": "^2.1.10" - } + "name": "pcl2-nova-app", + "private": true, + "version": "0.1.1", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview", + "tauri": "tauri" + }, + "dependencies": { + "@tauri-apps/api": "^2", + "@tauri-apps/plugin-opener": "^2", + "vue": "^3.5.13" + }, + "devDependencies": { + "@tailwindcss/postcss": "^4.0.0", + "@tailwindcss/vite": "^4.0.0", + "@tauri-apps/cli": "^2", + "@vitejs/plugin-vue": "^5.2.1", + "autoprefixer": "^10.4.20", + "daisyui": "5.0.0-beta.2", + "postcss": "^8.4.49", + "sass": "^1.83.4", + "sass-loader": "^16.0.4", + "tailwindcss": "^4.0.0", + "typescript": "~5.6.2", + "vite": "^6.0.11", + "vue-router": "^4.5.0", + "vue-tsc": "^2.1.10" + } } diff --git a/public/PCLNova.Release.png b/public/PCLNova.Stable.png similarity index 100% rename from public/PCLNova.Release.png rename to public/PCLNova.Stable.png diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f3cc0e4..c55947a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", - "productName": "Plain Craft Launcher 2 Nova Dev", - "version": "0.1.1", + "productName": "Plain Craft Launcher 2 Nova Stable", + "version": "0.1.2", "identifier": "nova.pcl2.app", "build": { "beforeDevCommand": "pnpm dev", diff --git a/src/main.ts b/src/main.ts index ab2a68b..393df87 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,23 @@ import router from "./modules/ModRouter.ts"; createApp(App).use(router).mount("#app"); -window.addEventListener("contextmenu", (e: MouseEvent) => e.preventDefault()); - import "./assets/tailwind.css"; import "./assets/style.css"; + +(function () { + window.oncontextmenu = (e: MouseEvent) => e.preventDefault(); + window.onkeydown = (e: KeyboardEvent) => { + // 禁用刷新:[F5, Ctrl + R, Ctrl + Shift + R] + if (e.key === "F5" || (e.ctrlKey && e.key.toLowerCase() === "r") || (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "r")) { + e.preventDefault(); + } + // 禁用历史切换:Alt + [↑, ↓, ←, →] + if (e.altKey && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) { + e.preventDefault(); + } + // 禁用在构建中的 DevTools + if (e.key === "F12" || (e.ctrlKey && e.shiftKey && e.key.toLowerCase() === "i")) { + e.preventDefault(); + } + }; +})(); diff --git a/src/metadata.json b/src/metadata.json new file mode 100644 index 0000000..bf156fa --- /dev/null +++ b/src/metadata.json @@ -0,0 +1,4 @@ +{ + "version": "0.1.2", + "channel": "Stable" +} \ No newline at end of file diff --git a/src/ui/components/CompCard.vue b/src/ui/components/CompCard.vue index 8d6d65e..e838ae0 100644 --- a/src/ui/components/CompCard.vue +++ b/src/ui/components/CompCard.vue @@ -1,5 +1,5 @@