{"id":20962994,"url":"https://github.com/doesdev/oneclick-update","last_synced_at":"2025-05-14T08:34:38.989Z","repository":{"id":57314605,"uuid":"169324201","full_name":"doesdev/oneclick-update","owner":"doesdev","description":"Simple installer downloads and update server","archived":false,"fork":false,"pushed_at":"2020-03-13T23:02:22.000Z","size":113,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T15:37:47.576Z","etag":null,"topics":["electron","installer","server","squirrel","update"],"latest_commit_sha":null,"homepage":"https://oneclick-update.doesdev.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doesdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-05T22:38:07.000Z","updated_at":"2021-06-15T05:25:09.000Z","dependencies_parsed_at":"2022-09-20T23:20:52.850Z","dependency_job_id":null,"html_url":"https://github.com/doesdev/oneclick-update","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Foneclick-update","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Foneclick-update/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Foneclick-update/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Foneclick-update/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doesdev","download_url":"https://codeload.github.com/doesdev/oneclick-update/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254105131,"owners_count":22015597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","installer","server","squirrel","update"],"created_at":"2024-11-19T02:39:47.255Z","updated_at":"2025-05-14T08:34:38.697Z","avatar_url":"https://github.com/doesdev.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"oneclick.png\" alt=\"SCRUD\" width=\"200\" /\u003e\n  \u003ch1\u003eOneclick Update\u003c/h1\u003e\n  \u003ca href=\"https://npmjs.org/package/oneclick-update\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/oneclick-update.svg\" alt=\"NPM version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/feross/standard\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat\" alt=\"js-standard-style\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n# oneclick-update\n\n\u003e Simple installer downloads and update server\n\n## What it does\n\nServes updates and installers following the common Squirrel + Electron pattern via Github releases.\n\nIn addition to the standard fare of these types of libraries it adds the ability to serve different release channels based on semver build metadata.\n\n`1.0.0+channelName` -\u003e `/download/channelName/win32`\n\nIt similarly handles prerelease channels, even prereleases on alternate channels.\n\n`2.0.0-1` -\u003e `/download/prerelease/win32`\n\n`2.0.0-1+channelName` -\u003e `/download/channelName/prerelease/win32`\n\n## Why use this over [hazel](https://github.com/zeit/hazel), [nuts](https://github.com/GitbookIO/nuts), etc...\n\nBoth nuts and hazel are excellent libraries. That being said, here are some of the reasons you might use this instead.\n\n- Private repos are a first class citizen, not an afterthought\n- It handles multiple builds of the same version (i.e. vendor specific builds)\n- It has separate prerelease channels, even vendor specific prerelease channels\n- It prioritizes `.dmg` or `.pkg` files for `download/darwin` route\n- It allows user defined platforms, for custom asset filtering\n- It's a singular standalone script\n- It has exactly 0 dependencies\n- It is actively maintained\n\n## Install\n\nJust running as a server, use any of these options to download the script. It's standalone.\n\n- [CLICK HERE](https://raw.githubusercontent.com/doesdev/oneclick-update/master/index.js) and save the script where you please\n- `curl -o oneclick.js https://raw.githubusercontent.com/doesdev/oneclick-update/master/index.js`\n\nIf you're using it as a module, you know the drill.\n\n`npm i -s oneclick-update`\n\n## Usage\n\nJust running as a server, couldn't be simpler.\n\n```sh\ncurl -o oneclick.js https://raw.githubusercontent.com/doesdev/oneclick-update/master/index.js\nSET GITHUB_REPO=doesdev/oneclick-release-test\nnode oneclick.js\n```\n\nUsing a private repo, also simple.\n```sh\ncurl -o oneclick.js https://raw.githubusercontent.com/doesdev/oneclick-update/master/index.js\ncurl -o secrets.json https://raw.githubusercontent.com/doesdev/oneclick-update/master/secrets.example.json\n# modify the secrets.json file with your Github oauth token, repo, port, and return URL\nnode oneclick.js\n```\n\n## Environment variables\n\n- `GITHUB_REPO` - Path to Github repo (i.e. `doesdev/oneclick-update`)\n- `GITHUB_OAUTH_TOKEN` - [Your Github oauth token](https://help.github.com/en/articles/git-automation-with-oauth-tokens)\n- `PORT` - The port you want to run the server on\n- `SERVER_URL` - The URL of the update server (for proxying private release assets)\n- `REFRESH_CACHE` - Interval to check for new releases as string or ms (default `15 mins`)\n- `LOG_DOWNLOADS` - Log downloads to console as `Download for [channel/platform/filename/extension]: [asset]`\n\n## Routes\n\nDetect platform via `user-agent` and download latest installer  \n`/download[/channel][/prerelease]`\n\nDownload latest installer for specified platform  \n`/download[/channel][/prerelease]/:platform`\n\nGet update JSON for specified version, if version matches latest returns no content  \n`/update[/channel][/prerelease]/:platform/:version`\n\nGet RELEASES file with `nupkg` download info (Windows only)  \n`/update[/channel][/prerelease]/win32/:version/RELEASES`\n\n## API\n\n```js\nconst { requestHandler, on } = require('oneclick-update')\nconst config = {\n  repo: 'doesdev/oneclick-release-test',\n  port: 8082,\n  token: 'yourGithubOauthToken',\n  serverUrl: 'https://updates.example.com',\n  refreshCache: '15 mins',\n  logDownloads: false,\n  platformFilters: { /* see Platforms below for details */ },\n  hostToChannel: {\n    /*\n      The `hostToChannel` option allows you to treat the hostname as a channel.\n      That means you can have `updates.example.com` handle the primary channel\n      and `updates.otherhost.com` handle the `otherhost` channel\n    */\n    'updates.otherhost.com': {\n      name: 'otherhost',\n      serverUrl: 'https://updates.otherhost.com'\n    }\n  }\n}\n\nconst startServer = async () =\u003e {\n  const handler = await requestHandler(config)\n  createServer(handler).listen(config.port, () =\u003e {\n    console.log(`Update server running on port ${config.port}`)\n  })\n}\n\non('download', ({ ip, requestUrl, asset, channel, platform, version }) =\u003e {\n  console.log(`User at ${ip} downloaded ${asset}`)\n})\n\nstartServer()\n```\n\n## Platforms\n\nNatively supports Windows, OSX and Linux.\n\nCurrently arch specification is not fully implemented. That being said you can create your own platform extensions that filter assets as you desire. The intent is to support arch specification natively, but in the interim it could be implemented something like this (assuming you've named Windows x64 assets with `win64` in the name).\n\n```js\nconst config = {\n  platformFilters: {\n    win64: (assets, action) =\u003e {\n      return assets.find((a) =\u003e a.name.indexOf('win64') !== -1)\n    }\n  }\n}\n```\n\nSimilarly you can define any custom platform filtering that you would like. The expectation is the key is what would be specified in the platform part of the URL and the value is a function that filters the assets to the one you would like to use.\n\nThe signature of the filtering function is `(assets, action, arch, extension)`\n\n- `assets: Array` - list of Github release assets, the `name` property of each is the filename\n- `action: String` - name of current action (`download` or `update`)\n- `arch: String` - this is not currently passed, once arch is implemented it will be\n- `extension: String` - if extension is specified via querystring, this is it (i.e. `?filetype=dmg` -\u003e `dmg`)\n\n## License\n\nMIT © [Andrew Carpenter](https://github.com/doesdev)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Foneclick-update","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoesdev%2Foneclick-update","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Foneclick-update/lists"}