mirror of
https://github.com/koush/scrypted.git
synced 2026-09-21 19:20:40 +01:00
Merge branch 'main' of github.com:koush/scrypted
This commit is contained in:
30
plugins/core/package-lock.json
generated
30
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.138",
|
||||
"version": "0.1.139",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.138",
|
||||
"version": "0.1.139",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
@@ -87,34 +87,35 @@
|
||||
},
|
||||
"../../sdk": {
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.2.21",
|
||||
"version": "0.2.103",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.16.7",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"adm-zip": "^0.4.13",
|
||||
"axios": "^0.21.4",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-loader": "^9.1.0",
|
||||
"babel-plugin-const-enum": "^1.1.0",
|
||||
"esbuild": "^0.15.9",
|
||||
"ncp": "^2.0.0",
|
||||
"raw-loader": "^4.0.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"tmp": "^0.2.1",
|
||||
"typescript": "^4.9.3",
|
||||
"webpack": "^5.74.0",
|
||||
"ts-loader": "^9.4.2",
|
||||
"typescript": "^4.9.4",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-bundle-analyzer": "^4.5.0"
|
||||
},
|
||||
"bin": {
|
||||
"scrypted-changelog": "bin/scrypted-changelog.js",
|
||||
"scrypted-debug": "bin/scrypted-debug.js",
|
||||
"scrypted-deploy": "bin/scrypted-deploy.js",
|
||||
"scrypted-deploy-debug": "bin/scrypted-deploy-debug.js",
|
||||
"scrypted-package-json": "bin/scrypted-package-json.js",
|
||||
"scrypted-readme": "bin/scrypted-readme.js",
|
||||
"scrypted-setup-project": "bin/scrypted-setup-project.js",
|
||||
"scrypted-webpack": "bin/scrypted-webpack.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.11.9",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/stringify-object": "^4.0.0",
|
||||
"stringify-object": "^3.3.0",
|
||||
"ts-node": "^10.4.0",
|
||||
@@ -249,12 +250,12 @@
|
||||
"@scrypted/sdk": {
|
||||
"version": "file:../../sdk",
|
||||
"requires": {
|
||||
"@babel/preset-typescript": "^7.16.7",
|
||||
"@types/node": "^18.11.9",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/stringify-object": "^4.0.0",
|
||||
"adm-zip": "^0.4.13",
|
||||
"axios": "^0.21.4",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-loader": "^9.1.0",
|
||||
"babel-plugin-const-enum": "^1.1.0",
|
||||
"esbuild": "^0.15.9",
|
||||
"ncp": "^2.0.0",
|
||||
@@ -262,10 +263,11 @@
|
||||
"rimraf": "^3.0.2",
|
||||
"stringify-object": "^3.3.0",
|
||||
"tmp": "^0.2.1",
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.4.0",
|
||||
"typedoc": "^0.23.21",
|
||||
"typescript": "^4.9.3",
|
||||
"webpack": "^5.74.0",
|
||||
"typescript": "^4.9.4",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-bundle-analyzer": "^4.5.0"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.138",
|
||||
"version": "0.1.139",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<script>
|
||||
import { getComponentViewPath } from "./helpers";
|
||||
import { checkUpdate } from "./plugin/plugin";
|
||||
import { checkServerUpdate } from "./plugin/plugin";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -160,11 +160,9 @@ export default {
|
||||
// in which case fall back and determine what the install type is.
|
||||
const info = await this.$scrypted.systemManager.getComponent("info");
|
||||
const version = await info.getVersion();
|
||||
const scryptedEnv = await info.getScryptedEnv();
|
||||
this.currentVersion = version;
|
||||
const { updateAvailable } = await checkUpdate(
|
||||
"@scrypted/server",
|
||||
version
|
||||
);
|
||||
const { updateAvailable } = await checkServerUpdate(version, scryptedEnv.SCRYPTED_INSTALL_ENVIRONMENT);
|
||||
this.updateAvailable = updateAvailable;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
</v-layout>
|
||||
</template>
|
||||
<script>
|
||||
import { checkUpdate } from "../plugin/plugin";
|
||||
import { checkServerUpdate } from "../plugin/plugin";
|
||||
import Settings from "../../interfaces/Settings.vue"
|
||||
import {createSystemSettingsDevice} from './system-settings';
|
||||
|
||||
@@ -140,10 +140,8 @@ export default {
|
||||
catch (e) {
|
||||
// old scrypted servers dont support this call, or it may be unimplemented
|
||||
// in which case fall back and determine what the install type is.
|
||||
const { updateAvailable } = await checkUpdate(
|
||||
"@scrypted/server",
|
||||
version
|
||||
);
|
||||
const scryptedEnv = await info.getScryptedEnv();
|
||||
const { updateAvailable } = await checkServerUpdate(version, scryptedEnv.SCRYPTED_INSTALL_ENVIRONMENT);
|
||||
this.updateAvailable = updateAvailable;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ const pluginSnapshot = require("!!raw-loader!./plugin-snapshot.ts").default.spli
|
||||
|
||||
export interface PluginUpdateCheck {
|
||||
updateAvailable?: string;
|
||||
updatePublished?: Date;
|
||||
versions: any;
|
||||
}
|
||||
|
||||
@@ -29,11 +30,17 @@ export async function checkUpdate(npmPackage: string, npmPackageVersion: string)
|
||||
const { data } = response;
|
||||
const versions = Object.values(data.versions).sort((a: any, b: any) => semver.compare(a.version, b.version)).reverse();
|
||||
let updateAvailable: any;
|
||||
let updatePublished: any;
|
||||
let latest: any;
|
||||
if (data["dist-tags"]) {
|
||||
latest = data["dist-tags"].latest;
|
||||
if (npmPackageVersion && semver.gt(latest, npmPackageVersion)) {
|
||||
updateAvailable = latest;
|
||||
try {
|
||||
updatePublished = new Date(data["time"][latest]);
|
||||
} catch {
|
||||
updatePublished = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const [k, v] of Object.entries(data['dist-tags'])) {
|
||||
@@ -54,10 +61,36 @@ export async function checkUpdate(npmPackage: string, npmPackageVersion: string)
|
||||
}
|
||||
return {
|
||||
updateAvailable,
|
||||
updatePublished,
|
||||
versions,
|
||||
};
|
||||
}
|
||||
|
||||
export async function checkServerUpdate(version: string, installEnvironment: string): Promise<PluginUpdateCheck> {
|
||||
const { updateAvailable, updatePublished, versions } = await checkUpdate(
|
||||
"@scrypted/server",
|
||||
version
|
||||
);
|
||||
|
||||
if (installEnvironment == "docker" && updatePublished) {
|
||||
console.log(`New scrypted server version published ${updatePublished}`);
|
||||
|
||||
// check if there is a new docker image available, using 'latest' tag
|
||||
// this is done so newer server versions in npm are not immediately
|
||||
// displayed until a docker image has been published
|
||||
let response: AxiosResponse<any> = await axios.get("https://corsproxy.io?https://hub.docker.com/v2/namespaces/koush/repositories/scrypted/tags/latest");
|
||||
const { data } = response;
|
||||
const imagePublished = new Date(data.last_updated);
|
||||
console.log(`Latest docker image published ${imagePublished}`);
|
||||
|
||||
if (imagePublished < updatePublished) {
|
||||
// docker image is not yet published
|
||||
return { updateAvailable: null, updatePublished: null, versions: null }
|
||||
}
|
||||
}
|
||||
return { updateAvailable, updatePublished, versions };
|
||||
}
|
||||
|
||||
export async function installNpm(systemManager: SystemManager, npmPackage: string, version?: string): Promise<string> {
|
||||
const plugins = await systemManager.getComponent('plugins');
|
||||
await plugins.installNpm(npmPackage, version);
|
||||
|
||||
Reference in New Issue
Block a user