cacao 0.3.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new43

Cacao (CORS Access-Control-Allow-Origin) Proxy

Cacao is a localhost Cross-Origin (CORS) proxy. It allows Javascript running in a web browser to access a remote HTTP resource without cross-origin restrictions. It runs on several different platforms, and essentially works by adding a Access-Control-Allow-Origin: * header to an HTTP response.

IP Camera Streaming

The main use case is to access a remote streaming MJPEG URL published by an IP Camera, via an <img> tag pointing to Cacao. Without Cacao, this image data is usually marked as cross-origin, and therefore cannot be used as the source for a WebRTC stream.

With Cacao, an <img crossorigin> can be copied to a <canvas> and then (since CORS is allowed) sent by the browser via WebRTC. Try loading the (MJPEG sample)[static/mjpeg.html] in your browser to experiment with this capability, and to understand the vanilla Javascript source code.

The Mediasoup Broadcast Example will eventually add support for using Cacao to request media to stream.

Usage

Cacao Proxy

Cacao can be run as a localhost proxy server on Linux (and other Unix-like), MacOS, and Windows.

Download a binary package from the Cacao releases, if you just want to use the proxy (and not change its code).

If you are a developer, you can run Cacao directly from sources in this project, but you will first need to install the Dart SDK:

$ dart --version
$ bin/cacao --help

Cacao Proxy App

See the Cacao Proxy App for a graphical app for controlling a builtin Cacao proxy on your mobile device.

Michael FIG michael+cacao@fig.org, 2018-12-05

0.3.1

  • Fix HTTP proxy connection leak.
  • Improve file proxy error messages.
  • Get mjpeg.html working on Firefox and Chrome without relying on nonstandard behaviour.

0.3.0

  • Crib pub run grinder package from dart-sass.
  • Clean up serve API in preparation for UI development.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  cacao: ^0.3.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:cacao/cacao.dart';
  
Version Uploaded Documentation Archive
0.3.1 Dec 7, 2018 Go to the documentation of cacao 0.3.1 Download cacao 0.3.1 archive
0.3.0 Dec 7, 2018 Go to the documentation of cacao 0.3.0 Download cacao 0.3.0 archive
0.2.0 Dec 7, 2018 Go to the documentation of cacao 0.2.0 Download cacao 0.2.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
4
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

We analyzed this package on Dec 7, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:cacao/cacao.dart.

Health issues and suggestions

Document public APIs (-10 points)

8 out of 8 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format bin/cacao.dart.

Run dartfmt to format bin/cacao.dart.

Format lib/src/findUri.dart.

Run dartfmt to format lib/src/findUri.dart.

Format lib/src/io/serve.dart.

Run dartfmt to format lib/src/io/serve.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/io/serveFile.dart (Run dartfmt to format lib/src/io/serveFile.dart.)
  • lib/src/io/serveHttp.dart (Run dartfmt to format lib/src/io/serveHttp.dart.)
  • lib/src/resolve.dart (Run dartfmt to format lib/src/resolve.dart.)

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use cacao.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0-dev <3.0.0
args ^1.5.1 1.5.1
mime ^0.9.6+2 0.9.6+2
Dev dependencies
archive ^2.0.0
grinder ^0.8.0
http ^0.12.0
meta ^1.1.0
path ^1.6.0
pub_semver ^1.4.0
test ^1.0.0
yaml ^2.1.0