Coder Social home page Coder Social logo

beakerbrowser / beaker Goto Github PK

View Code? Open in Web Editor NEW
6.7K 191.0 547.0 41.47 MB

An experimental peer-to-peer Web browser

Home Page: https://beakerbrowser.com/

License: MIT License

JavaScript 95.81% HTML 1.50% CSS 2.59% Shell 0.10%
browser web decentralized p2p beaker electron hypercore hyperspace hyperdrive

beaker's Introduction

Beaker Browser

Beaker was an experimental peer-to-peer Web browser. It adds new APIs for building hostless applications while remaining compatible with the rest of the Web. Visit the website.

Table of Contents

Installing

Binaries

Visit the Releases Page to find the installer you need.

Building from source

Requires node 12 or higher.

In Linux (and in some cases macOS) you need libtool, m4, autoconf, and automake:

sudo apt-get install libtool m4 make g++ autoconf # debian/ubuntu
sudo dnf install libtool m4 make gcc-c++ libXScrnSaver  # fedora
brew install libtool autoconf automake # macos

In Windows, you'll need to install Python 2.7, Visual Studio 2015 or 2017, and Git. (You might try windows-build-tools.) Then run:

npm config set python c:/python27
npm config set msvs_version 2017
npm install -g node-gyp
npm install -g gulp

To build:

git clone https://github.com/beakerbrowser/beaker.git
cd beaker/scripts
npm install # don't worry about v8 api errors building native modules - rebuild will fix
npm run rebuild # needed after each install. see https://github.com/electron/electron/issues/5851
npm start

If you pull latest from the repo and get weird module errors, do:

npm run burnthemall

This invokes the mad king, who will torch your node_modules/, and do the full install/rebuild process for you. (We chose that command name when GoT was still cool.) npm start should work afterward.

If you're doing development, npm run watch to have assets build automatically.

Env Vars

  • DEBUG: which log systems to output? A comma-separated string. Can be beaker, dat, bittorrent-dht, dns-discovery, hypercore-protocol. Specify * for all.
  • BEAKER_OPEN_URL: open the given URL on load, rather than the previous session or default tab.
  • BEAKER_USER_DATA_PATH: override the user-data path, therefore changing where data is read/written. Useful for testing. For default value see userData in the electron docs.
  • BEAKER_DAT_QUOTA_DEFAULT_BYTES_ALLOWED: override the default max-quota for bytes allowed to be written by a dat site. Useful for testing. Default value is '500mb'. This can be a Number or a String. Check bytes.parse for supported units and abbreviations.

Vulnerability disclosure

See SECURITY.md for reporting security issues and vulnerabilities.

Known issues

tmux

Launching from tmux is known to cause issues with GUI apps in macOS. On Beaker, it may cause the application to hang during startup.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

License

MIT License (MIT)

Copyright (c) 2018 Blue Link Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

beaker's People

Contributors

0xdaksh avatar alamantus avatar andrewosh avatar azcn2503 avatar da2x avatar dmp1ce avatar dtv96calibre avatar edrex avatar figueredo avatar frabrunelle avatar hughisaacs2 avatar krismuniz avatar lvivier avatar mafintosh avatar matt1 avatar matthewauld avatar mixmix avatar paul90 avatar pfrazee avatar pmario avatar poga avatar ralphtheninja avatar rickycodes avatar safrmo avatar shmuelhizmi avatar taravancil avatar voxpelli avatar webdesserts avatar xdamman avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beaker's Issues

PouchDB over Websql

I did quite a bit of research into databases for the browser and ultimately settled on pouchdb. It works in the browser, has gracefull fallback to whichever database the browser supports. It also has lots of plugins and is couch DB compatible. I was even table to make a serializer to convert my entire database into a json object and encrypt and export / import. You can see it in action here: http://wallet.ribbit.me/app

New accounts are disabled but if you do an import and fail to import, refresh the page and you will be logged in to a brand new account. Use the email/password you started with to "unlock it"

You can take a look at the database stuff by typing me.data into the console.

Always focus the webview on tab select

When a tab is made active, its webview should immediately receive focus. This will cause keyboard shortcuts in the webview to work, without having to click within the webview first.

Bookmark updates

Bookmarks in the start-page should:

  • render favicons
  • have editable titles and urls

Where's the discussion for keybase?

The README says:

keybase (discussion)

But links to a non-discussion. Was that meant to be an issue or a gist?

Also, my two cents: can't seriously call this "decentralization tech" if you're relying on a centralized service for your identity.

Various issues with Keybase:

  • It's centralized, and there's no need for it to be
  • Verification is very slow
  • There are plenty of far better choices, including DPKI-type solutions and CONIKS

firefox sync

Maybe integrate firefox sync (bookmarks, passwords, history, ...)? That would be massive in terms of enabling users to switch seamlessly back and forth.

ZeroNet integration

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
http://zeronet.io

I particularly like it because it has a clever JavaScript layer to allow you to build sites with data storage that give the impression of centralised hosting, but in fact store all the backend data in the same P2P manner as the site HTML.

I've opened a ticket over there too: HelloZeroNet/ZeroNet#530

Tab updates

Browsing tabs should support:

  • reordering
  • animations
  • pinning
  • ctrl+tab keyboard shortcut

IPNS integration

Maybe I am missing something, or doing it wrong, but IPNS integration does not work (yet?). For instance, an URL like: ipfs://ipns/dist.ipfs.io

IPFS integration

Hi @pfraze, it was great to chat at the #DWebSummit and getting to know about beaker.

Opening this issue so that we can continue our convo about IPFS integration and also invite other people in the community that might want to participate :)

Since beaker is an electron app, we can integrate either go-ipfs or js-ipfs, which in the short term, will give beaker's IPFS integration different properties, namely:

  • Peer Routing + Content Routing (DHT) with go-ipfs
  • WebRTC with js-ipfs.

Either way, we are standardizing the js-ipfs-api (HTTP-API client library) and js-ipfs core APi to expose the same calls, so that devs don't have to change any code when using a remote daemon or a in process daemon.

I still need to look into beaker code to get familiar with it, but meanwhile if you can give some lights on the integration should be done, it would be great.

Meanwhile, here is a short list of things that we will be doing in our side:

Garbage collector for P2P Network caches (Dat, IPFS)

The P2P Networks maintain a folder of downloaded sites. Some of these need to be kept (eg they are created by the local user, or they've been bookmarked). The rest need to be deleted after some period. A background process should regularly clean old items from the local cache.

Hostless applications, using the dat:// protocol

Overview

Sites can be served in Beaker using dat://. Some facts about the protocol:

  • Beaker supports DNS lookup for dat links. So, you can have dat://{dns_name} or dat://{hash}.
  • On load, if there is an index.html in the dat archive, it will be displayed.
  • The URL scheme will support versions: dat://{hash_or_name}/{path}@{version}#{...}
    • Example: dat://pauls-js.com/[email protected]
    • 3 kinds of version tags:
      • The change version, which is hyperdrive's internal version counter. That looks like @c{num}.
      • The hash of a version, which looks like @{hash}
      • A semver, which looks like @{maj}.{min}.{patch}.

dat:// will be a "hostless app protocol" for Beaker. Hostless apps will work differently than hosted apps, and get more privileges. Only hostless apps will get access to the client-side protocols which Beaker is adding.

The intent of hostless apps

Hostless apps are self-contained programs. Their assets are served by peer-to-peer networks, instead of by hosts, and they are integrity- and signature-checked for security. User data is stored on-device, by default, and confidential information should be encrypted end-to-end. Ideally, any point-to-point communication should occur between devices, without servers. Services, however, may be used with permission.

Security basics

The dat URL has an authority tuple of ["dat:", hash]. The policies and sandboxes will be applied to that authority. If the dat is loaded with a DNS name, the name will be resolved to a hash prior to setting policies.

Hostless apps are expected to handle secrets and privileged resources. They will be served with strict CSPs to prevent injections. A hostless app has to ask permission for new Beaker APIs and for the network; by default, an app can only access sandboxed JS APIs, and the assets within its own archive.

App updates

By default, updates to the dat will be automatically installed. The user can view the version history, and choose to revert to a past version. The user can also choose to be prompted before running updates.

New APIs

Hostless apps should be self-sufficient, and capable of (almost) anything an electron-based desktop app can do. They wont be able to bundle native modules, so Beaker will need to provide their platform of APIs.

Beaker's first 5 APIs will be:

  • sqlite3
  • fs
  • libsodium
  • secret/key storage
  • dat

These 5 will handle data-modeling, data-storage, p2p data-publishing, and all basic cryptography. In the future, we'll explore integrating APIs for an identity system, payments, async push-messaging, and async push-mail.

TODOs and open questions

App update events

Should there be a JS API for the application to handle upgrades and downgrades to the application? For instance, suppose the user moves from 2.0.0 to 3.0.0 -- or 3.0.0 to 2.0.0. There may be data schemas to change. And, if handled poorly, there could be data loss. Applications may benefit from builtin migration events, to handle this.

User data control

The dat apps will create files, SQLite databases, dat archives, and other artifacts, which the user may want to export and share within other contexts. How should we handle this? Should the browser/apps have a toolset for users to configure the paths of an app?

FS api

The node community has had a lot of time to consider how a browser-based fs api should work. What are those thoughts now?

DNS changes

If the dat app is loaded via a DNS name, and the registered hash is changed, how should Beaker react to this? Should it alert the user, that a wholly new app has been put there? How can the user get back to their old app?

cc @mafintosh @maxogden @Karissa

secure urls - poor man's ipfs

I've recently been working on this thing https://github.com/dominictarr/web-bootloader

Which uses an idea called a secure url. A secure url is just a url with a base64 encoded hash in it.
it just detects {base64}.sha256. This is similar to https://en.wikipedia.org/wiki/Subresource_Integrity except subresource integrity only applies to scripts and stylesheets. ๐Ÿ˜ข so you can't use to to have secure XHR for example.

You could also do {alg}-{base64} like in SRI, or enforce that the hash is at the end of the url (right before the ?)

content-addressed data means you have caching that is easy to reason about (finally). If you already have an object with that hash, just don't do the request.

The best part is that it's dead easy to implement.
you can implement a content addressable store in 100 lines in any language.

This makes it very good for bootstrapping other protocols, etc.

what do you think about having first class support for secure urls in beaker?

securing RPC access

currently the way several decentralized systems (ethereum, ipfs) work with browser is to expose an RPC that is running locally. The problem with this a currently implemented is that any page could access those RPCs and do malicious things (ex. a page could access ipfs's rpc and pin)

I don't know the best way to secure this. But it would be nice to have some way to selectively expose RPCs to the pages.

view-dat:// updates

The view-dat:// UI should:

  • use the archive's dns name, if available
  • show item sizes
  • render README.md ?

Add adblocker

Thanks to @mixmix we now have the core of an adblocker. Here's what's still todo:

  • Filter requests by a blocklist
  • Do in-page DOM filtering
  • Provide a UI for enabling/disabling it
  • Move the blocklist into the repo so we can keep it up-to-date (currently we're using https://github.com/Jense5/is-ad)

Files API, persistent background scripts, exposing lowlevel apis (quick project update)

Last week added a Files API for Dat and IPFS apps. Documentation is available here. Tests will be written this week, as well as the browsing history and URL-bar autocomplete.

Beaker will have an API for installing persistent background scripts. A section of the start screen will show active and halted BGs. The BGs will provide services, via IPC, to applications.

More lowlevel application APIs will be added, with appropriate permission schemes. This will include node's net module, parts of libsodium, Sqlite, Dat, IPFS, possibly node's DNS, and possibly node's UDP.

The userland BG scripts and lowlevel APIs will give more freedom to userland to extend the platform. All new APIs, including the BG scripts, will be restricted to Dat and IPFS apps.

Add ServiceWorker support to plugin protocols

Service Workers will allow unhosted applications in plugin-protocols to serve pages dynamically. To support them, we need:

  • A mechanism for plugin protocols to register support for Service Workers (this is disabled by default)
  • A way to inject Web APIs into Service Workers. It's currently not possible, AFAIK, to inject custom APIs into iframes or workers using Electron.

Ethereum Intergration

It would be nice to have ethereum integration.

Ethereum "Dapps" use web3 which just talk to the JSON RPC.

When talking to certain RPC endpoint the user should be notified with a pop approve or disapprove the communication

And that's pretty much it. After wallets and dapps should be able to run in beaker.

Update Dat & IPFS protocol handlers to set CSPs

The CSPs should disable any unsafe-* policies, and restrict requests to the current archive's origin.

Currently, the protocols are handled using Electron's registerBufferProtocol. Because registerBufferProtocol cant set the response headers, this change will require a change to registerHttpProtocol, and an internal HTTP server.

The HTTP server will be given a random port. To make sure no other process can access it, a nonce will be used in the requests.

  • dat://
  • view-dat://
  • ipfs:/

Add quotas to application folders

Currently, applications can write freely to the Application Folder, using beaker.fs. This should be modified to a default limit (100mb?), which can be increased or decreased by the user.

Binary download on IPFS/IPNS?

Would it be nice to be able to fetch the beaker binary from fetch it from IPFS (or DAT, but I'm unfamiliar with it), next to the S3 option, utilising the automatic integrity checks?

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.