Skip to content

Commit

Permalink
Merge branch 'yume-chan-0.0.20'
Browse files Browse the repository at this point in the history
* yume-chan-0.0.20: (171 commits)
  add client-server headers
  always `tunnelForward: true` in scrcpy
  refactor: new naming rule
  Merge commit 'd91fef04ddcf7b70ad36dedf2d78e6ebfa9d2d7b' into ya-webadb-0.0.20
  chore: v0.0.20
  chore: fix typo
  chore: prepare for next release
  feat(web): start a new web app
  refactor(demo): code cleanups
  feat(credential): save keys in indexedDB to support workers
  feat(scrcpy): add `isSupported` method to`WebCodecDecoder`
  refactor: use ES private fields to replace TypeScript private accessors
  refactor: rename `AdbDaemonConnection` to `AdbDaemonDevice`
  chore: update ci node version
  chore: add sponsor badge
  chore: add sponsor badge
  fix(demo): update undici
  chore: update dependencies
  feat(adb): support connect to adb server (#549)
  chore(doc): fix typo
  ...

# Conflicts:
#	.github/workflows/cloudflare-pages.yml
#	.github/workflows/netlify.yml
#	.github/workflows/pull_request.yml
#	.github/workflows/test.yml
#	README.md
#	apps/demo/public/manifest.json
#	apps/demo/src/components/connect.tsx
#	apps/demo/src/pages/_app.tsx
  • Loading branch information
nwtgck committed Jun 27, 2023
2 parents df5a278 + c7672dc commit bbd4350
Show file tree
Hide file tree
Showing 579 changed files with 36,270 additions and 19,723 deletions.
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/core_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ body:
options:
- label: I'm using the library programmatically
required: true
- label: For Scrcpy related issues, I have searched in [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy/issues) repository.
required: true
- type: input
attributes:
label: Library version
placeholder: 0.0.10
placeholder: 0.0.17
validations:
required: true
- type: input
attributes:
label: Runtime
description: Operating system, runtime name and version
placeholder: e.g. macOS 12.1, Chrome 99
placeholder: e.g. macOS 13.0, Chrome 105
validations:
required: true
- type: input
Expand Down
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/demo_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ body:
options:
- label: I'm using the official demo at https://yume-chan.github.io/ya-webadb
required: true
- label: For Scrcpy related issues, I have searched in [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy/issues) repository.
required: true
- type: input
attributes:
label: Runtime
description: Operating system, runtime name and version
placeholder: e.g. macOS 12.1, Chrome 99
placeholder: e.g. macOS 13.0, Chrome 105
validations:
required: true
- type: input
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/cloudflare-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3.4.1
- uses: actions/setup-node@v3
with:
node-version: 16.x

node-version: 18.x
- run: node common/scripts/install-run-rush.js install
- run: node common/scripts/install-run-rush.js build --verbose
- run: npx next export
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
- run: node common/scripts/install-run-rush.js install
- run: node common/scripts/install-run-rush.js build --verbose
- run: npx next export
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ dts
esm
dist
*.tsbuildinfo

/.pnpm-store
10 changes: 1 addition & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
{
"configurations": [
{
"type": "pwa-msedge",
"name": "http://localhost:3000",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/app/demo"
}
]
"configurations": []
}
38 changes: 37 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,51 @@
"allowlist",
"arraybuffer",
"autorun",
"Backquote",
"Bframes",
"bootloader",
"brotli",
"Callout",
"Cascadia",
"CLSE",
"CNXN",
"colour",
"comlink",
"concat",
"Demuxer",
"Deserialization",
"DESERIALIZERS",
"ebml",
"Embedder",
"entrypoints",
"fflate",
"fluentui",
"genymobile",
"Genymobile's",
"getprop",
"Golomb",
"griffel",
"keyof",
"laggy",
"localabstract",
"Logcat",
"lstat",
"luma",
"Matroska",
"mitm",
"muxer",
"Muxing",
"Nalu",
"opendir",
"PKCS",
"ponyfill",
"runtimes",
"scid",
"Scrcpy",
"sendrecv",
"sideload",
"sideloading",
"Sodb",
"streamsaver",
"struct",
"struct's",
Expand All @@ -41,8 +58,10 @@
"transferables",
"tsbuildinfo",
"typeof",
"undici",
"webadb",
"webcodecs",
"webm",
"websockify",
"webusb",
"wifi",
Expand All @@ -52,6 +71,10 @@
"zstd"
],
"editor.tabSize": 4,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll": true,
},
"jest.rootPath": "packages/struct",
"jest.showCoverageOnLoad": true,
"markdown.extension.toc.levels": "2..6",
Expand All @@ -70,5 +93,18 @@
],
"typescript.preferences.quoteStyle": "single",
"typescript.format.semicolons": "insert",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"eslint.workingDirectories": [
"libraries/*",
],
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"explorer.sortOrder": "mixed"
}
52 changes: 42 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Development

The repository uses [Rush](https://rushjs.io/) for monorepo management.
Expand All @@ -9,41 +8,74 @@ The repository uses [Rush](https://rushjs.io/) for monorepo management.
$ npm i -g @microsoft/rush
```

### Get code

The build script only works inside a Git repository, so, always use `git` to clone this repository. "Download ZIP" option in GitHub code menu or source code tarball in GitHub releases will NOT work.

```sh
git clone https://github.com/yume-chan/ya-webadb.git
cd ya-webadb
```

### Install dependencies

```sh
$ rush update
$ rush install
```

### Everyday commands

1. Build all packages:
- Build all packages:

```sh
$ rush build
```

2. Watch and rebuild all libraries:
- Watch changes and rebuild in all libraries:

```sh
$ rush build:watch
```

3. Start demo dev-server:
- Start demo's dev-server:

```sh
$ cd apps/demo
$ npm run dev
```

Usually you need two terminals to run both 2 and 3.
Usually you need two terminals to run both 2 and 3 to test your changes.

## Deploy Demo

The demo is built with [Next.js](https://nextjs.org/), a full-stack React framework, which usually requires a Node.js environment to run.

However, since the demo doesn't have any server-side code, the most simple deployment method is to use the [Static HTML Export](https://nextjs.org/docs/advanced-features/static-html-export) feature of Next.js. It generates pre-rendered, fully static HTML files, that can be deployed to any static website hosting services (e.g. GitHub Pages).

To export static deployable HTML files, after running `rush build` command, run:

```sh
cd apps/demo
npx next export
```

This will create an `out` folder containing exported HTML files and all required resource files.

## Release new versions

```sh
rush version --bump
export NPM_AUTH_TOKEN=... // Copy NPM auth token from ~/.npmrc
rush publish -p --include-all --set-access-level public
```

## FAQ

### 1. WebUSB and File downloading doesn't when developing/self-host?
### 1. WebUSB and File downloading doesn't work in development/self-host environment?

WebUSB and Service Worker (which is used for file downloading) requires Secure Context (HTTPS or localhost).

If you access the development server using IP address, that will not work.

You can add a self issued SSL certificate, or add the URL to `chrome://flags/#unsafely-treat-insecure-origin-as-secure`.
- If you have a domain name, add a free SSL certificate from [Let's Encrypt](https://letsencrypt.org/).
- If you are using IP address or can't get a free SSL certificate, either
- Add a self-issued SSL certificate and trust it on every device accessing it.
- Add the hostname to `chrome://flags/#unsafely-treat-insecure-origin-as-secure` on every device accessing it.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2022 Simon Chan
Copyright (c) 2020-2023 Simon Chan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
91 changes: 59 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,80 @@ This project is highly based on [ya-webadb](https://github.com/yume-chan/ya-weba

The following document is from the original README.

[![GitHub license](https://img.shields.io/github/license/yume-chan/ya-webadb)](https://github.com/yume-chan/ya-webadb/blob/main/LICENSE)
[![MIT license](https://img.shields.io/github/license/yume-chan/ya-webadb)](https://github.com/yume-chan/ya-webadb/blob/main/LICENSE)

Manipulate Android devices from any (supported) web browsers, even from another Android device.
A library and application for browsers to interact with Android devices via ADB.

All features are working on Chrome for Android, use a C-to-C cable or run WebSockify in Termux to connect.

[🚀 Online Demo](https://yume-chan.github.io/ya-webadb)

For USB connection, close Google ADB (Run `adb kill-server` in a terminal or close `adb.exe` from Task Manager) and all programs that may use ADB (e.g. Android Studio, Visual Studio, Godot Editor, etc.) before connecting.

## Compatibility

| Connection | Chromium-based Browsers | Firefox | Node.js |
| ------------------------------------- | ------------------------------------- | ------- | -------- |
| USB cable | Yes via [WebUSB] | No | Possible |
| Wireless via [WebSocket] <sup>1</sup> | Yes | Yes | Possible |
| Wireless via TCP | Yes via [Direct Sockets] <sup>2</sup> | No | Possible |
| Connection | Chromium-based Browsers | Firefox | Node.js |
| ----------------------------------------- | ------------------------------ | --------- | ----------------------------- |
| USB cable | Supported using [WebUSB] API | No | Supported using `usb` package |
| Wireless through [WebSocket] <sup>1</sup> | Supported | Supported | Possible using `ws` package |
| Wireless through TCP | WIP using [Direct Sockets] API | No | Possible using `net` module |

[WebUSB]: https://wicg.github.io/webusb/
[WebSocket]: https://websockets.spec.whatwg.org/
[Direct Sockets]: https://wicg.github.io/direct-sockets/
[webusb]: https://wicg.github.io/webusb/
[websocket]: https://websockets.spec.whatwg.org/
[direct sockets]: https://wicg.github.io/direct-sockets/

<sup>1</sup> Requires WebSockify softwares, see [instruction](https://github.com/yume-chan/ya-webadb/discussions/245#discussioncomment-384030) for detail.

<sup>2</sup> Chrome for Android doesn't support Direct Sockets. Need extra steps to enable. See [#349](https://github.com/yume-chan/ya-webadb/issues/349) for detail.

## Security concerns
## Features

Accessing USB devices (especially your phone) directly from a web page can be **very dangerous**. Firefox developers even refused to implement the WebUSB standard because they [considered it to be **harmful**](https://mozilla.github.io/standards-positions/#webusb).
- 📁 File Management
- 📋 List
- ⬆ Upload
- ⬇ Download
- 🗑 Delete
- 📷 Screen Capture
- 📜 Terminal Emulator powered by [Tabby](https://github.com/Eugeny/tabby)
- Tabs and split panes
- Color themes
- Rich configuration
- ⚙ Enable ADB over WiFi
- 📦 Install APK
- 🎥 [Scrcpy](https://github.com/Genymobile/scrcpy) compatible client
- Screen mirroring
- Audio forwarding (Android >= 11)
- Recording
- Control device with mouse, touch and keyboard
- 🐛 Chrome Remote Debugging that supporting
- Google Chrome (stable, beta, dev, canary)
- Microsoft Edge (stable, beta, dev, canary)
- Opera (stable, beta)
- Vivaldi
- 🔌 Power and reboot to different modes

## Features
## Contribute

* 📁 File Management
* 📋 List
* ⬆ Upload
* ⬇ Download
* 🗑 Delete
* 📷 Screen Capture
* 📜 Interactiv Shell
* ⚙ Enable ADB over WiFi
* 📦 Install APK
* 🎥 [Scrcpy](https://github.com/Genymobile/scrcpy) compatible client (screen mirroring and controling device)
* 🔌 Power and reboot to different modes
See [CONTRIBUTING.md](./CONTRIBUTING.md)

[📋 Project Roadmap](https://github.com/yume-chan/ya-webadb/issues/348)
## Sponsors

## Contribute
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.

See [CONTRIBUTE.md](./CONTRIBUTE.md)
<a href="https://opencollective.com/ya-webadb/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/0/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/1/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/2/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/3/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/4/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/5/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/6/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/7/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/8/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/9/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/ya-webadb/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/10/avatar.svg?requireActive=false"></a>

## Credits
## Used open-source projects

* Google for [ADB](https://android.googlesource.com/platform/packages/modules/adb) ([Apache License 2.0](./adb.NOTICE))
* Romain Vimont for [Scrcpy](https://github.com/Genymobile/scrcpy) ([Apache License 2.0](https://github.com/Genymobile/scrcpy/blob/master/LICENSE))
- [ADB](https://android.googlesource.com/platform/packages/modules/adb) from Google ([Apache License 2.0](./adb.NOTICE))
- [Scrcpy](https://github.com/Genymobile/scrcpy) from Romain Vimont ([Apache License 2.0](https://github.com/Genymobile/scrcpy/blob/master/LICENSE))
- [Tabby](https://github.com/Eugeny/tabby) from Eugeny ([MIT License](https://github.com/Eugeny/tabby/blob/master/LICENSE))
- [webm-muxer](https://github.com/Vanilagy/webm-muxer) from Vanilagy ([MIT License](https://github.com/Vanilagy/webm-muxer/blob/main/LICENSE))
- [web-streams-polyfill](https://github.com/MattiasBuelens/web-streams-polyfill) from Mattias Buelens ([MIT License](https://github.com/MattiasBuelens/web-streams-polyfill/blob/master/LICENSE))
Loading

0 comments on commit bbd4350

Please sign in to comment.