This commit is contained in:
viarotel 2023-10-07 13:22:40 +08:00
parent f651733c11
commit 2371b26d6a
5 changed files with 57 additions and 24 deletions

View File

@ -38,6 +38,7 @@
### WIFI 连接
> 注意需同时开启无线调试功能并在无线调试页面中获取你的当前设备的无线地址通常为你连接WIFI时分配的IP地址及端口号默认为 5555
> 注意: 第一次无线连接可能需要插入 USB 以保证与电脑建立连接即授权成功后方可使用
1. 同 USB 连接中的 1-2 步骤
2. 将获取到的设备 IP 地址及端口号填写到 Escrcpy 中,然后点击连接设备
@ -80,12 +81,11 @@
> 优先级从高到低
1. 用户界面进行优化,制作合适的 Logo ✅
2. 添加更多的高级功能 如: 屏幕录像 🚧
2. 添加外部控制栏 🚧
3. 添加 macOS 及 linux 操作系统的支持 🚧
4. 内置的软件更新功能 🚧
5. 支持语言国际化功能 🚧
6. 添加侧边控制栏 🚧
7. 添加对游戏的增强功能 如游戏键位映射 🚧
6. 添加对游戏的增强功能 如游戏键位映射 🚧
## 常见问题
@ -110,6 +110,10 @@
1. 在高级设置中开启 设备控制 => 虚拟控制栏 (如果该配置不起作用则需要在设备上手动开启)
2. 通过快捷键,请参阅 [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master/doc/shortcuts.md)
### 无线连接提示: 目标计算机积极拒绝访问
第一次无线连接可能需要插入 USB 以保证与电脑建立连接即授权成功后方可使用
## 获得帮助
> 因为是开源项目 全靠爱发电 所以支持有限 更新节奏不固定

View File

@ -33,9 +33,9 @@
"@vitejs/plugin-vue": "^4.3.1",
"@vue/eslint-config-prettier": "^8.0.0",
"electron": "^25.6.0",
"electron-builder": "^24.6.3",
"electron-vite": "^1.0.27",
"eslint": "^8.49.0",
"electron-builder": "^24.6.4",
"electron-vite": "^1.0.28",
"eslint": "8.49.0",
"eslint-plugin-vue": "^9.17.0",
"less": "^4.2.0",
"prettier": "^3.0.2",

21
pnpm-lock.yaml generated
View File

@ -50,13 +50,13 @@ devDependencies:
specifier: ^25.6.0
version: 25.8.1
electron-builder:
specifier: ^24.6.3
specifier: ^24.6.4
version: 24.6.4
electron-vite:
specifier: ^1.0.27
version: 1.0.27(vite@4.4.9)
specifier: ^1.0.28
version: 1.0.28(vite@4.4.9)
eslint:
specifier: ^8.49.0
specifier: 8.49.0
version: 8.49.0
eslint-plugin-vue:
specifier: ^9.17.0
@ -976,7 +976,7 @@ packages:
dependencies:
'@types/http-cache-semantics': 4.0.1
'@types/keyv': 3.1.4
'@types/node': 18.17.15
'@types/node': 20.6.0
'@types/responselike': 1.0.0
/@types/debug@4.1.8:
@ -1012,7 +1012,7 @@ packages:
/@types/keyv@3.1.4:
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
dependencies:
'@types/node': 18.17.15
'@types/node': 20.6.0
/@types/lodash-es@4.17.9:
resolution: {integrity: sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ==}
@ -1039,7 +1039,6 @@ packages:
/@types/node@20.6.0:
resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==}
dev: true
/@types/normalize-package-data@2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@ -1057,7 +1056,7 @@ packages:
/@types/responselike@1.0.0:
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
dependencies:
'@types/node': 18.17.15
'@types/node': 20.6.0
/@types/semver@7.5.2:
resolution: {integrity: sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==}
@ -1081,7 +1080,7 @@ packages:
resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==}
requiresBuild: true
dependencies:
'@types/node': 18.17.15
'@types/node': 20.6.0
optional: true
/@typescript-eslint/eslint-plugin@6.7.0(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)(typescript@5.2.2):
@ -2558,8 +2557,8 @@ packages:
- supports-color
dev: false
/electron-vite@1.0.27(vite@4.4.9):
resolution: {integrity: sha512-T8UVt9HtMFMMqU78dhv8TsRHYxMkuMTIZBIFYHzfeEoJ1Go3tVemgY/kO6sTTv94jIhkhcZIkvwmq4liABFjmA==}
/electron-vite@1.0.28(vite@4.4.9):
resolution: {integrity: sha512-cp7nBi6do/jn5SHdL2V71WjxqZ+NXitVqn5bW+TsTEYgAfSUuYYp6INJN854kcgoOj4UrjMqA9cGRTSl79xx0Q==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:

View File

@ -1,6 +1,9 @@
import { Adb } from '@devicefarmer/adbkit'
import adbPath from '@resources/core/adb.exe?asset&asarUnpack'
const util = require('node:util')
const exec = util.promisify(require('node:child_process').exec)
let client = null
window.addEventListener('beforeunload', () => {
@ -11,6 +14,7 @@ window.addEventListener('beforeunload', () => {
const getDevices = async () => await client.listDevicesWithPaths()
const shell = async (id, command) => await client.getDevice(id).shell(command)
const rawShell = async command => exec(`${adbPath} ${command}`)
const kill = async (...params) => await client.kill(...params)
const connect = async (...params) => await client.connect(...params)
const disconnect = async (...params) => await client.disconnect(...params)
@ -18,19 +22,19 @@ const disconnect = async (...params) => await client.disconnect(...params)
const watch = async (callback) => {
const tracker = await client.trackDevices()
tracker.on('add', (device) => {
callback(device)
callback('add', device)
})
tracker.on('remove', (device) => {
callback(device)
callback('remove', device)
})
tracker.on('end', (ret) => {
callback(ret)
callback('end', ret)
})
tracker.on('error', (err) => {
callback(err)
callback('error', err)
})
const close = () => tracker.end()
@ -45,6 +49,7 @@ export default () => {
return {
getDevices,
shell,
rawShell,
kill,
connect,
disconnect,

View File

@ -118,23 +118,48 @@ export default {
handleReset() {
this.$electron.ipcRenderer.send('restart-app')
},
async handleConnect() {
async handleConnect({ pairCode = '' } = {}) {
if (!this.formData.host) {
this.$message.warning('无线调试地址不能为空')
return false
}
this.connectLoading = true
try {
await this.$adb.connect(this.formData.host, this.formData.port || 5555)
await this.$adb.connect(this.formData.host, this.formData.port || 5555, pairCode)
this.$message.success('连接设备成功')
storage.set('adbCache', this.formData)
}
catch (error) {
if (error.message)
if (error.message) {
this.$message.warning(error.message)
}
if (error.message.includes('10060')) {
this.handlePair()
}
}
this.connectLoading = false
},
async handlePair() {
try {
const { value } = await this.$prompt('', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType: 'number',
inputPlaceholder: '请输入配对码',
closeOnClickModal: false,
})
await this.$adb.rawShell(
`pair ${this.formData.host}:${this.formData.port || 5555} ${this.value}`,
)
this.handleConnect({ pairCode: value })
}
catch (error) {
console.warn(error.message)
}
},
async handleStop(row) {
row.$stopLoading = true
const [host, port] = row.id.split(':')