web_kbn upd

This commit is contained in:
Evgeny Sorokin 2024-04-03 05:22:52 +03:00
parent e6e728d89b
commit 9327c98e48
2 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import re
import inverterd import inverterd
import phonenumbers import phonenumbers
import time import time
import os.path
from io import StringIO from io import StringIO
from aiohttp import web from aiohttp import web
@ -441,9 +442,16 @@ async def cams(req: web.Request):
cams = cc.get_all_cam_names() cams = cc.get_all_cam_names()
mode = {'type': 'all'} mode = {'type': 'all'}
if req.headers.get('Host').endswith('.manor.id'):
hls_pfx = 'https://'+req.headers.get('Host')
hls_pfx += re.sub(r'/home/?$', '/ipcam/', os.path.dirname(req.headers.get('X-Real-URI')))
else:
hls_pfx = 'http://'+config.app_config['hls_local_host']+'/ipcam/'
js_config = { js_config = {
'host': config.app_config['hls_local_host'], 'pfx': hls_pfx,
'proto': 'http', # 'host': config.app_config['hls_local_host'],
# 'proto': 'http',
'cams': cams, 'cams': cams,
'hlsConfig': { 'hlsConfig': {
'opts': { 'opts': {

View File

@ -140,12 +140,11 @@ function indexInit() {
var Cameras = { var Cameras = {
hlsOptions: null, hlsOptions: null,
host: null, pfx: null,
proto: null,
hlsDebugVideoEvents: false, hlsDebugVideoEvents: false,
getUrl: function(name) { getUrl: function(name) {
return this.proto + '://' + this.host + '/ipcam/' + name + '/live.m3u8'; return this.pfx + '/live.m3u8';
}, },
setupHls: function(video, name, useHls) { setupHls: function(video, name, useHls) {
@ -201,8 +200,7 @@ var Cameras = {
}, },
init: function(opts) { init: function(opts) {
this.proto = opts.proto; this.pfx = opts.pfx;
this.host = opts.host;
this.hlsOptions = opts.hlsConfig; this.hlsOptions = opts.hlsConfig;
var useHls; var useHls;