core: use npms cdn endpoint to avoid going through server.

This commit is contained in:
Koushik Dutta
2022-01-10 13:38:56 -08:00
parent fd9556bc8b
commit 84432db7f9
5 changed files with 12 additions and 19 deletions

View File

@@ -1,15 +1,3 @@
# Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.
# Scrypted Web UI Plugin
## npm commands
* npm run scrypted-webpack
* npm run scrypted-deploy <ipaddress>
* npm run scrypted-debug <ipaddress>
## scrypted distribution via npm
1. Ensure package.json is set up properly for publishing on npm.
2. npm publish
## Visual Studio Code configuration
* If using a remote server, edit [.vscode/settings.json](blob/master/.vscode/settings.json) to specify the IP Address of the Scrypted server.
* Launch Scrypted Debugger from the launch menu.
The Core Plugin provides the web UI for Scrypted.

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/core",
"version": "0.0.172",
"version": "0.0.174",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/core",
"version": "0.0.172",
"version": "0.0.174",
"license": "Apache-2.0",
"dependencies": {
"@koush/wrtc": "^0.5.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/core",
"version": "0.0.172",
"version": "0.0.174",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -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
}`
)

View File

@@ -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;