16 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
|
5d2285ac8b |
fix
|
5 years ago |
|
bf07d7c470 |
自动弹出流程申请单
|
5 years ago |
|
0542bc7102 |
fix
|
5 years ago |
|
a7e4df094f |
fix
|
5 years ago |
|
66821cf3a4 |
通知
|
5 years ago |
|
f6d5e61c6c |
添加任务
|
5 years ago |
|
db6e6a2368 |
添加文档
|
5 years ago |
|
db815358cb |
同步分支中的评论
|
5 years ago |
|
8e79e37958 |
fix
|
5 years ago |
|
4bff00b1ea |
Merge branch 'master' of https://git.ouxuan.net/3136352472/ouxuan.oa
|
5 years ago |
|
acf6470e01 |
fix
|
5 years ago |
|
0386c7820d |
fix mac
|
5 years ago |
|
a94d8362a5 |
fix
|
5 years ago |
|
40e1835fdf |
mac版本打包配置
|
5 years ago |
|
8f5c2d4982 |
加班申请菜单
|
5 years ago |
|
5690e5fe42 |
文档更新
|
5 years ago |
11 changed files with 350 additions and 55 deletions
-
1.gitignore
-
52README.md
-
41lib/data.js
-
61lib/http.js
-
3lib/main.js
-
48lib/tray.js
-
34lib/web/data.js
-
130lib/web/main.js
-
22main.js
-
3package.json
-
10res/post-commit
@ -1,45 +1,13 @@ |
|||
# electron-quick-start |
|||
# 欧轩OA管理协助工具 |
|||
|
|||
**Clone and run for a quick way to see Electron in action.** |
|||
|
|||
This is a minimal Electron application based on the [Quick Start Guide](https://electronjs.org/docs/tutorial/quick-start) within the Electron documentation. |
|||
### 扩展功能 |
|||
+ 自动登录 |
|||
+ 托盘常驻 |
|||
+ 托盘管理任务 |
|||
+ 关联相关项目 |
|||
+ 项目分支根据任务自动创建 |
|||
+ 每次在分支提交会把提交内容同步到相关任务的评论中 |
|||
|
|||
**Use this app along with the [Electron API Demos](https://electronjs.org/#get-started) app for API code examples to help you get started.** |
|||
|
|||
A basic Electron application needs just these files: |
|||
|
|||
- `package.json` - Points to the app's main file and lists its details and dependencies. |
|||
- `main.js` - Starts the app and creates a browser window to render HTML. This is the app's **main process**. |
|||
- `index.html` - A web page to render. This is the app's **renderer process**. |
|||
|
|||
You can learn more about each of these components within the [Quick Start Guide](https://electronjs.org/docs/tutorial/quick-start). |
|||
|
|||
## To Use |
|||
|
|||
To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line: |
|||
|
|||
```bash |
|||
# Clone this repository |
|||
git clone https://github.com/electron/electron-quick-start |
|||
# Go into the repository |
|||
cd electron-quick-start |
|||
# Install dependencies |
|||
npm install |
|||
# Run the app |
|||
npm start |
|||
``` |
|||
|
|||
Note: If you're using Linux Bash for Windows, [see this guide](https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/) or use `node` from the command prompt. |
|||
|
|||
## Resources for Learning Electron |
|||
|
|||
- [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation |
|||
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - sample starter apps created by the community |
|||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app |
|||
- [electron/simple-samples](https://github.com/electron/simple-samples) - small applications with ideas for taking them further |
|||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - an Electron app that teaches you how to use Electron |
|||
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - small demo apps for the various Electron APIs |
|||
|
|||
## License |
|||
|
|||
[CC0 1.0 (Public Domain)](LICENSE.md) |
|||
### 同步评论功能 |
|||
> 每次进行commit时会将内容同步到相应的任务中,如果希望忽略该条提交同步,请以-作为内容开头 |
@ -0,0 +1,61 @@ |
|||
|
|||
const { Notification } = require('electron') |
|||
|
|||
var http = require("http"); |
|||
var querystring = require("querystring"); |
|||
var url = require("url"); |
|||
const path = require('path') |
|||
const libdata = require(path.join(__dirname, 'data.js')); |
|||
exports.start = function () { |
|||
http.createServer(function (request, response) { |
|||
|
|||
var pathname = url.parse(request.url).pathname; |
|||
if (HttpMap[pathname]) { |
|||
HttpMap[pathname](request, response) |
|||
} else { |
|||
response.end("请求未定义"); |
|||
} |
|||
}).listen(37188); |
|||
} |
|||
|
|||
HttpMap = { |
|||
"/commit": function (request, response) { |
|||
let query = querystring.parse(url.parse(request.url).query); |
|||
let branch = query["branch"]; |
|||
let commit = query["commit"]; |
|||
if (!branch || !commit) { |
|||
console.log([branch, commit]); |
|||
response.end("error"); |
|||
return; |
|||
} |
|||
let branchSplit = branch.split("-"); |
|||
let commitSplit = commit.split(" "); |
|||
if (branchSplit.length < 2 || commitSplit.length < 2) { |
|||
console.log([branch, commit, "error"]); |
|||
response.end("error"); |
|||
return; |
|||
} |
|||
let id = branchSplit[0]; |
|||
let hash = commitSplit.shift(); |
|||
commit = commitSplit.join(" "); |
|||
if (commit[0] == '-' || commit[0] == '#') { |
|||
console.log([branch, commit, "skip commit"]); |
|||
(new Notification({ |
|||
title: "有一条新的提交被忽略", |
|||
body: `分支:${branch} 提交内容:${commit}` |
|||
})).show() |
|||
|
|||
response.end("skip commit"); |
|||
return; |
|||
} |
|||
libdata.AddCommitToQueue({ |
|||
id: id, |
|||
branch: branch, |
|||
hash: hash, |
|||
commit: commit, |
|||
}); |
|||
|
|||
console.log([branch, commit, "success"]); |
|||
response.end("success"); |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
#!/bin/sh |
|||
|
|||
branch=`git symbolic-ref --short -q HEAD` |
|||
commit=`git log -1 --oneline $branch` |
|||
|
|||
branchencode=`echo -n "$branch" | xxd -ps | tr -d '\n' | sed -r 's/(..)/%\1/g'` |
|||
commitencode=`echo -n "$commit" | xxd -ps | tr -d '\n' | sed -r 's/(..)/%\1/g'` |
|||
curl "http://127.0.0.1:37188/commit?branch=${branchencode}&commit=${commitencode}" |
|||
echo 分支[$branch][$commit] |
|||
exit 0 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue