question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update from mirror

See original GitHub issue
  • Version: electron-builder@17.3.0 electron-updater@1.16.0
  • Target: windows, mac

My users are mostly in China, where can’t establish a stable connection to GitHub releases. I have a mirror server of GitHub releases, and wants to give a option to select mirror or GitHub as update server for users. But I have noticed that setFeedURL method is deprecated. Is there any other ways to set a mirror server besides GitHub release?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
develarcommented, May 31, 2017

Deprecated as string url, but you can use setFeedURL (https://github.com/electron-userland/electron-builder/wiki/Auto-Update#module_electron-updater.AppUpdater+setFeedURL) to set configuration in runtime. And if url is string, it will be automatically converted into generic provider.

0reactions
puroceancommented, Jan 13, 2022

Hack for use ghproxy mirror to download

type Source = 'github.com' | 'ghproxy.com' | 'mirror.ghproxy.com'

const httpRequest = (Provider.prototype as any).httpRequest
;(Provider.prototype as any).httpRequest = function (url: URL, headers: Record<string, string>, ...args: any[]) {
  const source: Source = config.get('updater.source', 'github.com')

  if (source !== 'github.com') {
    headers['user-agent'] = 'curl/7.77.0'
    console.log('updater httpRequest', url.href)

    if (url.pathname.endsWith('.atom')) {
      url.host = 'github.com.cnpmjs.org'
      headers.accept = '*/*'
      headers['user-agent'] = 'curl/7.77.0'
      url.pathname = url.pathname.replace('/https://github.com', '')
    }
  }

  return httpRequest.call(this, url, headers, ...args)
}

const setFeedURL = autoUpdater.setFeedURL
autoUpdater.setFeedURL = async function (options: any) {
  setFeedURL.call(this, options)
  const source: Source = config.get('updater.source', 'github.com')
  const provider = await (this as any).clientPromise
  Object.defineProperty(provider, 'baseUrl', {
    get () {
      return new URL(`https://${source}/`)
    }
  })
  Object.defineProperty(provider, 'basePath', {
    get () {
      const basePath = `/${this.options.owner}/${this.options.repo}/releases`

      if (source.includes('ghproxy')) {
        return `/https://github.com${basePath}`
      }

      return basePath
    },
  })
}


Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating from the Mirror | ESET Endpoint Security
The Mirror tool creates a structure of folders different from what Endpoint mirror does. Each folder holds update files for a group of...
Read more >
12 Ways to Update a Mirror - Home Decor - Pinterest
Jun 20, 2016 - Links to 12 fabulous mirror updates from several blogs. ... 12 ways to update a mirror, from some fabulous...
Read more >
Updating - Smart Mirror Documentation
Updating the mirror to get the latest updates is easy, just run: · This will sync the remote changes from whatever branch you...
Read more >
Mirrors - ArchWiki - Arch Linux
This page is a guide to selecting and configuring your mirrors, and a listing of current available mirrors.
Read more >
How to switch to a local update mirror in Linux Mint
If you use Linux Mint and notice that software updates take too long to download, you may live too far from the official...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found