Frontend -> vite
This commit is contained in:
@@ -5,7 +5,7 @@ import { ImCross } from 'react-icons/im';
|
||||
import { Outlet, Route, Routes } from 'react-router-dom';
|
||||
import MainLayout from './components/MainLayout';
|
||||
import { PasswordSend, ServerStatusResponse } from './js/models';
|
||||
import { errorNotify, fireUpdateRequest, getstatus, HomeRedirector, login, setpassword } from './js/utils';
|
||||
import { errorNotify, fireUpdateRequest, getstatus, HomeRedirector, IS_DEV, login, setpassword } from './js/utils';
|
||||
import NFRegex from './pages/NFRegex';
|
||||
import io from 'socket.io-client';
|
||||
import RegexProxy from './pages/RegexProxy';
|
||||
@@ -13,7 +13,7 @@ import ServiceDetailsNFRegex from './pages/NFRegex/ServiceDetails';
|
||||
import ServiceDetailsProxyRegex from './pages/RegexProxy/ServiceDetails';
|
||||
import PortHijack from './pages/PortHijack';
|
||||
|
||||
const socket = io({transports: ["websocket", "polling"], path:"/sock" });
|
||||
const socket = io({transports: ["websocket", "polling"], path:"/sock", host:IS_DEV?"127.0.0.1:4444":undefined });
|
||||
|
||||
function App() {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import { regexproxy } from "../components/RegexProxy/utils";
|
||||
import { ChangePassword, IpInterface, LoginResponse, PasswordSend, ServerResponse, ServerResponseToken, ServerStatusResponse } from "./models";
|
||||
import { Buffer } from "buffer"
|
||||
|
||||
export const IS_DEV = import.meta.env.DEV
|
||||
|
||||
export const eventUpdateName = "update-info"
|
||||
|
||||
@@ -18,7 +19,7 @@ export const regex_ipv4_no_cidr = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[
|
||||
export async function getapi(path:string):Promise<any>{
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
fetch(`/api/${path}`,{
|
||||
fetch(`${IS_DEV?"http://127.0.0.1:4444":""}/api/${path}`,{
|
||||
credentials: "same-origin",
|
||||
headers: { "Authorization" : "Bearer " + window.localStorage.getItem("access_token")}
|
||||
}).then(res => {
|
||||
@@ -34,7 +35,7 @@ export async function getapi(path:string):Promise<any>{
|
||||
|
||||
export async function postapi(path:string,data:any,is_form:boolean=false):Promise<any>{
|
||||
return await new Promise((resolve, reject) => {
|
||||
fetch(`/api/${path}`, {
|
||||
fetch(`${IS_DEV?"http://127.0.0.1:4444":""}/api/${path}`, {
|
||||
method: 'POST',
|
||||
credentials: "same-origin",
|
||||
cache: 'no-cache',
|
||||
|
||||
Reference in New Issue
Block a user