diff --git a/.vscode/settings.json b/.vscode/settings.json index bc6a839..b4ba684 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,15 +1,67 @@ { + "eslint.codeAction.showDocumentation": { + "enable": true + }, + "eslint.format.enable": true, + "prettier.enable": false, "editor.formatOnSave": false, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "never" }, - "eslint.format.enable": true, - "eslint.codeAction.showDocumentation": { - "enable": true - }, + "eslint.rules.customizations": [ + { + "rule": "style/*", + "severity": "off", + "fixable": true + }, + { + "rule": "format/*", + "severity": "off", + "fixable": true + }, + { + "rule": "*-indent", + "severity": "off", + "fixable": true + }, + { + "rule": "*-spacing", + "severity": "off", + "fixable": true + }, + { + "rule": "*-spaces", + "severity": "off", + "fixable": true + }, + { + "rule": "*-order", + "severity": "off", + "fixable": true + }, + { + "rule": "*-dangle", + "severity": "off", + "fixable": true + }, + { + "rule": "*-newline", + "severity": "off", + "fixable": true + }, + { + "rule": "*quotes", + "severity": "off", + "fixable": true + }, + { + "rule": "*semi", + "severity": "off", + "fixable": true + } + ], "eslint.validate": [ - // "jsonc", "javascript", "javascriptreact", "typescript", @@ -18,19 +70,25 @@ "html", "markdown", "json", - "yaml" + "jsonc", + "yaml", + "toml", + "xml", + "gql", + "graphql", + "astro", + "svelte", + "css", + "less", + "scss", + "pcss", + "postcss" ], - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "i18n-ally.localesPaths": ["src/locales/index.js", "src/locales/languages"], "i18n-ally.sourceLanguage": "zh-CN", + "i18n-ally.localesPaths": [ + "src/locales/index.js", + "src/locales/languages" + ], "i18n-ally.keystyle": "nested", "i18n-ally.extract.ignored": [ "Switch", @@ -52,5 +110,4 @@ "cSpell.words": [ "bhsn" ], - "common-intellisense.ui": [] } \ No newline at end of file diff --git a/README-CN.md b/README-CN.md index aab8273..293150f 100644 --- a/README-CN.md +++ b/README-CN.md @@ -84,15 +84,18 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 - 镜像 - 录制 -- OTG -- 摄像 +- 录制相机 +- 录制音频 +- 相机 - 灵活启动 +- OTG ### 设备交互栏 - 切换键 - 主屏幕 - 返回键 +- 关闭屏幕(实验性) - 通知栏 - 电源键 - 旋转屏幕 @@ -312,6 +315,10 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 你需要自定义 `scrcpy` 以及 `adb` 的文件路径(确保具有可执行权限),如果用到反向供网则同样需要以同样方法配置 `gnirehtet`。 +### Could not execute "adb start-server" + +这可能是因为安装路径中包含中文或特殊字符导致的,请尝试更改安装路径。 + ## 获得帮助 > 因为是开源项目 全靠爱发电 所以支持有限 更新节奏不固定 diff --git a/README-RU.md b/README-RU.md index 7b33be7..5b41d5b 100644 --- a/README-RU.md +++ b/README-RU.md @@ -82,15 +82,18 @@ Gnirehtet встроен в приложения для Windows и Linux, что - Зеркалирование - Запись -- OTG +- Запись с камеры +- Запись аудио - Камера -- Пользовательский +- Гибкий запуск +- OTG ### Панель взаимодействия с устройством - Переключатель - Домой - Назад +- Выключение экрана (экспериментально) - Уведомление - Питание - Поворот @@ -311,6 +314,10 @@ Gnirehtet встроен в приложения для Windows и Linux, что Вам нужно настроить пользовательские пути к файлам для `scrcpy` и `adb` (убедившись, что у них есть разрешения на выполнение). Если вы используете обратный тетеринг, аналогично настройте `gnirehtet`. +### Could not execute "adb start-server" + +Это может быть вызвано наличием китайских или специальных символов в пути установки. Попробуйте изменить путь установки. + ## Получение помощи > Поскольку это проект с открытым исходным кодом, полностью поддерживаемый пожертвованиями, поддержка ограничена, и обновления могут не выходить по фиксированному расписанию. diff --git a/README.md b/README.md index 6cda519..c960eea 100644 --- a/README.md +++ b/README.md @@ -82,15 +82,18 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master - Mirror - Recording -- OTG +- Recording Camera +- Recording Audio - Camera - Custom +- OTG ### Device Interaction Bar - Switch - Home - Back +- Turn off screen (experimental) - Notification - Power - Rotation @@ -311,6 +314,10 @@ Please try `disabling audio forwarding` feature through the `preferences setting You need to customize the file paths for `scrcpy` and `adb` (ensuring they have executable permissions). If using reverse tethering, configure `gnirehtet` similarly. +### Could not execute "adb start-server" + +This might be due to Chinese or special characters in the installation path. Please try changing the installation path. + ## Getting Help > As this is an open source project run entirely by donations, support is limited and updates may not be on a fixed schedule. diff --git a/control/App.vue b/control/App.vue index b878a52..844676f 100644 --- a/control/App.vue +++ b/control/App.vue @@ -63,7 +63,6 @@ import { i18n } from '$/locales/index.js' import localeModel from '$/plugins/element-plus/locale.js' import { useDeviceStore, useThemeStore } from '$/store/index.js' -import { ElMessage } from 'element-plus' const themeStore = useThemeStore() const deviceStore = useDeviceStore() diff --git a/control/electron/helpers/index.js b/control/electron/helpers/index.js index 1549fda..8ab5f7f 100644 --- a/control/electron/helpers/index.js +++ b/control/electron/helpers/index.js @@ -10,7 +10,6 @@ export function initControlWindow(mainWindow) { const controlWindow = new BrowserWindow({ icon: getLogoPath(), - parent: mainWindow, width: 700, minWidth: 700, height: 28, diff --git a/package.json b/package.json index ac4acce..125d4f6 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "vue": "3.4.21" }, "devDependencies": { - "@antfu/eslint-config": "3.3.2", + "@antfu/eslint-config": "3.8.0", "@devicefarmer/adbkit": "3.2.6", "@electron-toolkit/preload": "3.0.1", "@electron-toolkit/utils": "3.0.0", @@ -39,15 +39,15 @@ "@vitejs/plugin-vue": "5.0.4", "@vueuse/core": "10.9.0", "dayjs": "1.11.11", - "electron": "29.1.1", - "electron-builder": "24.13.3", + "electron": "33.0.2", + "electron-builder": "25.1.8", "electron-context-menu": "4.0.4", "electron-find-in-page": "1.0.8", "electron-log": "5.2.0", "electron-store": "9.0.0", - "electron-updater": "6.1.8", + "electron-updater": "6.3.9", "element-plus": "2.8.2", - "eslint": "9.10.0", + "eslint": "9.13.0", "fix-path": "4.0.0", "fs-extra": "11.2.0", "husky": "9.0.11", @@ -59,11 +59,11 @@ "rimraf": "^6.0.1", "simple-git": "^3.27.0", "unocss": "0.62.3", - "unplugin-auto-import": "0.18.2", + "unplugin-auto-import": "0.18.3", "unplugin-vue-components": "0.27.4", "vite": "5.1.5", - "vite-plugin-electron": "0.28.7", - "vite-plugin-electron-renderer": "0.14.5", + "vite-plugin-electron": "0.28.8", + "vite-plugin-electron-renderer": "0.14.6", "vite-svg-loader": "5.1.0", "vue-command": "35.2.1", "vue-i18n": "9.13.1", diff --git a/src/components/Device/components/MoreDropdown/components/Camera/index.vue b/src/components/Device/components/MoreDropdown/components/Camera/index.vue index 1f58405..c41d9f8 100644 --- a/src/components/Device/components/MoreDropdown/components/Camera/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Camera/index.vue @@ -6,6 +6,7 @@ import { sleep } from '$/utils' export default { + inheritAttrs: false, props: { row: { type: Object, diff --git a/src/components/Device/components/MoreDropdown/components/Custom/index.vue b/src/components/Device/components/MoreDropdown/components/Custom/index.vue index 770fc2e..2fd8703 100644 --- a/src/components/Device/components/MoreDropdown/components/Custom/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Custom/index.vue @@ -14,6 +14,7 @@ export default { components: { DeployDialog, }, + inheritAttrs: false, props: { row: { type: Object, diff --git a/src/components/Device/components/MoreDropdown/components/Otg/index.vue b/src/components/Device/components/MoreDropdown/components/Otg/index.vue index 0573cde..a39d862 100644 --- a/src/components/Device/components/MoreDropdown/components/Otg/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Otg/index.vue @@ -6,6 +6,7 @@ import { sleep } from '$/utils' export default { + inheritAttrs: false, props: { row: { type: Object, diff --git a/src/components/Device/components/MoreDropdown/components/Record/index.vue b/src/components/Device/components/MoreDropdown/components/Record/index.vue index 8df6045..68e5669 100644 --- a/src/components/Device/components/MoreDropdown/components/Record/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Record/index.vue @@ -6,8 +6,31 @@ import { sleep } from '$/utils' import { openFloatControl } from '$/utils/device/index.js' +const recordModel = { + default: { + excludes: '', + command: '', + extname: config => config['--record-format'] || 'mp4', + }, + audio: { + excludes: ['--video-source', '--no-audio', '--mouse'], + commands: ['--no-video', '--mouse=disabled'], + extname: config => config['--audio-record-format'] || 'opus', + }, + camera: { + excludes: ['--video-source'], + commands: ['--video-source=camera'], + extname: config => config['--record-format'] || 'mp4', + }, +} + export default { + inheritAttrs: false, props: { + recordType: { + type: String, + default: 'default', + }, row: { type: Object, default: () => ({}), @@ -22,6 +45,11 @@ export default { loading: false, } }, + computed: { + activeModel() { + return recordModel[this.recordType] + }, + }, methods: { async handleClick() { const row = this.row @@ -32,25 +60,36 @@ export default { const savePath = this.getRecordPath(row) - const args = this.$store.preference.scrcpyParameter(row.id, { - isRecord: true, - excludes: ['--otg', '--mouse=aoa', '--keyboard=aoa', '--show-touches'], + let args = this.$store.preference.scrcpyParameter(row.id, { + isRecord: ['default', 'audio'].includes(this.recordType), + isCamera: ['camera'].includes(this.recordType), + excludes: [ + '--otg', + '--mouse=aoa', + '--keyboard=aoa', + '--show-touches', + ...this.activeModel.excludes, + ], }) + args += ` ${this.activeModel.commands.join(' ')}` + + console.log('args', args) + try { const recording = this.$scrcpy.record(row.id, { title: this.$store.device.getLabel(row, 'recording'), savePath, args, - stdout: this.onStdout, - stderr: this.onStderr, }) await sleep(1 * 1000) this.loading = false - openFloatControl(toRaw(this.row)) + if (['default'].includes(this.$props.type)) { + openFloatControl(toRaw(this.row)) + } await recording @@ -65,20 +104,21 @@ export default { } } }, - onStdout() {}, - onStderr() {}, getRecordPath(row) { - const config = this.$store.preference.getData(row.id) - const basePath = config.savePath - const extension = config['--record-format'] || 'mp4' + const deviceConfig = this.$store.preference.getData(this.row.id) + + const savePath = deviceConfig.savePath + + const extension = this.activeModel.extname(deviceConfig) const fileName = this.$store.device.getLabel( row, ({ time }) => `record-${time}.${extension}`, ) - const joinValue = this.$path.join(basePath, fileName) - const value = this.$path.normalize(joinValue) + const filePath = this.$path.join(savePath, fileName) + + const value = this.$path.normalize(filePath) return value }, diff --git a/src/components/Device/components/MoreDropdown/components/RecordCamera/index.vue b/src/components/Device/components/MoreDropdown/components/RecordCamera/index.vue deleted file mode 100644 index 1c7770c..0000000 --- a/src/components/Device/components/MoreDropdown/components/RecordCamera/index.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - - - diff --git a/src/components/Device/components/MoreDropdown/index.vue b/src/components/Device/components/MoreDropdown/index.vue index 483247f..234a51b 100644 --- a/src/components/Device/components/MoreDropdown/index.vue +++ b/src/components/Device/components/MoreDropdown/index.vue @@ -17,6 +17,7 @@ :key="index" v-bind="{ ...$props, + ...(item.props || {}), }" v-slot="{ loading, trigger }" > @@ -40,7 +41,6 @@