将图标资源迁移到 src/assets 并通过构建产物 hash 管理缓存,移除 public 目录旧图标引用;新增 Nginx 配置,设置 index.html 协商缓存与 /assets 长缓存策略。 Made-with: Cursor
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
name="viewport"
|
||||
content="initial-scale=1.0,maximum-scale=1,minimum-scale=1.0,user-scalable=no,width=device-width,viewport-fit=cover"
|
||||
/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/src/assets/favicon.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/src/assets/apple-touch-icon.png" />
|
||||
<title>Chat One Web</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
32
nginx.conf
Normal file
32
nginx.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Vite build 产物:文件名带 hash,可长期缓存
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 单独图标按中等缓存(如果后续也迁到 /assets,可删除)
|
||||
location ~* ^/(favicon\.ico|favicon\.png|apple-touch-icon\.png)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 入口 HTML 每次协商缓存,确保能拿到最新资源清单
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# SPA 路由回退
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
@@ -38,6 +38,7 @@ import {
|
||||
} from "antd";
|
||||
import type { MenuProps } from "antd";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import logoSrc from "../assets/logo.png";
|
||||
import { ACCESS_TOKEN_KEY, SessionExpiredError, USER_KEY, logout } from "../api/auth";
|
||||
import {
|
||||
createChatSession,
|
||||
@@ -97,6 +98,7 @@ const CONTEXT_WINDOW_SIZE = 8;
|
||||
const DEEP_THINK_STORAGE_KEY = "chatone-deep-think-enabled";
|
||||
const SMART_SEARCH_STORAGE_KEY = "chatone-smart-search-enabled";
|
||||
const SELECTED_MODEL_STORAGE_KEY = "chatone-selected-model";
|
||||
const LOGO_SRC = logoSrc;
|
||||
|
||||
/** 展示名与请求 model 字段;需与后端实际支持的模型 id 一致 */
|
||||
const DEFAULT_QWEN_MODEL = "qwen3.6-plus";
|
||||
@@ -735,7 +737,7 @@ export default function HomePage() {
|
||||
<div className="flex h-full min-h-0 min-w-0 flex-col">
|
||||
<div className="flex h-14 shrink-0 items-center gap-2 px-3">
|
||||
<img
|
||||
src="/logo.png"
|
||||
src={LOGO_SRC}
|
||||
alt=""
|
||||
width={32}
|
||||
height={32}
|
||||
@@ -780,7 +782,7 @@ export default function HomePage() {
|
||||
}}
|
||||
/>
|
||||
<img
|
||||
src="/logo.png"
|
||||
src={LOGO_SRC}
|
||||
alt=""
|
||||
width={24}
|
||||
height={24}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Button, Input, Typography, message } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import logoSrc from "../assets/logo.png";
|
||||
import {
|
||||
ACCESS_TOKEN_KEY,
|
||||
persistTokens,
|
||||
@@ -12,6 +13,7 @@ import { tw } from "../utils/tw";
|
||||
|
||||
/** 发送验证码成功后,按钮冷却秒数 */
|
||||
const SMS_RESEND_COOLDOWN_SEC = 60;
|
||||
const LOGO_SRC = logoSrc;
|
||||
|
||||
/** 短信验证码登录页:校验本地 token、发送验证码、提交登录 */
|
||||
export default function LoginPage() {
|
||||
@@ -127,7 +129,7 @@ export default function LoginPage() {
|
||||
<section className="w-[325px] -translate-y-6">
|
||||
<div className="mb-7 flex items-center justify-center gap-2">
|
||||
<img
|
||||
src="/logo.png"
|
||||
src={LOGO_SRC}
|
||||
alt="ChatOne Logo"
|
||||
width={28}
|
||||
height={28}
|
||||
|
||||
Reference in New Issue
Block a user