mirror of
https://github.com/koush/scrypted.git
synced 2026-03-18 07:42:13 +00:00
core: use npms cdn endpoint to avoid going through server.
This commit is contained in:
@@ -100,7 +100,7 @@ export default {
|
||||
doSearch: debounce(function () {
|
||||
axios
|
||||
.get(
|
||||
`${getComponentWebPath("script")}/search?text=keywords:scrypted+${
|
||||
`https://registry.npmjs.org/-/v1/search?text=keywords:scrypted+${
|
||||
this.search
|
||||
}`
|
||||
)
|
||||
|
||||
@@ -10,7 +10,12 @@ export interface PluginUpdateCheck {
|
||||
}
|
||||
|
||||
export async function checkUpdate(npmPackage: string, npmPackageVersion: string): Promise<PluginUpdateCheck> {
|
||||
const response = await axios.get(`${componentPath}/npm/${npmPackage}`);
|
||||
// const response = await axios.get(`${componentPath}/npm/${npmPackage}`);
|
||||
// registry.npmjs.org does not support CORS on the package endpoints.
|
||||
// open issue:
|
||||
// https://github.com/npm/feedback/discussions/117
|
||||
// npmjs.cf is an unofficial CDN that provides it
|
||||
const response = await axios.get(`https://registry.npmjs.cf/${npmPackage}`);
|
||||
const { data } = response;
|
||||
const versions = Object.values(data.versions).sort((a: any, b: any) => semver.compare(a.version, b.version)).reverse();
|
||||
let updateAvailable: any;
|
||||
|
||||
Reference in New Issue
Block a user