Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能用ip地址连接,但是qr code不会显示 #16

Open
wordscode opened this issue Jan 15, 2023 · 3 comments
Open

能用ip地址连接,但是qr code不会显示 #16

wordscode opened this issue Jan 15, 2023 · 3 comments

Comments

@wordscode
Copy link

手机和电脑通过ip地址连接上了,但是vs code按 Ctrl+Shift+P 搜索执行Show qr code命令,有Qr code窗口但是不会显示二维码。
image

@capitalwell
Copy link

遇到同样的问题,顶一下

@Lateryzh
Copy link

表示地址也连不上。。。。

@UGYnpU2nuB8QCFqDrsWZgmxMBp43WQ

需要修改文件 -----.vscode\extensions\aaroncheng.auto-js-vsce-fixed-1.109.0\out\extension.js
类Extension(98行-135行)中的内容

class Extension {
    constructor() {
        this.documentViewPanel = undefined;
        this.qrCodeViewPanel = undefined;
        this.documentCache = new Map();
    }

    showServerAddress() {
        let servers = server.getIPs().join(":" + server.getPort() + " or ") + ":" + server.getPort();
        vscode.window.showInformationMessage(`Auto.js Autox.js \r\n server running on ${servers}`);
    }

    showQrCode() {
        let ips = server.getIPs();
        if (ips.length == 1) {
            this.showQrcodeWebview(ips[0]);
        } else {
            vscode.window.showQuickPick(ips).then(ip => {
                this.showQrcodeWebview(ip);
            });
        }
    }

    showQrcodeWebview(ip) {
        let url = `ws://${ip}:${server.getPort()}`;
        if (!this.qrCodeViewPanel) {
            this.qrCodeViewPanel = vscode.window.createWebviewPanel('Qr code', "Qr code", vscode.ViewColumn.Beside, {
                enableScripts: true,
            });

            this.qrCodeViewPanel.onDidDispose(() => {
                this.qrCodeViewPanel = undefined;
            }, undefined, exports._context.subscriptions);
        }
        this.qrCodeViewPanel.webview.html = this.getQrCodeHtml(this.qrCodeViewPanel.webview, url);
    }

    getQrCodeHtml(webview, text) {
        const icon = this.getVscodeResourceUrl(webview, "logo.png");
        const qrcodejs = this.getVscodeResourceUrl(webview, "assets/qrcode.js");
        return `<!DOCTYPE html>
    getVscodeResourceUrl(webview, relativePath) {
        const onDiskPath = vscode.Uri.file(path.join(exports._context.extensionPath, relativePath));
        return webview.asWebviewUri(onDiskPath);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants