function getScriptUpdateUrl(script, { all, allowedOnly, enabledOnly } = {}) {
  if ((!allowedOnly || script.config.shouldUpdate)
  && (!enabledOnly || script.config.enabled)) {
    const { custom, meta } = script;
    /* URL in meta may be set to an invalid value to enforce disabling of the automatic updates
     * e.g. GreasyFork sets it to `none` when the user installs an old version.
     * We'll show such script as non-updatable. */
    const downloadURL = tryUrl(custom.downloadURL || meta.downloadURL || custom.lastInstallURL);
    const updateURL = tryUrl(custom.updateURL || meta.updateURL || downloadURL);
    const url = downloadURL || updateURL;
    if (url) return all ? [downloadURL, updateURL] : url;
  }
}
@param {VMScript} script
@param {Object} [opts]
@param {boolean} [opts.all] - to return all two urls [checkUrl, downloadUrl]
@param {boolean} [opts.allowedOnly] - check shouldUpdate
@param {boolean} [opts.enabledOnly]
@return {string[] | string}