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

feat: Add proxy for @line/liff-inspector #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

odanado
Copy link
Member

@odanado odanado commented Feb 20, 2025

Description

Currently, the serve command’s --inspect option in liff-cli executes the @line/liff-inspector command with the --cert option.
liff-cli has a feature that can convert HTTP endpoints into HTTPS.
I used this feature to fix it so that @line/liff-inspector can be used without the --cert option.

As a result, it is now easier to combine @line/liff-inspector with tunneling tools like ngrok.

Usage

Run serve command with @line/liff-inspector

$ npx @line/liff-cli serve -l 1234567890-aBcDeFg -u http://localhost:5173/ --inspect
Debugger listening on ws://192.168.11.3:9222

You need to serve this server over SSL/TLS
For help, see: https://github.com/line/liff-inspector#important-liff-inspector-server-need-to-be-served-over-ssltls


Successfully updated endpoint url for LIFF ID: 1234567890-aBcDeFg.

→  LIFF URL:     https://liff.line.me/1234567890-aBcDeFg
→  Proxy server: https://localhost:9000/?li.origin=wss%3A%2F%2Flocalhost%3A9223%2F
connection from client, id: 1234567890-aBcDeFg
DevTools URL: devtools://devtools/bundled/inspector.html?wss=localhost:9223/?hi_id=1234567890-aBcDeFg

Run serve command with @line/liff-inspector and ngrok

$ npx @line/liff-cli serve -l 1234567890-aBcDeFg -u http://localhost:5173/ --inspect --proxy-type ngrok-v1

@odanado odanado force-pushed the add-ws-proxy-for-inspector branch from a8b8b02 to b70b7e7 Compare February 20, 2025 10:03
@@ -55,8 +67,34 @@ export class LocalProxy implements ProxyInterface {
});
}

async cleanup(): Promise<void> {
private async connectWs(targetUrl: URL): Promise<URL> {
const proxy = httpProxy.createProxyServer({ target: targetUrl.toString() });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@odanado odanado marked this pull request as ready for review February 20, 2025 10:04
@odanado odanado requested a review from a team as a code owner February 20, 2025 10:04
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

Successfully merging this pull request may close these issues.

1 participant