• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sammacbeth/dat-fox: dat:// protocol as a Firefox webextension

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

sammacbeth/dat-fox

开源软件地址:

https://github.com/sammacbeth/dat-fox

开源编程语言:

JavaScript 83.6%

开源软件介绍:

Dat-Firefox

This is a prototype browser extension which makes dat:// urls function in Firefox using a slightly modified dat-gateway as a bridge to the dat network.

It aims to implement native-like dat support possible in Firefox. This means:

  1. Links to dat:// addresses and sites should work directly. While Webextensions protocol handlers are limited - we cannot show dat:// in the address bar on a loaded page - we can at least properly process the initial URL or link.
  2. Dat site operate on the correct origin. When using the dat-gateway to bridge to the dat network, all dat addresses look like http://localhost:3000/{hash}/path. This has the effect of potentially breaking relative URLs on the page, and also preventing the web's cross-origin policies from preventing data leakage between sites. To fix this we have to make {hash} the origin.

Usage

  1. Install dat-fox-helper

  2. Install the extension from the Mozilla Addon Store

  3. Visit a dat:// URL.

Local development

You can also build and run the extension locally. You will need a version of node greather that 7. nvm is recommended for installing node.

git clone https://github.com/sammacbeth/dat-fox.git
cd dat-fox
# install build dependencies
npm install
# build
npm run build
# if you want to watch for file changes
npm run serve

You can now load the addon folder as a temporary addon in Firefox:

  1. Go to about:debugging in Firefox.
  2. Chose Load Temporary Addon.
  3. Browser to the addon folder and chose any file in this folder.

What works

  • Load content from dat archives with the following URL types:
    • dat://{hash}
    • http://{hash}
    • dat://{hostname} (using Dat Discovery)
  • Toggle between https to dat protocol for Dat-enabled sites.
  • Create and fork archives.
  • DatArchive API

How it works

  1. The protocol handler redirects dat:// urls to a special handler domain (dat.redirect), passing the full url.
  2. A webRequest listener intercepts requests to this domain and redirects to a http:// URL with the dat key or hostname as the origin.
  3. A proxy PAC file intercepts hostnames matching a dat key pattern, or hostnames the user has explicitly ask to load over dat. Requests for these URLs are proxied via the dat-gateway (acting as a HTTP proxy). This allows us to make 'fake' hostnames work, and create the origins we need for dat sites.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap