mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-04 09:11:34 -07:00
Use getApiBase() to get GraphQL Endpoint.
This commit is contained in:
@@ -210,23 +210,20 @@
|
|||||||
<div id="scanoutput" style="margin-top: 30px;"></div>
|
<div id="scanoutput" style="margin-top: 30px;"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// Build base URL dynamically
|
||||||
const protocol = window.location.protocol;
|
const apiBase = getApiBase();
|
||||||
const host = window.location.hostname;
|
|
||||||
const port = getSetting("GRAPHQL_PORT");
|
|
||||||
const apiToken = getSetting("API_TOKEN");
|
const apiToken = getSetting("API_TOKEN");
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
function manualnmapscan(targetip, mode) {
|
function manualnmapscan(targetip, mode) {
|
||||||
$("#scanoutput").empty();
|
$("#scanoutput").empty();
|
||||||
|
|
||||||
|
// Build base URL dynamically
|
||||||
const baseUrl = getApiBase();
|
const apiBase = getApiBase();
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${baseUrl}/nettools/nmap`,
|
url: `${apiBase}/nettools/nmap`,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@@ -265,7 +262,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `${protocol}//${host}:${port}/nettools/speedtest`,
|
url: `${apiBase}/nettools/speedtest`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -316,7 +313,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${protocol}//${host}:${port}/nettools/traceroute`,
|
url: `${apiBase}/nettools/traceroute`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -366,7 +363,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${protocol}//${host}:${port}/nettools/nslookup`,
|
url: `${apiBase}/nettools/nslookup`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -450,7 +447,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${protocol}//${host}:${port}/nettools/wakeonlan`,
|
url: `${apiBase}/nettools/wakeonlan`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -492,7 +489,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${protocol}//${host}:${port}/device/copy`,
|
url: `${apiBase}/device/copy`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@@ -585,18 +582,14 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const protocol = window.location.protocol; // "http:" or "https:"
|
|
||||||
const host = window.location.hostname; // current hostname
|
|
||||||
const port = getSetting("GRAPHQL_PORT"); // your dynamic port
|
|
||||||
const apiToken = getSetting("API_TOKEN"); // optional token if needed
|
|
||||||
|
|
||||||
// Build base URL dynamically
|
// Build base URL dynamically
|
||||||
const baseUrl = getApiBase();
|
const apiBase = getApiBase();
|
||||||
|
const apiToken = getSetting("API_TOKEN"); // optional token if needed
|
||||||
|
|
||||||
// Delete device events
|
// Delete device events
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: `${baseUrl}/device/${encodeURIComponent(mac)}/events/delete`,
|
url: `${apiBase}/device/${encodeURIComponent(mac)}/events/delete`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken
|
"Authorization": "Bearer " + apiToken
|
||||||
},
|
},
|
||||||
@@ -641,11 +634,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = getApiBase();
|
// Build base URL dynamically
|
||||||
|
const apiBase = getApiBase();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${baseUrl}/device/${encodeURIComponent(mac)}/reset-props`,
|
url: `${apiBase}/device/${encodeURIComponent(mac)}/reset-props`,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken
|
"Authorization": "Bearer " + apiToken
|
||||||
@@ -675,7 +669,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `${protocol}//${host}:${port}/nettools/internetinfo`,
|
url: `${apiBase}/nettools/internetinfo`,
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
|||||||
Reference in New Issue
Block a user