The universal DevTools for LIFF (WebView) browser

Overview

Check code health

LIFF Inspector 🔬

The universal DevTools for LIFF (WebView) browser

LIFF Inspector is the official DevTools for LIFF(LNE Frontend Framework) that is integrated with the latest ChromeDevTools and built on top of the ChromeDevTools Protocol.

LIFF browser ChromeDevTools
image image



日本語版

TOC

Features

📱 Enable debugging LIFF Browser and WebView with debugging options disabled

🌍 Remote debug

🔬 Support Elements, Console and NetWork tabs of ChromeDevTools

Getting Started

LIFF Inspector consists of two components:

  • LIFF Inspector Server
  • LIFF Inspector Plugin

LIFF Inspector Server is a server program that mediates communication between LIFF app and ChromeDevTools. LIFF Inspector Plugin is a LIFF Plugin. LIFF Plugin is available in LIFF SDK v2.19.0 or later.

1. Start LIFF Inspector Server

$ npx @line/liff-inspector
Debugger listening on ws://{IP Address}:9222

2. Install LIFF Inspector Plugin to your LIFF App

$ npm install @line/liff-inspector
import liff from '@line/liff';
import LIFFInspectorPlugin from '@line/liff-inspector';

liff.use(new LIFFInspectorPlugin());

3. Connect LIFF App and LIFF Inspector Server

Before the actual liff.init process, LIFF Inspector Plugin will try to connect LIFF Inspector Server. Debugging with LIFF Inspector is available immediately after liff.init call.

liff.init({ liffId: 'liff-xxxx' }).then(() => {
  // LIFF Inspector has been enabled
});

Important: LIFF Inspector Server need to be served over SSL/TLS

By default, LIFF Inspector Server starts a local server on ws://localhost:9222, and your LIFF App is served over HTTPS (https://liff.line.me/xxx-yyy). LIFF Inspector Plugin will try to connect to ws://localhost:9222 from https://liff.line.me/xxx-yyy but this will fail due to mixed content.

To eliminate mixed content, you need to serve LIFF Inspector Server over HTTPS (wss://). We have two recommended ways:

Serve local server over HTTPS

  1. Using ngrok to make LIFF Inspector Server public
    1. Run ngrok
      $ ngrok http 9222
    2. Copy the published URL
      $ node -e "const res=$(curl -s -sS http://127.0.0.1:4040/api/tunnels); const url=new URL(res.tunnels[0].public_url); console.log('wss://'+url.host);"
      wss://xxxx-xxx-xxx.ngrok   # Copy this url
  2. Running LIFF Inspector Server with HTTPS using mkcert

Set HTTPS URL to LIFF Inspector Plugin

Once LIFF Inspector Server runs over HTTPS, you need to specify its origin to LIFF Inspector Plugin.

  1. Use URL Search Parameter: ?li.origin=

    Add ?li.origin= query to the Endpoint URL of your LIFF App in LINE Developers Console.

    image

  2. Use origin config of LIFF Inspector Plugin

    // Default origin: ws://localhost:9222
    liff.use(new LIFFInspectorPlugin({ origin: 'wss://xxx-xx-xx-xx.ngrok.io' }));

Priority

LIFF Inspector Plugin attempts to connect to given origin in the order li.origin (1), origin config (2).

(Pseudo code)

const originFromURL = new URLSearchParams(search).get('li.origin');
const originFromConfig = config.origin;
const defaultOrigin = 'ws://localhost:9222';
connect(originFromURL ?? originFromConfig ?? defaultOrigin);

Example

See https://github.com/cola119/liff-inspector-example

Roadmap

Contributions Welcome!

Elements Tab

  • To display Elements
  • To display overlays
  • To remove/add/edit Elements
  • To display styles

Console Tab

  • To display console logs
    • console.log
    • console.warn
    • console.error
    • console.info
    • others
  • To execute local scripts

Network Tab

  • To display simple network logs
    • Fetch/XHR
      • fetch()
      • XMLHttpRequest
      • sendBeacon()
      • others
    • Others(JS/CSS/Img/Media/Font...)
      • Technically difficult to intercept them...

Application Tab

  • LocalStorage
  • SessionStorage
  • Cookies
  • others

Contribution

See CONTRIBUTING.md

You might also like...

Export Cypress Tests from Google Chrome DevTools' Recorder

@cypress/chrome-recorder This repo provides tools to export Cypress Tests from Google Chrome DevTools' Recordings Installation $ npm install -g @cypre

Dec 20, 2022

API and CLI tool to fetch and query Chome DevTools heap snapshots.

Puppeteer Heap Snapshot Capture heap snapshots and query the snapshot for objects matching a set of properties. Read more about it in this blog post.

Jan 3, 2023

React-query devtools for swr

React-query devtools for swr

React-query devtools for swr

Aug 14, 2022

Generate WebdriverIO Tests from Google Chrome DevTools Recordings.

WebdriverIO Chrome Recorder This repo provide tools to convert JSON user flows from Google Chrome DevTools Recorder to WebdriverIO test scripts progra

Sep 28, 2022

Just a Universal Mineflayer Bot (Opensourced)

Just a Universal Mineflayer Bot (Opensourced)

❓ What is JUMBO? JUMBO (Just a Universal Mineflayer Bot - Opensourced) is a Minecraft robot made using Mineflayer package and its addons. Supports MC

Dec 9, 2022

Universal interface for web3 wallets

Universal interface for web3 wallets

Dec 31, 2022

Flight is a universal package manager for your needs, no matter what language you may want to write your code in.

Flight Swift, reliable, multi-language package manager. ⚡ Installation We don't have an official release of Flight yet, however, if you would like to

Dec 25, 2022

A Flow-based programming language for universal applications.

A Flow-based programming language for universal applications.

Hlang A Flow-based programming language for universal applications. Hlang aims to make programming easier, faster and more comfortable. It avoids codi

Dec 25, 2022

Universal interface for web3 wallets

web3-wallets Universal interface for web3 wallets dapp wallets blockchains ╭─

Dec 31, 2022
Comments
  • support

    support "TrustProxies" option

    When running inspector server behind a proxy like a load balancer, both app client and inspector client access to inspector server with SSL, but the proxy access to inspector server without SSL.

    inspector server shows: DevTools URL: devtools://devtools/bundled/inspector.html?ws=****

    correct url is: DevTools URL: devtools://devtools/bundled/inspector.html?wss=****

    Switching display url option is needed like Laravel TrustProxies middleware.

    opened by snmatsui 2
  • feat: detect protocol according to x-forwarded-proto

    feat: detect protocol according to x-forwarded-proto

    Fixed #5

    The protocol that is determined when LIFF Inspector Server gets started and the protocol to which the client connects may be different under a proxy network.

    LIFF App (client) <--- https ---> load balancer <--- http ---> LIFF Inspector Server

    Currently the protocol of the devtools URL shown in console is determined by how LIFF Inspector Server is started, which results in showing the inconsistent protocol.

    opened by cola119 0
  • ☔️ Support Console API

    ☔️ Support Console API

    Currently liff-inspector supports four console APIs: console.(log|warn|error|info) but there are still a lot methods in Console instance. We welcome PRs that implements APIs not yet supported.

    Remaining APIs

    • [x] console.log
    • [x] console.warn
    • [x] console.error
    • [x] console.info
    • [ ] console.assert
    • [ ] console.clear
    • [ ] console.count
    • [ ] console.countReset
    • [ ] console.debug
    • [ ] console.dir
    • [ ] console.dirxml
    • [ ] console.exception
    • [ ] console.group
    • [ ] console.groupCollapsed
    • [ ] console.groupEnd
    • [ ] console.profile
    • [ ] console.profileEnd
    • [ ] console.table
    • [ ] console.time
    • [ ] console.timeEnd
    • [ ] console.timeLog
    • [ ] console.timeStamp
    • [ ] console.trace

    https://developer.mozilla.org/en-US/docs/Web/API/console#methods

    good first issue 
    opened by cola119 0
Releases(v1.0.2)
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
macOS Internal Webview App SourceCode

macOS Internal Webview App SourceCode Read First Inspecting Web Views in macOS System Preferences Family Sharing wget https://setup.icloud.com/resourc

不郑 4 Mar 7, 2022
Sample apps showing how to build music and video apps for Xbox using a WebView.

description languages name page_type products urlFragment Sample showing how to build music and video apps using primarily web technologies for Xbox.

Microsoft 11 Dec 14, 2022
Webview is a tiny cross-platform library to make web-based GUIs for desktop applications.

webview_deno deno bindings for webview Webview is a tiny cross-platform library to make web-based GUIs for desktop applications. ⚠️ This project is st

webview 1.2k Jan 2, 2023
A Node.js binding to webview

webview-nodejs English | 中文(简体) A Node.js binding to webview, a tiny cross-platform webview library to build modern cross-platform desktop GUIs using

Winterreisender 12 Dec 13, 2022
A MagicMirror² module which embeds multiple other websites with iframe or webview

MMM-EmbedURL This is a MagicMirror² module which embeds other websites either by "iframe" (default), "webview" or a custom HTML-element to your mirror

Thomas Hirschberger 6 Dec 18, 2022
Lightweight universal Cloudflare API client library for Node.js, Browser, and CF Workers

Cloudflare API Client Lightweight universal HTTP client for Cloudflare API based on Fetch API that works in Node.js, browser, and CF Workers environme

Kriasoft 15 Nov 13, 2022
基于React开发的新一代web调试工具,支持React组件调试,类似于Chrome Devtools。A Lightweight, Easy To Extend Web Debugging Tool Build With React

English | 简体中文 基于React开发的移动web调试工具 更新日志 简单易用 功能全面 易扩展 高性能 使用cdn方式,一键接入 类Chrome devtools, 内嵌React开发者工具,支持日志,网络,元素,代理,存储,性能等, 具有更好的网络捕获能力和丰富的日志展现形式 暴露内部

腾讯TNTWeb前端团队 236 Dec 25, 2022