-
Notifications
You must be signed in to change notification settings - Fork 1
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
zhouyuan63
committed
Aug 4, 2023
1 parent
f9cb59d
commit 6d844e4
Showing
17 changed files
with
537 additions
and
4 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,88 @@ | ||
name: 'publish' | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
create-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
release_id: ${{ steps.create-release.outputs.result }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: get version | ||
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | ||
- name: create release | ||
id: create-release | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { data } = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: `app-v${process.env.PACKAGE_VERSION}`, | ||
name: `Desktop App v${process.env.PACKAGE_VERSION}`, | ||
body: 'Take a look at the assets to download and install this app.', | ||
draft: true, | ||
prerelease: false | ||
}) | ||
return data.id | ||
build-tauri: | ||
needs: create-release | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: install dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-20.04' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | ||
- name: install frontend dependencies | ||
run: yarn install # change this to npm or pnpm depending on which one you use | ||
- uses: tauri-apps/tauri-action@v0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
releaseId: ${{ needs.create-release.outputs.release_id }} | ||
|
||
publish-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-20.04 | ||
needs: [create-release, build-tauri] | ||
|
||
steps: | ||
- name: publish release | ||
id: publish-release | ||
uses: actions/github-script@v6 | ||
env: | ||
release_id: ${{ needs.create-release.outputs.release_id }} | ||
with: | ||
script: | | ||
github.rest.repos.updateRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: process.env.release_id, | ||
draft: false, | ||
prerelease: false | ||
}) |
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,32 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
/logs | ||
db.json | ||
.yarn.lock | ||
yarn.lock | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
build_debug.txt | ||
# Editor directories and files | ||
.idea | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
#Electron-builder output | ||
/dist_electron | ||
/lib | ||
/static/browsers/* | ||
!/static/browsers/nil.md |
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 @@ | ||
/src | ||
/tests | ||
/node_modules | ||
tsconfig.json | ||
/.vscode |
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,36 @@ | ||
# cherry-server | ||
|
||
<div align=center><img width="150" height="150" src="https://raw.githubusercontent.com/rr13k/cherry/master/strawberry.ico"/></div> | ||
|
||
<p align="center"> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="Tests" src="https://badgen.net/badge/cherry/next/pink?icon=github"></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="Test Dependencies" src="https://badgen.net/badge/webUi/auto/red?icon=github" /></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="NPM Version" src="https://badgen.net/github/status/micromatch/micromatch/4.0.1" style="max-width:100%;"></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="NPM Version" src="https://badgen.net/badge/license/MIT/blue" style="max-width:100%;"></a> | ||
</p> | ||
|
||
<div align=center> | ||
<i>用于web、h5自动化测试, | ||
</br>使用js编写测试并动态执行.</i> | ||
</div> | ||
<br/> | ||
|
||
用于脱离electron,通过原生node进行服务端运行提升服务稳定性。 | ||
|
||
* **适用于所有流行环境:** `cherry` 可以在 `Windows`、`MacOS` 和 `Linux` 上运行。它支持桌面、移动、远程和云浏览器(UI 或无头)。 | ||
* **简单智能录制:** 内置智能识别录制策略,99%的网页功能交互都可在操作中自动生成并稳定回放,提供`GUI`界面轻松增加自定义断言。 | ||
|
||
* **免费和开源:** `cherry`在`MIT 许可`下免费使用。 | ||
|
||
## 立即体验 | ||
[cherry预览版 在线体验](https://renranbk.gitee.io/cherry-preview) | ||
|
||
|
||
## start | ||
|
||
``` | ||
npx run main.ts | ||
``` | ||
|
||
|
||
|
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,36 @@ | ||
# cherry-server | ||
|
||
<div align=center><img width="150" height="150" src="https://raw.githubusercontent.com/rr13k/cherry/master/strawberry.ico"/></div> | ||
|
||
<p align="center"> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="Tests" src="https://badgen.net/badge/cherry/next/pink?icon=github"></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="Test Dependencies" src="https://badgen.net/badge/webUi/auto/red?icon=github" /></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="NPM Version" src="https://badgen.net/github/status/micromatch/micromatch/4.0.1" style="max-width:100%;"></a> | ||
<a href="https://coding.jd.com/cherry/cherry-next/"><img alt="NPM Version" src="https://badgen.net/badge/license/MIT/blue" style="max-width:100%;"></a> | ||
</p> | ||
|
||
<div align=center> | ||
<i>用于web、h5自动化测试, | ||
</br>使用js编写测试并动态执行.</i> | ||
</div> | ||
<br/> | ||
|
||
用于脱离electron,通过原生node进行服务端运行提升服务稳定性。 | ||
|
||
* **适用于所有流行环境:** `cherry` 可以在 `Windows`、`MacOS` 和 `Linux` 上运行。它支持桌面、移动、远程和云浏览器(UI 或无头)。 | ||
* **简单智能录制:** 内置智能识别录制策略,99%的网页功能交互都可在操作中自动生成并稳定回放,提供`GUI`界面轻松增加自定义断言。 | ||
|
||
* **免费和开源:** `cherry`在`MIT 许可`下免费使用。 | ||
|
||
## 立即体验 | ||
[cherry预览版 在线体验](https://renranbk.gitee.io/cherry-preview) | ||
|
||
|
||
## start | ||
|
||
``` | ||
npx run main.ts | ||
``` | ||
|
||
|
||
|
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,24 @@ | ||
const { task, dest, src } = require('gulp') | ||
const ts = require('gulp-typescript') | ||
|
||
const tsProject = ts.createProject('tsconfig.json', { | ||
noEmitOnError: false, | ||
}) | ||
|
||
|
||
task('default', function () { | ||
src([ | ||
'src/**/*.ts', | ||
'main.ts', | ||
], { base: '.' }) | ||
.pipe(tsProject()) | ||
.js | ||
.pipe(dest('lib')) | ||
return build_assets() | ||
}) | ||
|
||
function build_assets() { | ||
return src([ | ||
"src/**/assets/**/*", | ||
]).pipe(dest('lib')) | ||
} |
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,11 @@ | ||
#!/usr/bin/env node | ||
import httpControlServer from './src/httpServer/server' | ||
export default httpControlServer | ||
import { run } from './src/open-api'; | ||
export {run} | ||
|
||
console.log("argv",process.argv) | ||
const port = parseInt(process.argv[2]) || 8088 | ||
|
||
// ex: node app.js 8080 | ||
httpControlServer(port) |
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,42 @@ | ||
{ | ||
"name": "@cherry-jd/yintao-server", | ||
"version": "1.1.2", | ||
"description": "", | ||
"main": "lib/main.js", | ||
"bin": { | ||
"cherry-server": "lib/main.js" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "gulp > debug.log", | ||
"fast": "gulp > debug.log && cp -rf lib ../../node_modules/@cherry-jd/cherry-server", | ||
"build:linux": "yarn build && npx pkg . -t node16-linux-x64", | ||
"publish": "npm publish --access public", | ||
"release":"gulp > debug.log && yarn pkg .", | ||
"release:win":"gulp > debug.log && yarn pkg . -t node14-win-x64", | ||
"release:mac":"gulp > debug.log && yarn pkg . -t node14-macos-x64", | ||
"dev": "node lib/main.js" | ||
}, | ||
"pkg": { | ||
"scripts": [], | ||
"assets": ["node_modules/@cherry-jd/core/lib/**"], | ||
"outputPath": "../../src-tauri/binaries" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/body-parser": "^1.19.2", | ||
"@vercel/ncc": "^0.36.1", | ||
"gulp": "^4.0.2", | ||
"gulp-typescript": "^6.0.0-alpha.1", | ||
"pkg": "^5.8.1", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@cherry-jd/core": "^2.0.8", | ||
"endpoint-utils": "^1.0.2", | ||
"express": "^4.17.2", | ||
"express-formidable": "^1.2.0", | ||
"proxy-chain": "^2.3.0" | ||
} | ||
} |
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,22 @@ | ||
import {Server} from 'proxy-chain' | ||
|
||
export function DnsAnalysisServer(port: number,hosts:Map<string,string>) { | ||
const server = new Server({ | ||
port: port, | ||
prepareRequestFunction: ({ request, hostname, port }) => { | ||
const ip = hosts.get(hostname); | ||
if(ip == undefined) return | ||
return { | ||
upstreamProxyUrl: "http://" + ip, | ||
} | ||
} | ||
}) | ||
|
||
server.listen(() => { | ||
console.log(`dns listening on *: ${port}`) | ||
}); | ||
|
||
return server | ||
} | ||
|
||
export default DnsAnalysisServer |
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,37 @@ | ||
import { serviceImpl } from './serverImpl' | ||
import bodyParser from 'body-parser' | ||
const express = require('express') | ||
const httpserver = express() | ||
|
||
export interface Ret { | ||
success?: boolean | ||
data?: any | ||
msg?: string | ||
code?: number | ||
total?: number | ||
} | ||
|
||
httpserver.use(bodyParser.urlencoded({ extended: false })) | ||
httpserver.use(bodyParser.json({limit:"50mb"})) | ||
|
||
export const httpControlServer = function( port: number ) { | ||
var server = httpserver.listen(port) | ||
console.log(`http listening on *:${port}`) | ||
server.on('error', function( err:any ) { | ||
if (err.code === 'EADDRINUSE') { // 端口已经被使用 | ||
/** | ||
* 当端口被占用时,不要采用dialog弹窗, | ||
* 采用node-notifier 试试(todo: 需要测试,以及先修复服务二次执行问题) | ||
*/ | ||
console.log('ERROR: The port is used!', port) | ||
process.exit(); | ||
} | ||
}) | ||
|
||
httpserver.get('/ping', serviceImpl.ping) | ||
httpserver.post('/run', serviceImpl.runScript) | ||
// 导出以支持扩展 | ||
return httpserver | ||
} | ||
|
||
export default httpControlServer |
Oops, something went wrong.