GithubHelp home page GithubHelp logo

babywyrm / monolith-of-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rhysd/monolith-of-web

0.0 0.0 0.0 2.72 MB

A chrome extension to make a single static HTML file of the web page using a WebAssembly port of monolith CLI

License: MIT License

TypeScript 80.97% CSS 2.84% HTML 16.19%

monolith-of-web's Introduction

'Monolith of Web': Chrome Extension Port of Monolith

'Monolith of Web' is a Chrome extension ported from CLI tool Monolith. Monolith is a CLI tool to download a web page as static single HTML file. 'Monolith of Web' provides the same functionality as a browser extension by compiling Monolith (written in Rust) into WebAssembly.

usage screenshot

Installation

Usage

popup screenshot

  1. Go to a web page you want to store
  2. Click 'Monolith of Web' icon in a browser bar (above popup window will open)
  3. Click 'Get Monolith' button
  4. Wait for the process completing
  5. The generated single static HTML file is stored in your downloads folder

By toggling icons at bottom of the popup window, you can determine to or not to include followings in the generated HTML file.

  • JavaScript
  • CSS
  • <iframe/>
  • Images

The button at right-bottom toggles if allow CORS request or not. Please read following 'Permissions' section and 'CORS Requests in Background Page' section for more details.

Permissions

  • Required permissions
    • activeTab: This extension gets an HTML text and a page title from the active tab to generate a monolith
    • storage: This extension remembers the last state of toggle buttons at bottom in the popup window.
  • Optional permissions
    • http://*/* and https://*/*: Allow any cross-origin requests in background page. This is runtime permission so this extension does not require by default. Only when you see a broken HTML file is generated due to CORS error in background page, please enable this option. The reason of these permissions are explained in next 'CORS Requests in Background Page' section.

CORS Requests in Background Page

This extension generates a single HTML file in background page of Chrome extension. Since CSP in a content script is not applied in a background page, some resources in content's HTML cannot be fetched in background page.

By default, this extension ignores CORS errors in background page. It is usually not a problem since resources protected by CSP are usually scripts which don't affect main content. But a broken single HTML page may be generated due to CORS errors.

When you see a broken page due to the CORS error in background page, please enable 'allow CORS requests' button at right-bottom in the popup window. Permission dialog will appear to require permissions for sending CORS requests in background page. After accepting it, CORS request error is disabled and all resources should be fetched with no error.

After generating a single HTML file with the runtime permissions, this extension will remove the permissions as soon as possible for security.

Development

WebAssembly port of Monolith is developed in the forked repository. Currently it has some differences and duplicates against the original repository. reqwest did not support Wasm before 0.10.0 so my Wasm port does not use it and uses fetch() directly via js_sys and web_sys crate.

This repository adds the forked Monolith repository as a Git submodule and uses it by bundling sources with Webpack.

Contributing

Creating an issue

Before reporting an issue, please try the same URL with CLI version. If it is reproducible with CLI version, please report it to the CLI repository at first.

If it is not reproducible with CLI version (it means the issue only occurs with this extension), please report it from issues page.

Improve Wasm part

This repository only includes TypeScript part of extension. Wasm part is developed in forked monolith repository. If your improvement can be applied to upstream, please make a pull request in the upstream at first. After the pull request is merged, please make an issue to request to merge upstream at this repository or the forked repository.

License

Distributed under the MIT license.

monolith-of-web's People

Contributors

rhysd avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.