fix local IP

This commit is contained in:
Ivan 2023-11-08 12:10:37 +03:00
parent bbce9452d5
commit 69f324ce5f
Signed by untrusted user who does not match committer: ppechenkoo
GPG Key ID: 0C191B86D9582583
5 changed files with 35 additions and 35 deletions

View File

@ -120,7 +120,7 @@ app.post("/videos/restart", async (req, res) => {
var options = { var options = {
method: "GET", method: "GET",
url: `http://${process.env.VIRTUAL_HOST}/http/restart`, url: `http://${process.env.VIRTUAL_HOST}:4747/http/restart`,
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
data: { video: true }, data: { video: true },
}; };
@ -2753,7 +2753,7 @@ app.post("/update-group", async (req, res) => {
async function getParameters(serial) { async function getParameters(serial) {
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2767,7 +2767,7 @@ async function getParameters(serial) {
await new Promise((resolve) => setTimeout(resolve, 300)); await new Promise((resolve) => setTimeout(resolve, 300));
const requestResponse2 = await axios.get( const requestResponse2 = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2781,7 +2781,7 @@ async function getParameters(serial) {
await new Promise((resolve) => setTimeout(resolve, 300)); await new Promise((resolve) => setTimeout(resolve, 300));
const requestResponse3 = await axios.get( const requestResponse3 = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2795,7 +2795,7 @@ async function getParameters(serial) {
await new Promise((resolve) => setTimeout(resolve, 300)); await new Promise((resolve) => setTimeout(resolve, 300));
const requestResponse5 = await axios.get( const requestResponse5 = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2810,7 +2810,7 @@ async function getParameters(serial) {
await new Promise((resolve) => setTimeout(resolve, 300)); await new Promise((resolve) => setTimeout(resolve, 300));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
return getResponse.data; return getResponse.data;
@ -2830,7 +2830,7 @@ app.post("/main-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2844,7 +2844,7 @@ app.post("/main-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -2886,7 +2886,7 @@ app.put("/main-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -2936,7 +2936,7 @@ app.post("/ethernet-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -2950,7 +2950,7 @@ app.post("/ethernet-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3002,7 +3002,7 @@ app.put("/ethernet-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3030,7 +3030,7 @@ app.post("/wifi-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -3044,7 +3044,7 @@ app.post("/wifi-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3092,7 +3092,7 @@ app.put("/wifi-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3120,7 +3120,7 @@ app.post("/communication-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -3134,7 +3134,7 @@ app.post("/communication-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3191,7 +3191,7 @@ app.put("/communication-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3219,7 +3219,7 @@ app.post("/install-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -3233,7 +3233,7 @@ app.post("/install-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3257,7 +3257,7 @@ app.post("/ai-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -3271,7 +3271,7 @@ app.post("/ai-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3312,7 +3312,7 @@ app.put("/ai-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3340,7 +3340,7 @@ app.post("/cameras-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const requestResponse = await axios.get( const requestResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/request?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/request?serial=${serial}`,
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -3354,7 +3354,7 @@ app.post("/cameras-parameters", async (req, res) => {
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
const getResponse = await axios.get( const getResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/get?serial=${serial}` `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/get?serial=${serial}`
); );
res.json(getResponse.data); res.json(getResponse.data);
@ -3391,7 +3391,7 @@ app.put("/cameras-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3435,7 +3435,7 @@ app.put("/install-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3833,7 +3833,7 @@ app.put("/device-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -3874,7 +3874,7 @@ app.put("/camera-parameters", async (req, res) => {
.send("Ошибка: lastkeepalive старше минуты или устройство не найдено."); .send("Ошибка: lastkeepalive старше минуты или устройство не найдено.");
} }
const response = await axios.get( const response = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/parameters/set?serial=${serial}`, `http://${process.env.VIRTUAL_HOST}:4747/http/parameters/set?serial=${serial}`,
{ {
data: JSON.stringify(requestBody), data: JSON.stringify(requestBody),
headers: { headers: {
@ -5065,12 +5065,12 @@ app.get("/getData", async (req, res) => {
try { try {
const successResponse = await axios.get( const successResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/filelist/request?serial=${selectedSerial}&querytime=${selectedDate}&channel=${selectedChannel}` `http://${process.env.VIRTUAL_HOST}:4747/http/filelist/request?serial=${selectedSerial}&querytime=${selectedDate}&channel=${selectedChannel}`
); );
if (successResponse.data.SUCCESS) { if (successResponse.data.SUCCESS) {
await new Promise((resolve) => setTimeout(resolve, 7000)); await new Promise((resolve) => setTimeout(resolve, 7000));
const dataResponse = await axios.get( const dataResponse = await axios.get(
`http://${process.env.VIRTUAL_HOST}/http/filelist/get?serial=${selectedSerial}&querytime=${selectedDate}&channel=${selectedChannel}` `http://${process.env.VIRTUAL_HOST}:4747/http/filelist/get?serial=${selectedSerial}&querytime=${selectedDate}&channel=${selectedChannel}`
); );
if (successResponse.data.SUCCESS) { if (successResponse.data.SUCCESS) {
const dataId = dataResponse.data.DATAID; const dataId = dataResponse.data.DATAID;

View File

@ -351,7 +351,7 @@
const camerasPerGroup = 5; const camerasPerGroup = 5;
var totalCameras = 12 - 1; var totalCameras = 12 - 1;
const isSecure = window.location.protocol === "https:"; const isSecure = window.location.protocol === "https:";
const baseURL = "http://{{VIRTUAL_HOST}}/http/live.flv"; const baseURL = "http://{{VIRTUAL_HOST}}:4747/http/live.flv";
function stopAllCameras() { function stopAllCameras() {
flvPlayers.forEach(player => { flvPlayers.forEach(player => {

View File

@ -205,7 +205,7 @@
<script> <script>
function playVideo(channel) { function playVideo(channel) {
const url = `http://localhost:8081/playback?url=http%3A%2F%2F{{VIRTUAL_HOST}}%2Fhttp%2Fplayback.flv%3Fserial%3D{{Serial}}%26channel%3D${channel}%26quality%3D1%26queryTime%3D{{QueryTime}}%26startTime%3D{{StartTime}}%26endTime%3D{{EndTime}}`; const url = `http://localhost:8081/playback?url=http%3A%2F%2F{{VIRTUAL_HOST}}:4747%2Fhttp%2Fplayback.flv%3Fserial%3D{{Serial}}%26channel%3D${channel}%26quality%3D1%26queryTime%3D{{QueryTime}}%26startTime%3D{{StartTime}}%26endTime%3D{{EndTime}}`;
window.open(url, '_blank'); window.open(url, '_blank');
} }
</script> </script>

View File

@ -902,7 +902,7 @@ endVideoTimeInput.addEventListener("blur", sendPostRequest);
const serial = selectedDevice.value; const serial = selectedDevice.value;
const url = `http://localhost:8081/export?url=http%3A%2F%2F{{VIRTUAL_HOST}}%2Fhttp%2Fdownload.flv%3Fserial%3D${serial}%26channel%3D${channel}%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}%26recordID%3D${resData.dataId}`; const url = `http://localhost:8081/export?url=http%3A%2F%2F{{VIRTUAL_HOST}}:4747%2Fhttp%2Fdownload.flv%3Fserial%3D${serial}%26channel%3D${channel}%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}%26recordID%3D${resData.dataId}`;
document.getElementById("exportLoading").style.display = 'none'; document.getElementById("exportLoading").style.display = 'none';
window.open(url, '_blank'); window.open(url, '_blank');
} }

View File

@ -724,7 +724,7 @@ videoTimeInput.addEventListener("blur", sendPostRequest);
selectedChannel = channel; selectedChannel = channel;
const url = `http://localhost:8081/playback?url=http%3A%2F%2F{{VIRTUAL_HOST}}%2Fhttp%2Fplayback.flv%3Fserial%3D${serial}%26channel%3D${channel}%26quality%3D1%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}`; const url = `http://localhost:8081/playback?url=http%3A%2F%2F{{VIRTUAL_HOST}}:4747%2Fhttp%2Fplayback.flv%3Fserial%3D${serial}%26channel%3D${channel}%26quality%3D1%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}`;
window.open(url, '_blank'); window.open(url, '_blank');
} }
</script> </script>