npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

policyfile

v0.0.6

Published

Flash Socket Policy File Server. A server to respond to Flash Socket Policy requests, both inline and through a dedicated server instance.

Downloads

87,299

Readme

LOL, WUT?

It basically allows you to allow or disallow Flash Player sockets from accessing your site.

Installation

npm install policyfile

Usage

The server is based on the regular and know net and http server patterns. So it you can just listen for all the events that a net based server emits etc. But there is one extra event, the connect_failed event. This event is triggered when we are unable to listen on the supplied port number.

createServer

Creates a new server instance and accepts 2 optional arguments:

  • options Object Options to configure the server instance
    • log Boolean Enable logging to STDOUT and STDERR (defaults to true)
  • origins Array An Array of origins that are allowed by the server (defaults to :)
var pf = require('policyfile').createServer();

pf.listen();

server.listen

Start listening on the server and it takes 3 optional arguments

  • port Number On which port number should we listen? (defaults to 843, which is the first port number the FlashPlayer checks)
  • server Server A http server, if we are unable to accept requests or run the server we can also answer the policy requests inline over the supplied HTTP server.
  • callback Function A callback function that is called when listening to the server was successful.
var pf = require('policyfile').createServer();

pf.listen(1337, function(){
  console.log(':3 yay')
});

Changing port numbers can be handy if you do not want to run your server as root and have port 843 forward to a non root port number (aka a number above 1024).

var pf = require('policyfile').createServer()
  , http = require('http');

server = http.createServer(function(q,r){r.writeHead(200);r.end('hello world')});
server.listen(80);

pf.listen(1337, server, function(){
  console.log(':3 yay')
});

Support for serving inline requests over a existing HTTP connection as the FlashPlayer will first check port 843, but if it's unable to get a response there it will send a policy file request over port 80, which is usually your http server.

server.add

Adds more origins to the policy file you can add as many arguments as you like.

var pf = require('policyfile').createServer(['google.com:80']);

pf.listen();
pf.add('blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080'); // now has 3 origins

server.remove

Removes added origins from the policy file - you can add as many arguments as you like.

var pf = require('policyfile').createServer(['blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080']);

pf.listen();
pf.remove('blog.3rd-Eden.com:8080'); // only contains the :80 version now

server.close

Shuts down the server

var pf = require('policyfile').createServer();

pf.listen();
pf.close(); // OH NVM.

API

http://3rd-eden.com/FlashPolicyFileServer/

Examples

See https://github.com/3rd-Eden/FlashPolicyFileServer/tree/master/examples for examples

Licence

MIT see LICENSE file in the repository