Giter Site home page Giter Site logo

yume-chan / ya-webadb Goto Github PK

View Code? Open in Web Editor NEW
2.3K 34.0 298.0 230.56 MB

ADB in your browser

Home Page: https://tangoapp.dev/

License: MIT License

JavaScript 2.98% TypeScript 97.00% HTML 0.03%
webusb-api android-phone webadb adb android-debug-bridge android scrcpy

ya-webadb's Introduction

Tango

Tango

ADB in your browser

MIT License GitHub release npm Discord

Tango is a TypeScript re-implementation of ADB (Android Debugging Bridge) client that works in Chromium-based browsers (including Chrome for Android), Node.js, and Electron.

Try it out at https://app.tangoapp.dev

Documentation

Check the latest documentation at https://docs.tangoapp.dev/

Contribute

See CONTRIBUTING.md for how to run and develop this project.

Sponsors

Become a backer and get your image on our README on Github with a link to your site.

ya-webadb's People

Contributors

18506711722 avatar axetroy avatar cedricdevriendt avatar dependabot[bot] avatar lordgiacomos avatar oott123 avatar phpmalik avatar renovate-bot avatar renovate[bot] avatar troy-lamerton avatar upintheairsheep avatar yume-chan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ya-webadb's Issues

Add more power options listed here

Long press power button - adb shell input keyevent --longpress 26
Lock Screen - adb shell input keyevent 223
Wake up device - adb shell input keyevent 224
Dim screen - adb shell input keyevent 276

logcat

You can start, stop, filter, view, and save log cat on android. It is off until you click on so the RAM is saved.

Add device option missing

Hi, I was in the online demo a month ago Then there was an option to connect a device through web usb. Option that does not currently exist but is still supported in Chrome.
There is a site (app.webadb.com) that probably uses your code and it still allows the connection, is it a bug, or did you intentionally remove this option?
Screenshot_20211214-212920_Chrome.jpg

Error: access denied when trying to connect to the device

Despite the fact that I can use adb via USB and wifi, use scrcpy etc. via a terminal, I can't connect to my device with WebADB, I don't know why:

image

Note that the Android device appears under the available devices section.


  • PC: Kubuntu 20.04 & Chromium v. 88
  • Mobile: Android 6.0.1 on Samsung Galaxy XCover 3

Project won't work in production after importing

Hi Yume Chan,

After implementing the package, when I build my create-react-app project and serve the build folder using serve -s build. I get a blank page but I do get an error that I see in the console is this weird error.

`
Uncaught TypeError: Cannot convert a BigInt value to a number
at Math.pow ()
at Object. (crypto.ts:5)
at a ((index):1)
at Module.2203 (main.a1a47e62.chunk.js:31192)
at a ((index):1)
at t ((index):1)
at Array.r [as push] ((index):1)
at main.a1a47e62.chunk.js:1

`

I do not understand where this is coming from because I have not used the crypto package in my package.json file.

If you could help then I would be really grateful.

parseScrcpyOutput匹配空行有个错误

while(line = lines.next()) 匹配到空字符串""的时候也会退出循环,导致scrcpy经常启动的时候提示错误(ws连接)。
修改成while ((line = lines.next()) !== undefined) 正常

App management

  • Enumrate installed apps
    • icon, name, package name, version, target api, arch
    • permission
    • ❓ size
  • Install app
    • apk
      • legacy mode
        • normal push
        • [ ] fast deploy
      • stream mode
        • normal stream
        • [ ] fast deploy
        • cmd package
    • ❓ aab
    • ❓ apkm (by apkmirror)
    • ❓ xapk (by apkpure)
  • Uninstall app
    • pm
    • cmd package
  • Launch app/activities (am) #366
  • Backup/restore individual app data (bu) #354
  • Demo

Fast deploy first pushes and runs a helper app on device. For native ADB the helper app is embedded in the binary file as a resource. It's always hard to build Android components due to the resource usage, so it won't be supported.

demo run fail

npm install will show as below:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@yume-chan%2fadb-backend-ws - Not found
npm ERR! 404
npm ERR! 404 '@yume-chan/adb-backend-ws@^0.0.9' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'demo'

am

Add the ability to open activities via webADB

Project Roadmap

Architecture

File Manager

  • Multi-select and download as zip
    • Download as folder using File System API
  • Upload queue
    • Upload folder

Scrcpy

  • Adapt version 1.18
    • Argument change (powerOffOnClose)
    • Encoder list output format change
    • Back key event format change
  • Support multiple server versions
    • 1.16~1.17
    • 1.18~1.20
    • 1.21 (major argument format change)
    • 1.22
  • Support mouse scroll wheel events
  • Support all mouse buttons

Low Priority:

Scrcpy decoder

AOA HID emulation

Android Open Accessory: https://source.android.com/devices/accessories/aoa2

Connection

App management

See #373

Android binary wrapper

These ADB commands just execute a file on device, and pipe the output

  • logcat/lolcat/longcat - logcat #339 #359
  • backup/restore - /system/bin/bu #354

Documentation

  • Build and development instruction
  • ADB book

Run it as a server

Hi, thanks for amazing work! I have a usecase where I need to use it as a server. Is there some easy way we could support that?

Help test the raw TCP wireless backend

Direct Sockets API (formerly, "raw sockets API") (Chrome Platform Status) allows Web applications to create raw TCP or UDP sockets .

It has been implemented in Chrome for quite a while, but because the uncertainty and unsolved problems in the spec, it never been enabled.

To enable Direct Sockets API in a Chromium-based browser:

  • Chromium before 98: add --enable-features=DirectSockets command line arguments.
  • Chromium 98 and after: also add --restricted-api-origins=https://www.example.com to command line arguments, or set allowed origins from chrome://flags/#restricted-api-origins. (replace https://www.example.com with real origin using the Direct Sockets API, to add multiple origins, separates them with comma)

It should be possible to create an ADB backend using this API to achieve plugin-free wireless connection.

License

First of all great work, this is absolutely incredible.

What license is this repository under? I want to use this in a project of mine, but I am restricted to permissive licenses.

Would you be able to clarify which license this project is under?

Add another power option

Long press power button - adb shell input keyevent --longpress 26
Lock Screen - adb shell input keyevent 223
Wake up device - adb shell input keyevent 224

connect to adb via wifi

Is is possible to connect to adb over wifi? Currently the device has to be connected to the computer via usb right?

Thanks

Grant LogCat reader to read logs

This will be very helpful for users that would love to view LogCat anywhere.

adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS

To do the opposite

adb shell pm revoke com.dp.logcatapp android.permission.READ_LOGS

Any trick to connect to emulators?

I was wondering about does it possible to connect to emulators like Bluestack / Nox / LD Player or something?

Or any trick for it? like by installed some program or something to fake it.

Thanks

Request: Power section

It contains lots of buttons related to power. All of them except the sleep one need a warning message so a noob doesn't go in the wrong menu.

有些设备解析出来图像的宽高不正确

在rk3399芯片的设备上使用的OMX.rk.video_encoder.avc编码器返回的数据解析sps的时候,获取到的宽高都为0,注释掉if (pts === NoPts)区块内的代码是正常的,只不过没法动态旋转屏幕了
这是nalu数据 00000001274200288d6804404de5e1000003000100000300780f107a800000000128ce3248

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

How to use the adb module on my own project?

Hello,I am a newbee on web develop and want to use your adb module to implement some similar functions on website.So,how do I use your code?I build your code into javascript and use rollup.js to pack into one js file.However,when I use it on <script/> block,some err happened.

Uncaught (in promise) RangeError: Division by zero
    at powMod (adb.bundle.js:344)
    at sign (adb.bundle.js:395)
    at AdbSignatureAuthenticator (adb.bundle.js:1615)
    at async AdbAuthenticationHandler.runAuthenticator (adb.bundle.js:1666)
    at async AdbAuthenticationHandler.handle (adb.bundle.js:1683)
    at :8000/async http:/127.0.0.1:8000/adb.bundle.js:2519

my code to invoke your adb module is:

async function connectDevice(){
    let adbWebBackend =await AdbWebBackend.getDevices();
    if (adbWebBackend.length!=0){
        let logger = new AdbEventLogger();
        let adbDevice = new Adb(adbWebBackend[0],logger);
        await adbDevice.connect();
        let res = await adbDevice.getProp('ro.build.version.release');
        console.log(res);
    }else{
        console.log('no device found');
    }
}

File manager: Text box paths

Make it like the files can be changed with a text box. For example, C:/a/b is disallowed and C:/a/b/c/ is allowed, so you can change the path manually.

Adapt Scrcpy 1.22

control: false

Before 1.22, scrcpy protocol always has two sockets: one for video, one for control message.

In 1.22, when control is false, the control socket will no longer be created.

It's a breaking change we must support if we want to use control: false

Potential changes:

  • Move connection creation logic into versioned options

send_frame_meta: false

Not sending frame metadata is actually the default behavior in ancient versions. The video socket only contains raw H.264 streams.

In a later version the server will send pts and packet size preceding each packet, and this option was added to maintain backward compatibility.

pts is useful for recording, to avoid incorrect frame time due to encoding and transmitting delay variation. But mirroring always renders the latest frame on arrival, so pts is not required.

However, the video socket is not always one H.264 stream. When device screen rotates, video size will change, and a new H.264 stream with new size replaces the old one.

Checking pts == 0 can detect such stream restarts, parse video encoding/size, and re-initialize decoder. In theory, I can also parse the whole stream to find restarts, but that will be super complicate (I need to implement all H.264 protocol) and inefficient (parse whole stream twice). So send_frame_meta: false can't be supported before finding an alternate method for detecting stream restarts.

Potential changes:

None

send_device_meta: false

The video socket begins with 64 bytes of device name, 4 bytes of video width and 4 bytes of video height. It's independent with send_frame_meta option.

My implementation doesn't need this, so it's possible to remove them.

Potential changes:

  • Create a parseVideoPrologue function in versioned options
  • Hook up parseVideoPrologue from receiveVideo
  • Enable send_device_meta: false from caller

send_dummy_byte: false

In forward connection mode (scrcpy client connects to scrcpy server, when tunnel_forward: true), server will sends a 0 to video socket to signal ready.

send_dummy_byte: false disables this behavior.

Because tunnel_forward: true is only required when a Android 8 or earlier device is connected via ADB over WiFi, and this only removes one byte, I don't think it's meaningful to support this option by add more logic here.

Potential changes:

None

Your browser does not support WebUSB standard, which is required for this site to work.

换成centos8后,rush build正常了,但是rush build:watch最后报一个ERROR: Cannot read property 'size' of undefined,在demo下npm run dev后,访问管理页面提示:Error
Your browser does not support WebUSB standard, which is required for this site to work.
但是浏览器访问 Online Demo的网址却一切正常,请问是什么原因?

ScrcpyClient.getEncoders失败

ScrcpyClient.getEncoders调用的时候没有设置tunnelForward变量值,导致使用不支持reverse的设备使用forward方式无法连接。

Webadb scrcpy solution for line adjustements

Dear,

the web browser scrcpy solution is really a good idea, and webadb is really full options. BUT, please, could we change "resolution max", "refresh rate" etc...... like in the desktop version of scrcpy on this browser version ? Because without these adjustment , for my computer and Edge browser it is too slow (because of high resolution not needed).

Thank you to explain me please where to put "line instruction" ?

Alain

Periodic green screen on NVIDIA Shield Portable

First of all, cool project! I was looking for a web-based solution to connect to Android devices and came across this.

Currently I'm testing with an NVIDIA Shield Portable running Android 5.1 and for some reason periodically it would flash a green screen on scrcpy. I have tried the following encoders and both had the same issue:

OMX.Nvidia.h264.encoder
OMX.google.h264.encoder

This was tested on Chrome Version 91.0.4472.114 (Official Build) (x86_64) on macOS Big Sur 11.3.1. I also tested running scrcpy 1.18 locally and didn't encounter the issue.

Do you have any ideas what's causing the issue? Thanks!

navigation bar toggle

I would like the ability to remove the navigation bar in the scrcpy program.

I have been using vyzor as my go-to android mirroring web app, but the resolution is pretty bad because I have been using the free version.

the toggle navigation bar would be in the settings tab of the scrcpy program.

scrcpy landscape bug

The scrcpy program only works in portrait mode. Whenever I put my tablet in landscape mode, the window becomes thin, and I can't see anything.

Vanilla integration

Need separate feature bundles, that are easy to integrate in a vanilla project

Npm package for @yume-chan/adb-backend-ws not found

When I try to install the npm package for adb-backend-ws, I get the following errors.

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@yume-chan%2fadb-backend-ws - Not found
npm ERR! 404
npm ERR! 404 '@yume-chan/adb-backend-ws@^0.0.9' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Call & dial support

Call: adb shell service call phone 2 s16 "" s16 "
[Insert number here]"

Put a warning about this being real and not fake And about fees and say don't call 911 because this is real unless it is an emergency

Dial: adb shell service call phone 1 s16 "[Insert number here]"

A more tame option that just dials and NOT call

No matching version found for @yume-chan/adb@^0.0.7

I tried to install @yume-chan/adb-backend-webusb as follows.

npm i -S @yume-chan/adb-backend-webusb

But, I had an error as follows.

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @yume-chan/adb@^0.0.7.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of '@yume-chan/adb-backend-webusb'
npm ERR! notarget 

The package.json in @yume-chan/[email protected] uses 0.7.0. The package.json was downloaded from npm using npm pack.

{
    "name": "@yume-chan/adb-backend-webusb",
    "version": "0.0.8",
    "description": "Backend for `@yume-chan/adb` using WebUSB API.",
 ...
    "dependencies": {
        "@types/w3c-web-usb": "1.0.4",
        "@yume-chan/adb": "^0.0.7",
        "@yume-chan/event": "^0.0.7",
        "tslib": "2.1.0"
    },
...
    "gitHead": "1f9d44107e5697ae438b9226ca77328037c7e3db"
}

Adb sideload support

Add support to sideload a rom, but say not recommend as it is really fragile and this isn't really stable.

Support for getting device data

Get state - adb get-statе
Get cereal number - adb get-serialno
Get IMEI - adb shell dumpsys iphonesybinfo (when I see this command, my eye shifts to the text “iphone”. Are you the same?)
Get TCP connectivity stuff - adb shell netstat
Get current directory - adb shell pwd
Get Battery status and info -adb shell dumpsys battery
List device features - adb shell pm list features
List services - adb shell service list
Get activity info/information - adb shell dumpsys activity /
Print Process status - adb shell ps
Get Screen resolution - adb shell wm size
Get activity of current app - dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.