MCPcopy Index your code
hub / github.com/violentmonkey/violentmonkey / getScriptUpdateUrl

Function getScriptUpdateUrl

src/common/script.js:91–103  ·  view source on GitHub ↗
(script, { all, allowedOnly, enabledOnly } = {})

Source from the content-addressed store, hash-verified

89 * @return {string[] | string}
90 */
91export function getScriptUpdateUrl(script, { all, allowedOnly, enabledOnly } = {}) {
92 if ((!allowedOnly || script.config.shouldUpdate)
93 && (!enabledOnly || script.config.enabled)) {
94 const { custom, meta } = script;
95 /* URL in meta may be set to an invalid value to enforce disabling of the automatic updates
96 * e.g. GreasyFork sets it to `none` when the user installs an old version.
97 * We'll show such script as non-updatable. */
98 const downloadURL = tryUrl(custom.downloadURL || meta.downloadURL || custom.lastInstallURL);
99 const updateURL = tryUrl(custom.updateURL || meta.updateURL || downloadURL);
100 const url = downloadURL || updateURL;
101 if (url) return all ? [downloadURL, updateURL] : url;
102 }
103}

Callers 4

initScriptFunction · 0.90
parseScriptFunction · 0.90
vacuumFunction · 0.90
CheckUpdateFunction · 0.90

Calls 1

tryUrlFunction · 0.90

Tested by

no test coverage detected