cli: add key watch for proxy mode
This commit is contained in:
parent
aa7820a3b3
commit
e638c29ac3
@ -1,5 +1,6 @@
|
|||||||
import WebSocket from "ws"
|
import WebSocket from "ws"
|
||||||
import { MSG } from "./server"
|
import { MSG } from "./server"
|
||||||
|
import qrcode from "qrcode-terminal";
|
||||||
|
|
||||||
export async function linkProxyServer(server: string, proxy: string) {
|
export async function linkProxyServer(server: string, proxy: string) {
|
||||||
console.log("Running in proxy mode", proxy)
|
console.log("Running in proxy mode", proxy)
|
||||||
@ -38,6 +39,16 @@ export async function linkProxyServer(server: string, proxy: string) {
|
|||||||
const transferAddr = proxy.replace(/:[0-9]*/, "") + ":" + nextPort
|
const transferAddr = proxy.replace(/:[0-9]*/, "") + ":" + nextPort
|
||||||
console.log("Get proxy UserId", proxyUserId, "addr", transferAddr)
|
console.log("Get proxy UserId", proxyUserId, "addr", transferAddr)
|
||||||
transferConnector = new WebSocket("ws://" + transferAddr)
|
transferConnector = new WebSocket("ws://" + transferAddr)
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("PROXY ADDRESS: " + transferAddr.green)
|
||||||
|
qrcode.generate(transferAddr, { small: true });
|
||||||
|
process.stdin.on("keypress", function (ch, key) {
|
||||||
|
if (key && key.ctrl && key.name == "p") {
|
||||||
|
console.log("PROXY ADDRESS: " + transferAddr.green)
|
||||||
|
qrcode.generate(transferAddr, { small: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 3000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
controlConnector.on('error', (error) => {
|
controlConnector.on('error', (error) => {
|
||||||
|
@ -5479,7 +5479,11 @@ function initNativeEnvironment(source) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// dev kit client
|
// dev kit client
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const ws = new WebSocket__default["default"]('ws://localhost:7777')
|
const ws = new WebSocket__default["default"]('ws://localhost:7777', {
|
||||||
|
headers: {
|
||||||
|
"role": "DEBUGGER"
|
||||||
|
}
|
||||||
|
})
|
||||||
.on('open', () => {
|
.on('open', () => {
|
||||||
console.log('Connectted Devkit on port', '7777');
|
console.log('Connectted Devkit on port', '7777');
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
|
@ -42,7 +42,11 @@ global.doric = doric
|
|||||||
async function initNativeEnvironment(source: string) {
|
async function initNativeEnvironment(source: string) {
|
||||||
// dev kit client
|
// dev kit client
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
const ws = new WebSocket('ws://localhost:7777')
|
const ws = new WebSocket('ws://localhost:7777', {
|
||||||
|
headers: {
|
||||||
|
"role": "DEBUGGER"
|
||||||
|
}
|
||||||
|
})
|
||||||
.on('open', () => {
|
.on('open', () => {
|
||||||
console.log('Connectted Devkit on port', '7777')
|
console.log('Connectted Devkit on port', '7777')
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
|
@ -42,7 +42,11 @@ function initNativeEnvironment(source) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// dev kit client
|
// dev kit client
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const ws = new WebSocket('ws://localhost:7777')
|
const ws = new WebSocket('ws://localhost:7777', {
|
||||||
|
headers: {
|
||||||
|
"role": "DEBUGGER"
|
||||||
|
}
|
||||||
|
})
|
||||||
.on('open', () => {
|
.on('open', () => {
|
||||||
console.log('Connectted Devkit on port', '7777');
|
console.log('Connectted Devkit on port', '7777');
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
|
12
doric-web/dist/index.js
vendored
12
doric-web/dist/index.js
vendored
@ -2482,6 +2482,7 @@ class Panel {
|
|||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
this.__rendering__ = false;
|
this.__rendering__ = false;
|
||||||
|
this.callingRenderFinishedCallback = false;
|
||||||
this.snapshotEnabled = false;
|
this.snapshotEnabled = false;
|
||||||
this.renderSnapshots = [];
|
this.renderSnapshots = [];
|
||||||
}
|
}
|
||||||
@ -2663,12 +2664,17 @@ class Panel {
|
|||||||
return diryData;
|
return diryData;
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
onRenderFinished() {
|
||||||
|
this.callingRenderFinishedCallback = true;
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
e();
|
e();
|
||||||
});
|
});
|
||||||
this.onRenderFinishedCallback.length = 0;
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
this.callingRenderFinishedCallback = false;
|
||||||
}
|
}
|
||||||
addOnRenderFinishedCallback(cb) {
|
addOnRenderFinishedCallback(cb) {
|
||||||
|
if (this.callingRenderFinishedCallback) {
|
||||||
|
loge("Do not call addOnRenderFinishedCallback recursively");
|
||||||
|
}
|
||||||
this.onRenderFinishedCallback.push(cb);
|
this.onRenderFinishedCallback.push(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3525,9 +3531,13 @@ class List extends Superview {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param {number} config.topOffset - 目标位置cell的顶部偏移量
|
||||||
|
*/
|
||||||
scrollToItem(context, index, config) {
|
scrollToItem(context, index, config) {
|
||||||
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
const topOffset = config === null || config === void 0 ? void 0 : config.topOffset;
|
||||||
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, topOffset });
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param context
|
* @param context
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user