-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'd91fef04ddcf7b70ad36dedf2d78e6ebfa9d2d7b' into ya-webad…
…b-0.0.20 * commit 'd91fef04ddcf7b70ad36dedf2d78e6ebfa9d2d7b': (167 commits) 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 chore(doc): fix typo fix(adb): fix tcp reverse tunnel on Android <8 chore: fix build chore: fix build ... # Conflicts: # .github/workflows/deploy.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 # apps/demo/src/pages/bug-report.tsx # apps/demo/src/pages/device-info.tsx # apps/demo/src/pages/file-manager.tsx # apps/demo/src/pages/framebuffer.tsx # apps/demo/src/pages/index.mdx # apps/demo/src/pages/install.tsx # apps/demo/src/pages/logcat.tsx # apps/demo/src/pages/packet-log.tsx # apps/demo/src/pages/power.tsx # apps/demo/src/pages/scrcpy.tsx # apps/demo/src/pages/shell.tsx # apps/demo/src/pages/tcpip.tsx
- Loading branch information
Showing
24 changed files
with
340 additions
and
117 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,48 @@ | ||
name: Cloudflare Pages | ||
|
||
on: [push] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: read | ||
deployments: write | ||
statuses: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
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 | ||
working-directory: ./apps/demo | ||
|
||
- name: Publish to Cloudflare Pages | ||
id: cloudflare_pages_deploy | ||
uses: cloudflare/pages-action@1 | ||
with: | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
projectName: piping-adb | ||
directory: './apps/demo/out' | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add publish URL as commit status | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
// When "pull_request", context.payload.pull_request?.head.sha is expected SHA. | ||
// (base: https://git.luolix.topmunity/t/github-sha-isnt-the-value-expected/17903/2) | ||
const sha = context.payload.pull_request?.head.sha ?? context.sha; | ||
await github.rest.repos.createCommitStatus({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
context: 'Cloudflare Pages', | ||
description: 'Cloudflare Pages deployment', | ||
state: 'success', | ||
sha, | ||
target_url: "${{ steps.cloudflare_pages_deploy.outputs.url }}", | ||
}); |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
name: Build and Deploy to Netlify | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
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 | ||
working-directory: ./apps/demo | ||
- name: Deploy to Netlify | ||
uses: nwtgck/actions-netlify@v1.2 | ||
with: | ||
publish-dir: './apps/demo/out' | ||
production-branch: main | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
deploy-message: "Deploy from GitHub Actions" | ||
enable-pull-request-comment: false | ||
enable-commit-comment: true | ||
overwrites-pull-request-comment: true | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
timeout-minutes: 1 |
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 |
---|---|---|
|
@@ -71,3 +71,5 @@ dts | |
esm | ||
dist | ||
*.tsbuildinfo | ||
|
||
/.pnpm-store |
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
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
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,20 @@ | ||
{ | ||
"name": "Tango", | ||
"short_name": "Tango", | ||
"categories": [ | ||
"utilities", | ||
"developer" | ||
], | ||
"description": "ADB in your browser", | ||
"scope": "/", | ||
"start_url": "/", | ||
"background_color": "#ffffff", | ||
"display": "standalone", | ||
"icons": [ | ||
{ | ||
"src": "favicon-256.png", | ||
"type": "image/png", | ||
"sizes": "256x256" | ||
} | ||
] | ||
} |
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,74 @@ | ||
import { AdbPacket, AdbPacketSerializeStream, type AdbDaemonDevice } from '@yume-chan/adb'; | ||
import { | ||
Consumable, ConsumableWritableStream, | ||
DuplexStreamFactory, | ||
pipeFrom, | ||
ReadableStream as YumeChanReadableStream, | ||
StructDeserializeStream, | ||
} from '@yume-chan/stream-extra'; | ||
|
||
export class AdbPipingBackend implements AdbDaemonDevice { | ||
public readonly serial: string; | ||
public readonly name: string | undefined = undefined; | ||
|
||
public constructor(private params: { | ||
csUrl: string, | ||
scUrl: string, | ||
csHeaders: Headers | undefined, | ||
scHeaders: Headers | undefined, | ||
}) { | ||
this.serial = `piping_${params.csUrl}_${params.scUrl}`; | ||
} | ||
|
||
public async connect() { | ||
const {readable: uploadReadableStream, writable: uploadWritableStream} = new TransformStream<Uint8Array>(); | ||
fetch(this.params.csUrl, { | ||
method: "POST", | ||
// headers: this.params.csHeaders, | ||
body: uploadReadableStream, | ||
duplex: "half", | ||
} as RequestInit); | ||
|
||
const scResReaderPromise = (async () => { | ||
const scRes = await fetch(this.params.scUrl, { | ||
headers: this.params.scHeaders, | ||
}); | ||
return scRes.body!.getReader(); | ||
})() | ||
|
||
const scReadableStream = new ReadableStream<Uint8Array>({ | ||
async pull(ctrl) { | ||
const reader = await scResReaderPromise; | ||
const result = await reader.read(); | ||
if (result.done) { | ||
ctrl.close(); | ||
return; | ||
} | ||
ctrl.enqueue(result.value); | ||
} | ||
}); | ||
|
||
const duplex = new DuplexStreamFactory< | ||
Uint8Array, | ||
Consumable<Uint8Array> | ||
>({ | ||
close: () => { | ||
// TODO: impl | ||
console.log("TODO: close"); | ||
}, | ||
}); | ||
|
||
const readable = duplex.wrapReadable(scReadableStream as YumeChanReadableStream); | ||
const uploadWritableStreamWriter = uploadWritableStream.getWriter(); | ||
const writable = duplex.createWritable(new ConsumableWritableStream({ | ||
async write(chunk) { | ||
await uploadWritableStreamWriter.write(chunk); | ||
} | ||
})); | ||
|
||
return { | ||
readable: readable.pipeThrough(new StructDeserializeStream(AdbPacket)), | ||
writable: pipeFrom(writable, new AdbPacketSerializeStream()), | ||
}; | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.
582532e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Deployed on https://649ad649c2baf9007e45c1ea--piping-adb.netlify.app