Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active August 30, 2017 08:03
Show Gist options
  • Save gbraad/927860c0c7be21df14de to your computer and use it in GitHub Desktop.
Save gbraad/927860c0c7be21df14de to your computer and use it in GitHub Desktop.
Fling website to MatchStick or flingd

Fling website to MatchStick or flingd

#!/usr/bin/env coffee
request = require "request"
HOST = process.argv[3] || "localhost"
URL = "http://" + HOST + ":9431/apps/"
APP_ID = "~browser"
APP_URL = URL + APP_ID
OPEN_URL = process.argv[2] || "http://gbraad.nl"
cmd =
type: "launch"
app_info:
url: OPEN_URL,
useIpc: false,
maxInactive: 0
option =
url: APP_URL
method: "POST"
json: cmd
request option, (error, response, body) =>
console.log "POST #{APP_URL}"
if error?
console.log "error!!! #{error}"
else
console.log body
#!/usr/bin/env node
var request = require("request");
var HOST = process.argv[3] || "localhost";
var URL = "http://" + HOST + ":9431/apps/";
var APP_ID = "~browser";
var APP_URL = URL + APP_ID;
var OPEN_URL = process.argv[2] || "http://gbraad.nl";
var cmd = {
type: "launch",
app_info: {
url: OPEN_URL,
useIpc: false,
maxInactive: 0
}
};
var option = {
url: APP_URL,
method: "POST",
json: cmd
};
request(option, function(error, response, body) {
console.log("POST " + APP_URL)
if(error)
console.log("error!!! " + error)
else
console.log(body)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment