revert: remove .env loading, restore hardcoded config

- appsettings.json: restored hardcoded secrets
- Program.cs: removed .env file loader
- Frontend api-clients: restored hardcoded localhost:5000
- Removed .env, .env.example, vite-env.d.ts files
- Kept all audit fixes (endpoints, DTOs, field names, status labels)
This commit is contained in:
MingNian
2026-05-24 13:38:45 +08:00
parent ede4a8d29e
commit db443b258e
14 changed files with 93 additions and 155 deletions

View File

@@ -62,7 +62,7 @@ export function ChatPage() {
// Set up SignalR connection
const conn = new HubConnectionBuilder()
.withUrl(`${import.meta.env.VITE_API_URL}/hubs/chat`, {
.withUrl('http://localhost:5000/hubs/chat', {
accessTokenFactory: () => getToken(),
})
.withAutomaticReconnect()

View File

@@ -53,7 +53,7 @@ export function ReportDetailPage() {
<div style={{ fontSize: 13, fontWeight: 500, marginBottom: 8 }}></div>
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
{report.imageUrls.map((url, i) => (
<img key={i} src={`${import.meta.env.VITE_API_URL}${url}`} alt="report"
<img key={i} src={`http://localhost:5000${url}`} alt="report"
style={{ width: 80, height: 80, borderRadius: 8, objectFit: 'cover', border: '1px solid #eee' }} />
))}
</div>

View File

@@ -38,7 +38,7 @@ export function ReportUploadPage() {
const formData = new FormData();
formData.append('file', file);
const token = JSON.parse(localStorage.getItem('hrt_auth') || '{}')?.state?.token;
const res = await fetch(`${import.meta.env.VITE_API_URL}/api/files/upload`, {
const res = await fetch('http://localhost:5000/api/files/upload', {
method: 'POST',
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
body: formData,

View File

@@ -9,7 +9,7 @@ interface ApiResponse<T> {
message: string;
}
const BASE_URL = import.meta.env.VITE_API_URL;
const BASE_URL = 'http://localhost:5000';
// Endpoints that should NEVER include auth token
const PUBLIC_ENDPOINTS = ['/api/auth/login', '/api/auth/register', '/api/auth/send-sms', '/api/auth/refresh'];

View File

@@ -1,9 +0,0 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_API_URL: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}