mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
dynamic import
This commit is contained in:
parent
03946dd476
commit
5eb0d71cfd
1
Makefile
1
Makefile
@ -126,7 +126,6 @@ run: testenv $(TESTENV_GPIO)
|
|||||||
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
||||||
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
||||||
&& cp /usr/share/kvmd/configs.default/kvmd/web.css /etc/kvmd \
|
&& cp /usr/share/kvmd/configs.default/kvmd/web.css /etc/kvmd \
|
||||||
&& cp /usr/share/kvmd/web/share/js/kvm/janus.js /usr/share/janus/javascript/janus.js \
|
|
||||||
&& nginx -c /etc/kvmd/nginx/nginx.conf -g 'user http; error_log stderr;' \
|
&& nginx -c /etc/kvmd/nginx/nginx.conf -g 'user http; error_log stderr;' \
|
||||||
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
|
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
|
||||||
&& ln -s $(TESTENV_GPIO) /dev/kvmd-gpio \
|
&& ln -s $(TESTENV_GPIO) /dev/kvmd-gpio \
|
||||||
|
|||||||
@ -50,7 +50,8 @@ RUN pip install -r requirements.txt
|
|||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
RUN npm install htmlhint -g \
|
RUN npm install htmlhint -g \
|
||||||
&& npm install pug \
|
&& npm install pug \
|
||||||
&& npm install pug-cli -g
|
&& npm install pug-cli -g \
|
||||||
|
&& npm install @babel/eslint-parser -g
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
ARG LIBGPIOD_VERSION
|
ARG LIBGPIOD_VERSION
|
||||||
@ -75,7 +76,6 @@ RUN git clone https://github.com/pikvm/ustreamer \
|
|||||||
&& rm -rf ustreamer
|
&& rm -rf ustreamer
|
||||||
|
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
/usr/share/janus/javascript \
|
|
||||||
/etc/kvmd/{nginx,vnc} \
|
/etc/kvmd/{nginx,vnc} \
|
||||||
/var/lib/kvmd/msd/{images,meta} \
|
/var/lib/kvmd/msd/{images,meta} \
|
||||||
/opt/vc/bin \
|
/opt/vc/bin \
|
||||||
|
|||||||
@ -4,9 +4,12 @@ env:
|
|||||||
|
|
||||||
extends: "eslint:recommended"
|
extends: "eslint:recommended"
|
||||||
|
|
||||||
|
parser: "/usr/lib/node_modules/@babel/eslint-parser"
|
||||||
parserOptions:
|
parserOptions:
|
||||||
ecmaVersion: 6
|
ecmaVersion: 6
|
||||||
sourceType: module
|
sourceType: module
|
||||||
|
allowImportExportEverywhere: true
|
||||||
|
requireConfigFile: false
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
indent:
|
indent:
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
# #
|
|
||||||
# KVMD - The main Pi-KVM daemon. #
|
|
||||||
# #
|
|
||||||
# Copyright (C) 2018-2021 Maxim Devaev <mdevaev@gmail.com> #
|
|
||||||
# #
|
|
||||||
# This program is free software: you can redistribute it and/or modify #
|
|
||||||
# it under the terms of the GNU General Public License as published by #
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or #
|
|
||||||
# (at your option) any later version. #
|
|
||||||
# #
|
|
||||||
# This program is distributed in the hope that it will be useful, #
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
||||||
# GNU General Public License for more details. #
|
|
||||||
# #
|
|
||||||
# You should have received a copy of the GNU General Public License #
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
|
||||||
# #
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
export var Janus = null;
|
|
||||||
@ -25,10 +25,10 @@
|
|||||||
|
|
||||||
import {tools, $} from "../tools.js";
|
import {tools, $} from "../tools.js";
|
||||||
import {wm} from "../wm.js";
|
import {wm} from "../wm.js";
|
||||||
/*import {Janus} from "./janus.js";
|
var _Janus = null;
|
||||||
|
|
||||||
|
|
||||||
function _JanusStreamer(set_active_callback, set_inactive_callback, set_info_callback) {
|
/*function _JanusStreamer(set_active_callback, set_inactive_callback, set_info_callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var __janus = null;
|
var __janus = null;
|
||||||
@ -210,9 +210,27 @@ export function Streamer() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.setJanusEnabled = function(enabled) {
|
self.setJanusEnabled = function(enabled) {
|
||||||
__janus_enabled = (!!window.RTCPeerConnection && enabled);
|
let supported = !!window.RTCPeerConnection;
|
||||||
tools.info("Stream: Janus WebRTC Gateway state:", __janus_enabled);
|
let set_enabled = function() {
|
||||||
self.setState(__state);
|
__janus_enabled = (enabled && supported && _Janus !== null);
|
||||||
|
tools.info(`Stream: Janus WebRTC state: enabled=${enabled}, supported=${supported}, imported=${!!_Janus}`);
|
||||||
|
self.setState(__state);
|
||||||
|
};
|
||||||
|
if (enabled && supported) {
|
||||||
|
if (_Janus === null) {
|
||||||
|
import("./janus.js").then((module) => {
|
||||||
|
_Janus = module.Janus;
|
||||||
|
set_enabled();
|
||||||
|
}).catch((err) => {
|
||||||
|
tools.error("Can't import Janus module:", err);
|
||||||
|
set_enabled();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
set_enabled();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set_enabled();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setState = function(state) {
|
self.setState = function(state) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user