-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
你们的小f
committed
Jan 17, 2022
0 parents
commit eb641fa
Showing
16 changed files
with
11,185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Monit Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [macos-latest, windows-latest] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Build/release Electron app | ||
uses: samuelmeuli/action-electron-builder@v1 | ||
with: | ||
github_token: ${{ secrets.token }} | ||
release: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
use_vue_cli: true # 使用 vue cli 构建 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
#Electron-builder output | ||
/dist_electron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Monit | ||
|
||
> 用于实时监控自己的 Github 信息 | ||
> | ||
> 使用 vue + electron 开发 | ||
## Todo | ||
|
||
- [x] 页面结构 | ||
- [x] 自定义窗口 | ||
- [x] 基本功能 | ||
- [ ] 保存窗口位置 | ||
- [ ] 自定义用户 | ||
- [ ] 消息通知 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "monit", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build", | ||
"lint": "vue-cli-service lint", | ||
"electron:build": "vue-cli-service electron:build", | ||
"electron:serve": "vue-cli-service electron:serve", | ||
"postinstall": "electron-builder install-app-deps", | ||
"postuninstall": "electron-builder install-app-deps" | ||
}, | ||
"main": "background.js", | ||
"dependencies": { | ||
"@tailwindcss/postcss7-compat": "^2.2.17", | ||
"autoprefixer": "^9", | ||
"axios": "^0.24.0", | ||
"core-js": "^3.6.5", | ||
"postcss": "^7", | ||
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17", | ||
"vue": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vue/cli-plugin-babel": "~4.5.0", | ||
"@vue/cli-plugin-eslint": "~4.5.0", | ||
"@vue/cli-service": "~4.5.0", | ||
"@vue/compiler-sfc": "^3.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"electron": "^13.0.0", | ||
"electron-devtools-installer": "^3.1.0", | ||
"eslint": "^6.7.2", | ||
"eslint-plugin-vue": "^7.0.0", | ||
"vue-cli-plugin-electron-builder": "~2.1.1", | ||
"vue-cli-plugin-tailwind": "~2.2.18" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:vue/vue3-essential", | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"parser": "babel-eslint" | ||
}, | ||
"rules": {} | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"not dead" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang=""> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
<title><%= htmlWebpackPlugin.options.title %></title> | ||
</head> | ||
<body> | ||
<noscript> | ||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
</noscript> | ||
<div id="app"></div> | ||
<!-- built files will be auto injected --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<Index msg="Welcome to Your Vue.js App"/> | ||
</template> | ||
|
||
<script> | ||
import Index from './components/Index.vue' | ||
export default { | ||
name: 'App', | ||
components: { | ||
Index | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
body { | ||
background-color: rgba(0, 0, 0, 0.3); | ||
/* 禁用用户选择 */ | ||
user-select: none; | ||
-webkit-user-selet: none; | ||
/* -moz-user-select: none; */ | ||
/* 允许用户拖拽 */ | ||
-webkit-app-region: drag; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@tailwind base; | ||
|
||
@tailwind components; | ||
|
||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
'use strict' | ||
|
||
import { app, protocol, BrowserWindow, ipcMain } from 'electron' | ||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' | ||
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer' | ||
const isDevelopment = process.env.NODE_ENV !== 'production' | ||
|
||
// Scheme must be registered before the app is ready | ||
protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }]) | ||
|
||
async function createWindow() { | ||
// Create the browser window. | ||
const win = new BrowserWindow({ | ||
x: 10, | ||
y: 30, | ||
width: 400, | ||
minWidth: 400, | ||
height: 200, | ||
minHeight: 200, | ||
transparent: true, // 透明 | ||
hasShadow: false, // 阴影 | ||
frame: false, // 隐藏边框 | ||
fullscreenable: false, // 禁止全屏 | ||
resizable: false, // 不可调整大小 | ||
// alwaysOnTop: true, // 置顶 | ||
// opacity: 0.9, // 不透明度 | ||
// vibrancy: 'dark', // mac 毛玻璃 | ||
// visualEffectState: 'active', // 自动应用 | ||
|
||
webPreferences: { | ||
// Use pluginOptions.nodeIntegration, leave this alone | ||
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info | ||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, | ||
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION, | ||
}, | ||
}) | ||
|
||
// 监听移动事件 | ||
win.on('move',function(){ | ||
console.log(win.getPosition()) | ||
}) | ||
|
||
// 窗口置顶 | ||
ipcMain.on('window-top', function () { | ||
win.setAlwaysOnTop(!win.isAlwaysOnTop()) | ||
}) | ||
|
||
// 窗口最小化 | ||
ipcMain.on('window-mini', function () { | ||
win.minimize() | ||
}) | ||
// 关闭窗口 | ||
ipcMain.on('window-close', function () { | ||
app.quit() | ||
}) | ||
|
||
if (process.env.WEBPACK_DEV_SERVER_URL) { | ||
// Load the url of the dev server if in development mode | ||
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL) | ||
if (!process.env.IS_TEST) win.webContents.openDevTools() | ||
} else { | ||
createProtocol('app') | ||
// Load the index.html when not in development | ||
win.loadURL('app://./index.html') | ||
} | ||
} | ||
|
||
// Quit when all windows are closed. | ||
app.on('window-all-closed', () => { | ||
// On macOS it is common for applications and their menu bar | ||
// to stay active until the user quits explicitly with Cmd + Q | ||
if (process.platform !== 'darwin') { | ||
app.quit() | ||
} | ||
}) | ||
|
||
app.on('activate', () => { | ||
// On macOS it's common to re-create a window in the app when the | ||
// dock icon is clicked and there are no other windows open. | ||
if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
}) | ||
|
||
// This method will be called when Electron has finished | ||
// initialization and is ready to create browser windows. | ||
// Some APIs can only be used after this event occurs. | ||
app.on('ready', async () => { | ||
if (isDevelopment && !process.env.IS_TEST) { | ||
// Install Vue Devtools | ||
try { | ||
await installExtension(VUEJS3_DEVTOOLS) | ||
} catch (e) { | ||
console.error('Vue Devtools failed to install:', e.toString()) | ||
} | ||
} | ||
createWindow() | ||
}) | ||
|
||
// Exit cleanly on request from parent process in development mode. | ||
if (isDevelopment) { | ||
if (process.platform === 'win32') { | ||
process.on('message', (data) => { | ||
if (data === 'graceful-exit') { | ||
app.quit() | ||
} | ||
}) | ||
} else { | ||
process.on('SIGTERM', () => { | ||
app.quit() | ||
}) | ||
} | ||
} |
Oops, something went wrong.