api address update
This commit is contained in:
parent
12236f1fd7
commit
2d0fc1a7d1
62
server.js
62
server.js
@ -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.API_ADDRESS}/http/restart`,
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
data: { video: true },
|
data: { video: true },
|
||||||
};
|
};
|
||||||
@ -2756,7 +2756,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2770,7 +2770,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2784,7 +2784,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2798,7 +2798,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2813,7 +2813,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return getResponse.data;
|
return getResponse.data;
|
||||||
@ -2833,7 +2833,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2847,7 +2847,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -2889,7 +2889,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -2939,7 +2939,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -2953,7 +2953,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3005,7 +3005,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3033,7 +3033,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -3047,7 +3047,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3095,7 +3095,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3123,7 +3123,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -3137,7 +3137,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3194,7 +3194,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3222,7 +3222,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -3236,7 +3236,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3260,7 +3260,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -3274,7 +3274,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3315,7 +3315,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3343,7 +3343,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.API_ADDRESS}/http/parameters/request?serial=${serial}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -3357,7 +3357,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.API_ADDRESS}/http/parameters/get?serial=${serial}`
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json(getResponse.data);
|
res.json(getResponse.data);
|
||||||
@ -3394,7 +3394,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3438,7 +3438,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3836,7 +3836,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -3877,7 +3877,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.API_ADDRESS}/http/parameters/set?serial=${serial}`,
|
||||||
{
|
{
|
||||||
data: JSON.stringify(requestBody),
|
data: JSON.stringify(requestBody),
|
||||||
headers: {
|
headers: {
|
||||||
@ -5081,12 +5081,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.API_ADDRESS}/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.API_ADDRESS}/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;
|
||||||
|
Loading…
Reference in New Issue
Block a user