fix(fix3): runtime env hardening and public endpoint source-of-truth

This commit is contained in:
2026-04-28 04:45:43 +05:00
parent 96d9bbcece
commit 12c65c8e31
23 changed files with 131 additions and 238 deletions
-2
View File
@@ -6,12 +6,10 @@ export interface Hysteria2KickDto {
export interface Hysteria2SubscribeUrlDto {
accountId: number;
protocol: string;
host: string;
}
export interface Hysteria2UrlDto {
accountId: number;
hostname: string;
}
export interface Hysteria2SubscribeVo {
-2
View File
@@ -9,8 +9,6 @@ declare module "*.vue" {
// TypeScript-подсказки для переменных окружения
interface ImportMetaEnv {
VITE_APP_PORT: string;
VITE_APP_BASE_API: string;
}
interface ImportMeta {
+2 -1
View File
@@ -2,9 +2,10 @@ import axios, { InternalAxiosRequestConfig, AxiosResponse } from "axios";
import { useAccountStoreHook } from "@/store/modules/account";
const dynamicBase = (window as any).__dynamic_base__ || "";
const API_BASE = "/hui";
// Создание axios instance
const service = axios.create({
baseURL: `${dynamicBase}${import.meta.env.VITE_APP_BASE_API}`,
baseURL: `${dynamicBase}${API_BASE}`,
timeout: 50000,
headers: { "Content-Type": "application/json;charset=utf-8" },
});
@@ -906,7 +906,6 @@ const handleSubscribe = async (row: { [key: string]: any }) => {
const dto: Hysteria2SubscribeUrlDto = {
accountId: row.id,
protocol: window.location.protocol,
host: window.location.host,
};
const { data } = await hysteria2SubscribeUrlApi(dto);
copy(data.url);
@@ -920,7 +919,6 @@ const handleNodeUrl = async (row: { [key: string]: any }) => {
try {
const dto: Hysteria2UrlDto = {
accountId: row.id,
hostname: window.location.hostname,
};
const { data } = await hysteria2UrlApi(dto);
copy(data.url);
@@ -934,7 +932,6 @@ const handleQrCode = async (row: { [key: string]: any }) => {
try {
const dto: Hysteria2UrlDto = {
accountId: row.id,
hostname: window.location.hostname,
};
const { data } = await hysteria2UrlApi(dto);
state.qrCodeSrc = "data:image/png;base64," + data.qrCode;
@@ -204,7 +204,6 @@ const handleSubscribe = async () => {
const dto: Hysteria2SubscribeUrlDto = {
accountId: accountStore.id,
protocol: window.location.protocol,
host: window.location.host,
};
const { data } = await hysteria2SubscribeUrlApi(dto);
copy(data.url);
@@ -219,7 +218,6 @@ const handleSubscribeQrCode = async () => {
const dto: Hysteria2SubscribeUrlDto = {
accountId: accountStore.id,
protocol: window.location.protocol,
host: window.location.host,
};
const { data } = await hysteria2SubscribeUrlApi(dto);
state.qrCodeSrc = "data:image/png;base64," + data.qrCode;
@@ -233,7 +231,6 @@ const handleNodeUrl = async () => {
try {
const dto: Hysteria2UrlDto = {
accountId: accountStore.id,
hostname: window.location.hostname,
};
const { data } = await hysteria2UrlApi(dto);
copy(data.url);
@@ -247,7 +244,6 @@ const handleUrlQrCode = async () => {
try {
const dto: Hysteria2UrlDto = {
accountId: accountStore.id,
hostname: window.location.hostname,
};
const { data } = await hysteria2UrlApi(dto);
state.qrCodeSrc = "data:image/png;base64," + data.qrCode;