Git Product home page Git Product logo

squirrel-server-go's Introduction

Squirrel Mac Server

The purpose of this project is to provide the server-side requirements of the Squirrel.Mac auto-update system. Note that this bears little-to-no relation to the Squirrel.Windows framework, which doesn't require an active server.

Squirrel.Mac is intended to be integrated with an application. It facilitates the process of checking for, downloading and installing updates.

Update Process

The flow goes something like this:

  • An application initializes Squirrel.Mac, gives it a url to hit to check for updates
  • Squirrel requests this url
    • If it gets a "204 No Content" response, it assumes no update is required and reports as much to the application
    • Any other response is parsed as JSON, and the "url" field is extracted
  • If an update is required, squirrel downloads the given URL, unzips it, and does various prepatatory steps
  • Squirrel notifies the application an update is available
  • The application presumably asks for user confirmation, then asks Squirrel to apply the update and then restart the application.

Existing Server

There is an existing Squirrel.Server, implemented in ruby. It wasn't sufficient for our case for the following reasons:

  • It's inflexible, and only supports hosting updates for a single application
  • It would require us to modify our deployment strategy to include restarting the server

This Project

This server is dead simple. It sends a 204 response as appropriate, but otherwise just proxies json files hosted elsewhere It expects two parameters:

  • url - the json url to request
  • version (optional) - the version of the installed application

The server performs the following steps:

  • Requests the url
  • Parses the response as json (handling the various error cases)
  • Extracts the version field from the json response (which is actually ignored by Squrrel.Mac)
  • Compares that against the version query parameter
    • If they match, send 204 No Content
    • If not, send the data along

The server makes to attempt to do any caching, since load should be fairly low.

Running

docker build -t squirrel-server-go .
docker run -d -p 3000:3000 squirrel-server-go

squirrel-server-go's People

Contributors

de-o avatar joshuawarner32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

Forkers

taktik de-o

squirrel-server-go's Issues

Not working for me because the response is text/plain instead of application/json

Hello,

I'm querying the server with something like:

http://127.0.0.1:3000/?version=0.1.0&url=http://echo.jsontest.com/version/0.2.0/url/blabla

Then result is:

# wget -S -qO- "http://127.0.0.1:3000/?version=0.1.0\&url=http://echo.jsontest.com/version/0.2.0/url/blabla"
  HTTP/1.1 200 OK
  Date: Wed, 25 Jan 2017 14:44:24 GMT
  Content-Length: 46
  Content-Type: text/plain; charset=utf-8
{
   "url": "blabla",
   "version": "0.2.0"
}

The Content-Type is wrong...

When I'm using this URL in my electron app with setFeedURL(), I receive an error

error during updating process: Update check failed. The server sent an invalid JSON response. Try again later.

I've tried to add

w.Header().Set("Content-Type", "application/json")

Without success

Regards


go 1.7

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.