GithubHelp home page GithubHelp logo

xuset / planktos Goto Github PK

View Code? Open in Web Editor NEW
530.0 13.0 27.0 3.92 MB

Serving websites over bittorrent

Home Page: https://xuset.github.io/planktos/

License: MIT License

JavaScript 97.73% HTML 1.33% Shell 0.93%
service-worker webtorrent bittorrent webrtc

planktos's People

Contributors

alvin319 avatar georgeaf99 avatar rigelk avatar xuset 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

planktos's Issues

Polish Up the Website

The website needs some tweaks to make it look a bit more legit.

Tweaks:

  • Fix favicon
  • Planktos logo should be in the top left
  • Add a contact us section
  • Remove unnecessary empty space between sections
  • Add Google analytics (make sure Planktos bugs are tracked)
  • Add a big "Download Planktos" link pointing to the GitHub page after the about section
  • Make text larger
  • Fix unreferenced google error

Concerns:

  • Not enough information is displayed on the initial page
  • Perhaps the about section could be formatted better (maybe tiles or something?)
  • The link to our GitHub should be available from anywhere in the website
  • Background image is not really relevant and takes up a large amount of space

Make lib independent of service worker

The lib shouldn't require the service worker in order to function.

  • The webpages should assign a downloader, not the service worker. (Use tab-elect or equivalent)
  • The downloader shouldn't use the service worker url to determine the webseed url

Reduce the number of http requests for an update

When update() is called, it makes 4 http requests which makes calling update() frequently infeasible. The files requested everytime update() is called:

  • planktos/root.torrent
  • planktos/manifest.json
  • planktos/install.js
  • planktos/planktos.min.js

It is better to only request planktos/root.torrent initially, and if the torrent is new then request the remaining files.

Add cool tags and stuff

We should have a Travis CI build tag, NPM tag, and maybe a donate button...

This should make us look like professionals!

Cleanup stale snapshots

Snapshots should automatically be cleanup when they are stale or the cleanup functionality should be exposed in the api.

Refreshing the SW on Page Reload Double Downloads

If the current SW gets a refresh page request, it initiates the download for the torrent. When the SW is bounced, the new SW re-issues the download request, because the state of which client was assigned the download is gone.

Improve downloader injection

The current way the downloader is injected into web pages leaves a lot to be desired. This issue is more of a tracking issue than one that provides a solution.

When a new page is opened, it must be able to download torrents by including the downloader code. This is currently accomplished by replacing the initial request with one of the injections found in ./lib/injection, the injection then makes a request for the actually requested content and displays it.

Some problems with this, iframes should not used form html pages, but there is no way to know definitively if the requested file is a html file (looking at the file extension only works if the extension is present). Using document.documentElement.innerHTML = text to replace the injectors html with the requested files html is a hack and can hopefully be improved. Ideally the improved injector would be less hacky, and be able to stream the requested content.

One potential improvement would be: if the requested file was html then edit the contents to include the downloader during planktos.fetch()

Bad torrent generated when only one file is in torrent

If only one file is passed to the planktos cli then a bad torrent is generated. The files section of the bad torrent is something like:

  "files": [
    {
      "path": "planktos",
      "name": "planktos",
      "length": <length>,
      "offset": 0
    }
  ]

When it should be:

  "files": [
    {
      "path": "planktos/<sha256 sum>",
      "name": "<sha256 sum>",
      "length": <length>,
      "offset": 0
    }
  ]

This discrepancy is likely releated to create-torrent treating the creation differently when it is a single or multi-file torrent

Necessary Steps for Releasing an MVP

What do we need to accomplish before we releasing an MVP?

  • Blocking auto-updates
  • Clean up old snapshots
  • Polish up website
  • Create a blog (which uses Planktos)
  • Write a blog post about integrating Planktos into an existing blog

An in-range update of run-parallel-limit is breaking the build 🚨

Version 1.0.5 of run-parallel-limit was just published.

Branch Build failing 🚨
Dependency run-parallel-limit
Current Version 1.0.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

run-parallel-limit is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 4 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Optimal Sharding Strategy for Larger Websites

Larger websites should be sharded into multiple torrents such that the files grouped in an individual torrent have high locality relative to each other. This makes it likely that a user visiting a specific portion of the website will need files from a torrent that has already been downloaded.

If we view the website as a graph, with files corresponding to nodes and links to edges, this optimization corresponds to finding the minimally connected subgraphs larger than some size.

Handle Base URL

When I was trying to integrate Planktos into our landing page I ran into a problem: the static files are relative to the root directory, but the actual website is relative to /planktos/. Planktos cannot handle websites like this, because it assumes that the service worker is going to be relative to the root directory.

An in-range update of mocha is breaking the build 🚨

Version 3.4.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.4.0

Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.

This week's highlights:

  • allowUncaught added to commandline as --allow-uncaught (and bugfixed)
  • warning-related Node flags

🎉 Enhancements

🐛 Fixes

🔩 Other

Commits

The new version differs by 9 commits0.

  • 7554b31 Add Changelog for v3.4.0
  • 9f7f7ed Add --trace-warnings flag
  • 92561c8 Add --no-warnings flag
  • ceee976 lint test/integration/fixtures/simple-reporter.js
  • dcfc094 Revert "use semistandard directly"
  • 93392dd no special case for macOS running Karma locally
  • 4d1d91d --allow-uncaught cli option
  • fb1e083 fix allowUncaught in browser
  • 4ed3fc5 Add license report and scan status

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Opera support

Opera should work with planktos out of the box since it has all the APIs planktos uses, but it may require a few changes to the code. Once Opera is passing the tests, it should be added the ci tests, and Opera support should be listed in the gh project pages.

Prioritize file downloads

Currently, each file is downloaded in the order it appears in the torrent. This can cause problems like large files being downloaded first before they're needed while the much needed index.html is the last file in the torrent and the last to be downloaded.

WebTorrent allows the priority of a given piece range to be changed such that pieces with a higher priority are downloaded before those with lower priority. So when a file is requested, a message should be sent to the web page that is downloading the torrent to instruct it to raise the priority of the requested file's pieces.

Add unit testing framework

As we start trying to accelerate development on the project, and potentially get interest from other people, it will be necessary to have the unit testing framework set up.

Use file mime type to set Content-Type and blob.type

Setting these values correctly helps the browser and possible end user detect what type of file is being read.

The ~~~service worker~~~ fetch() method should set the Content-Type header for responses that are for files in the torrent.

Also when blobs are created we should also construct the blob with the correct mime type.

The very helpful mime npm can do the mime type detection

Add live demo section to gh-pages

The landing page should be served over planktos if the browser supports it. Also a live demo section should be added that informs the viewer that the page was downloaded from peers.

Copy identical pieces from older snapshots to the newly updated snapshot

When an update is found a new snapshot is created, the snapshot is downloaded from scratch despite the high likely that older snapshots already contain some of the needed data. This should be fixed by iterating over old snapshots and seeing if the old and new snapshot have any pieces in common by comparing the piece's hash. If the pieces are identical then copy the piece from the old snapshot's chunk store to the new.

Change public interface

In previous discussions we have concluded that a simpler public interface would be beneficial and include the following methods:

  • constructor
  • update
  • fetch
  • getFile

The remaining public methods should be removed from the public interface.

At this point update() should also be modified to remove the old snapshots once the new snapshot is loaded in.

Related to #45

Add web stream support

Planktos should use WhatWG ReadableStreams in order to allow content to be streamed from IndexedDB and into the fetch event's respondWith. This will greatly speed up page load times and allow for video/audio streaming.

Reading from indexeddb-chunk-store with a nodejs stream while the file is not fully downloaded was added in #28 which is the bulk of the work.

What is needed for streaming is:

  • Convert nodejs streams to web streams
  • Use web streams when available for respondWith
  • Add support for byte range requests #6 (only needed for video and audio streaming)

An in-range update of create-torrent is breaking the build 🚨

Version 3.31.0 of create-torrent was just published.

Branch Build failing 🚨
Dependency create-torrent
Current Version 3.30.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

create-torrent is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 4 commits.

  • 9d401d3 3.31.0
  • 7007e36 Merge pull request #72 from webtorrent/greenkeeper/parse-torrent-6.0.0
  • 5dc1c71 chore(package): update parse-torrent to version 6.0.0
  • ef5d8c4 zuul -> airtap

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Use Planktos for the Landing Page

  • Integrate Planktos into the build process for the landing page
  • Ensure that Planktos errors are captured in analytics
  • Fix script fetching errors

Improve the ability to customize the service worker

The service worker should not contain the fetch() code or other lib related code. It should just contain the bare minimum while the bulk of the logic is contained within the lib.

To further improve the customization, the service worker should use importScripts instead of require. This allows the user to customize the sw without having to run a bundler like browserify. Doing this will drastically shrink the sw file to < 1kB so the minify is no longer necessary and can be removed from the build script.

Blocked by #35

Documentation for Planktos API

The public API is quite simple; however, it is not clear what our contracts to the user are.

For example:

  • getSnapshot not only gets the latest snapshot, but it also seeds the file if it wasn't being seeded before
  • getSnapshot can only be called after update
  • fetch and getFile have the same side effects and constraints as getSnapshot

Some of this may be a problem with our API; however, documentation is necessary regardless of whether or not these are issues.

Make the CLI more usable

The CLI currently does not conform to the expected user interface. Specific concerns:

  • Installing the library should be one command
  • Bundling files into a torrent should be a separate command

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Tag Editing

Previous Discussion in #53

Terminology: Intercept mechanism refers to the way in which a request is intercepted e.g. service worker or tag editing. Intercept handler refers to the piece of code which decides how an intercepted request should be handled.

To Do:

  • Add a folder for different implementations of intercept handlers (for right now it should only contain default.js)
  • Separate out the intercept handler from sw.js into default.js (service worker specific code should remain)
  • Replace the Planktos fetch interface with something that is agnostic to intercept mechanism (right now it accepts a FetchEvent)
  • Add a flag for selecting which intercept mechanisms to use
  • Add a build phase in the CLI that calls the tag editor
  • Inject the Planktos install script into every JS file during build phase
  • Create a standard for modifying resource tags (webtorrent/webtorrent#879 (comment))
  • Handle editing of all tags (<audio>, <base>, <iframe>, <img>, <link>, <object>, <picture>, <source>, <track>, <video>)

User Feedback

Website:

  • It was unclear that active users of the website were seeders (question asked: why is this better than serving your website with S3)
  • A reader wanted an example
  • Need to clarify how it actually works
  • Tagline should not use the word "seeders"

Scratch Notes:

It seems that we need to ground the readers of the website a bit better. We will have to pitch both WebTorrent and Planktos.

Future Ideas

A place to keep thoughts and track our plans for Planktos.

Add custom tracker flag to CLI

The CLI should have a flag that allows the user to specify a custom tracker.

Passing the array/string that minimist generates into the opts for create-torrent will accomplish this.

As a side note, if a boolean false is passed into this option then create-torrent includes no trackers in the torrent meta. This is useful when testing so we are not bombarding trackers with our announces every time we run a test. The tests don't use trackers so there really isn't a point in announcing to them.

Website Tweaks

Pressing:

  • Use Planktos
  • Fix Planktos

Content:

  • Remove the word "seeders"
  • Explain different use cases
  • Make the website sound less anti-user
  • Put more content on the main page

Experience:

  • Put an icon selector tab in the about section
  • Animate the down arrow

Support RANGE header

If the intercepted http request has the RANGE header we should only return the bytes in the specified range as well as any associated response headers. The main reason to support this is video and audio seeking; with each seek the browser sends a new request for the selected range.

onFetch in sw.js will have to be modified and it will probably be a good idea to modify getFileBlob in index.js to support specifying the start and end bytes.

Properly handle implied index file names

Currently, a request for GET / will be treated the same way as GET /index.html. The problem is that this only works for the root directory e.g. GET /a/ will not be treated as the same as GET /a/index.html. This needs to be fixed so it works for all directories. My guess for the best place to add the necessary code would be in somewhere index.js:getFileBlob()

Research the Tag Editing Approach

Using the service worker to intercept HTTP requests has many benefits; however, for our initial use case, blogs and small websites, it is not as well suited as modifying resources in the HTML. Thus, we need to investigate tag editing and decide on an approach that allows us serve this initial use case and scale to more complex use cases as well.

Benefits of Service Worker:

  • Intercepts all network requests
  • Better API
  • Doesn't require manipulating user code
  • Works even if the web server is down (for static websites)
  • Loads the index page over HTML after the SW is installed
  • Early in the adoption curve

Benefits of Tag Editing:

  • Initial website load can be done over WebTorrent (except for index file)
  • Videos can be streamed in browsers other than Chrome
  • Doesn't require including a script in the index file

It should be noted that these approaches are not mutually exclusive; I think it makes sense to enable the service worker and build-time tag editing by default. However, the code for both of these systems are completely unrelated, so they should be separated into different repositories.

An in-range update of mocha is breaking the build 🚨

Version 3.3.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.2.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details - ❌ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/xuset/planktos/builds/225144308)

Release Notes coverave

Thanks to all our contributors, maintainers, sponsors, and users! ❤️

As highlights:

  • We've got coverage now!
  • Testing is looking less flaky \o/.
  • No more nitpicking about "mocha.js" build on PRs.

🎉 Enhancements

  • #2659: Adds support for loading reporter from an absolute or relative path (@sul4bh)
  • #2769: Support --inspect-brk on command-line (@igwejk)

🐛 Fixes

  • #2662: Replace unicode chars w/ hex codes in HTML reporter (@rotemdan)

🔍 Coverage

🔩 Other

Commits

The new version differs by 89 commits0.

  • fb1687e :ship: Release v3.3.0
  • 1943e02 Add Changelog for v3.3.0
  • 861e968 Refactor literal play-icon hex code to a var
  • 1d3c5bc Fix typo in karma.conf.js
  • 9bd9389 Fix spec paths in test HTML files
  • 0a93024 Adds tests for loading reporters w/ relative/absolute paths (#2773)
  • 73929ad Comment special treatment of '+' in URL query parsing
  • e2c9514 Merge pull request #2769 from igwejk/support_inspect_break_in_opts
  • 038c636 Support --inspect-brk on command-line
  • b4ebabd Merge pull request #2727 from lamby/reproducible-build
  • 882347b Please make the build reproducible.
  • a2fc76c Merge pull request #2703 from seppevs/cover_utils_some_fn_with_tests
  • ed61cd0 cover .some() function in utils.js with tests
  • f42cbf4 Merge pull request #2701 from craigtaub/landingSpec
  • 6065242 use stubbed symbol

There are 89 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Minify the bundled js

Integrate uglify-js into the build process. If the inline source maps that browserify generates cannot be included in the minified js then it is probably best to have two build processes, one for production and the other for debug.

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.