This commit is contained in:
www.xueximeng.com
2025-07-19 12:31:02 +08:00
parent 828646f5e1
commit 6d871a4f05
4 changed files with 350 additions and 115 deletions

View File

@@ -2,37 +2,37 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://dm.xueximeng.com/</loc>
<lastmod>2025-07-17</lastmod>
<lastmod>2025-07-19</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/submit</loc>
<lastmod>2025-07-17</lastmod>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/about</loc>
<lastmod>2025-07-17</lastmod>
<lastmod>2025-07-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/11</loc>
<lastmod>2025-07-06</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/13</loc>
<lastmod>2025-06-27</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/4</loc>
<lastmod>2025-07-08</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -44,7 +44,19 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/50</loc>
<lastmod>2025-06-27</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/5</loc>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/18</loc>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -54,12 +66,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/5</loc>
<lastmod>2025-07-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/82</loc>
<lastmod>2025-07-07</lastmod>
@@ -72,12 +78,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/18</loc>
<lastmod>2025-06-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/30</loc>
<lastmod>2025-06-27</lastmod>
@@ -92,7 +92,13 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/26</loc>
<lastmod>2025-06-19</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/8</loc>
<lastmod>2025-06-20</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -114,12 +120,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/8</loc>
<lastmod>2025-06-20</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/28</loc>
<lastmod>2025-06-27</lastmod>
@@ -134,7 +134,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/40</loc>
<lastmod>2025-06-27</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -156,6 +156,12 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/14</loc>
<lastmod>2025-05-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/38</loc>
<lastmod>2025-06-25</lastmod>
@@ -168,6 +174,12 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/107</loc>
<lastmod>2025-07-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/109</loc>
<lastmod>2025-06-27</lastmod>
@@ -186,12 +198,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/14</loc>
<lastmod>2025-05-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/16</loc>
<lastmod>2025-06-19</lastmod>
@@ -216,21 +222,21 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/90</loc>
<lastmod>2025-06-23</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/95</loc>
<lastmod>2025-07-03</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/107</loc>
<lastmod>2025-07-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/184</loc>
<lastmod>2025-07-14</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -248,7 +254,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/22</loc>
<lastmod>2025-06-14</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -306,12 +312,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/90</loc>
<lastmod>2025-06-23</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/94</loc>
<lastmod>2025-06-14</lastmod>
@@ -336,6 +336,12 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/180</loc>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/2</loc>
<lastmod>2025-06-21</lastmod>
@@ -450,6 +456,12 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/119</loc>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/135</loc>
<lastmod>2025-06-22</lastmod>
@@ -462,12 +474,42 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/149</loc>
<lastmod>2025-06-24</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/153</loc>
<lastmod>2025-06-24</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/154</loc>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/157</loc>
<lastmod>2025-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/159</loc>
<lastmod>2025-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/161</loc>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/162</loc>
<lastmod>2025-06-26</lastmod>
@@ -475,8 +517,20 @@
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/180</loc>
<lastmod>2025-07-09</lastmod>
<loc>https://dm.xueximeng.com/resource/168</loc>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/169</loc>
<lastmod>2025-07-02</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/174</loc>
<lastmod>2025-07-03</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -672,12 +726,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/119</loc>
<lastmod>2025-06-27</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/120</loc>
<lastmod>2025-07-03</lastmod>
@@ -764,7 +812,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/146</loc>
<lastmod>2025-06-24</lastmod>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -780,12 +828,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/149</loc>
<lastmod>2025-06-24</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/150</loc>
<lastmod>2025-06-24</lastmod>
@@ -804,12 +846,6 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/154</loc>
<lastmod>2025-06-24</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/155</loc>
<lastmod>2025-07-02</lastmod>
@@ -822,36 +858,18 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/157</loc>
<lastmod>2025-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/158</loc>
<lastmod>2025-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/159</loc>
<lastmod>2025-06-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/160</loc>
<lastmod>2025-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/161</loc>
<lastmod>2025-07-09</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/163</loc>
<lastmod>2025-06-27</lastmod>
@@ -878,19 +896,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/167</loc>
<lastmod>2025-07-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/168</loc>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/169</loc>
<lastmod>2025-07-02</lastmod>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -902,7 +908,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/171</loc>
<lastmod>2025-07-01</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -914,13 +920,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/173</loc>
<lastmod>2025-07-02</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/174</loc>
<lastmod>2025-07-03</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -938,7 +938,7 @@
</url>
<url>
<loc>https://dm.xueximeng.com/resource/177</loc>
<lastmod>2025-07-04</lastmod>
<lastmod>2025-07-17</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
@@ -960,4 +960,28 @@
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/187</loc>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/188</loc>
<lastmod>2025-07-18</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/190</loc>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://dm.xueximeng.com/resource/192</loc>
<lastmod>2025-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
</urlset>

View File

@@ -0,0 +1,216 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>测试设置API</title>
<style>
body {
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
h1 {
color: #333;
text-align: center;
}
.card {
background: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
textarea {
width: 100%;
height: 200px;
padding: 10px;
border-radius: 4px;
border: 1px solid #ddd;
margin-bottom: 10px;
font-family: monospace;
resize: vertical;
}
button {
background: #4f46e5;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
}
button:hover {
background: #4338ca;
}
.result {
margin-top: 20px;
padding: 15px;
border-radius: 4px;
white-space: pre-wrap;
font-family: monospace;
background-color: #f8f8f8;
border: 1px solid #ddd;
max-height: 300px;
overflow: auto;
}
.success {
background-color: #d1fae5;
border-color: #10b981;
}
.error {
background-color: #fee2e2;
border-color: #ef4444;
}
</style>
</head>
<body>
<h1>设置API测试工具</h1>
<div class="card">
<h2>测试页脚设置API</h2>
<p>这个工具可以帮助您测试页脚设置API发送PUT请求到 <code>/api/settings/footer</code> 端点。</p>
<div>
<label for="token"><strong>认证令牌 (Bearer Token)</strong></label>
<input type="text" id="token" style="width: 100%; padding: 8px; margin: 5px 0 15px;" placeholder="粘贴您的认证令牌">
</div>
<div>
<label for="payload"><strong>请求数据 (JSON)</strong></label>
<textarea id="payload" placeholder="输入JSON格式的请求数据">{
"setting_value": {
"links": [
{ "text": "关于我们", "url": "/about", "type": "internal" },
{ "text": "GitHub", "url": "https://github.com/fish2018/GoComicMosaic", "icon": "bi bi-github", "type": "external", "title": "查看GitHub源码" }
],
"copyright": "© 2025 美漫资源共建. 保留所有权利",
"show_visitor_count": true
}
}</textarea>
</div>
<div>
<button id="sendRequest">发送PUT请求</button>
<button id="checkToken" style="background: #059669;">检查令牌</button>
</div>
<div id="result" class="result" style="display: none;">
待发送请求...
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// 从localStorage中获取token
try {
const savedToken = localStorage.getItem('accessToken');
if (savedToken) {
document.getElementById('token').value = savedToken;
console.log('已从localStorage加载令牌');
}
} catch (e) {
console.error('读取localStorage失败:', e);
}
// 发送请求按钮
document.getElementById('sendRequest').addEventListener('click', async function() {
const token = document.getElementById('token').value.trim();
const payload = document.getElementById('payload').value.trim();
const resultElement = document.getElementById('result');
resultElement.style.display = 'block';
resultElement.className = 'result';
resultElement.textContent = '发送请求中...';
if (!token) {
resultElement.textContent = '错误: 请提供认证令牌';
resultElement.className = 'result error';
return;
}
try {
let payloadObj = JSON.parse(payload);
// 创建一个XHR请求
const xhr = new XMLHttpRequest();
xhr.open('PUT', '/api/settings/footer', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', `Bearer ${token}`);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.withCredentials = true;
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
resultElement.textContent = `请求成功 (${xhr.status} ${xhr.statusText}):\n\n${xhr.responseText}`;
resultElement.className = 'result success';
} else {
resultElement.textContent = `请求失败 (${xhr.status} ${xhr.statusText}):\n\n${xhr.responseText}`;
resultElement.className = 'result error';
}
};
xhr.onerror = function() {
resultElement.textContent = '网络错误,请检查控制台';
resultElement.className = 'result error';
};
const requestStart = new Date();
xhr.send(payload);
console.log('已发送请求:', payload);
console.log('请求头:', {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token.substring(0, 10)}...` // 只显示部分令牌
});
} catch (e) {
resultElement.textContent = `请求错误: ${e.message}`;
resultElement.className = 'result error';
}
});
// 检查令牌按钮
document.getElementById('checkToken').addEventListener('click', function() {
const token = document.getElementById('token').value.trim();
const resultElement = document.getElementById('result');
resultElement.style.display = 'block';
if (!token) {
resultElement.textContent = '错误: 请提供认证令牌';
resultElement.className = 'result error';
return;
}
try {
// 尝试解码令牌
const tokenParts = token.split('.');
if (tokenParts.length !== 3) {
resultElement.textContent = '无效的JWT令牌格式';
resultElement.className = 'result error';
return;
}
// 解码payload部分
const payload = JSON.parse(atob(tokenParts[1]));
const expDate = new Date(payload.exp * 1000);
const now = new Date();
const isExpired = expDate < now;
resultElement.textContent = `令牌信息:\n\n`;
resultElement.textContent += `有效期至: ${expDate.toLocaleString()}\n`;
resultElement.textContent += `当前时间: ${now.toLocaleString()}\n`;
resultElement.textContent += `是否过期: ${isExpired ? '已过期' : '有效'}\n\n`;
resultElement.textContent += `载荷数据:\n${JSON.stringify(payload, null, 2)}`;
resultElement.className = isExpired ? 'result error' : 'result success';
} catch (e) {
resultElement.textContent = `令牌解析错误: ${e.message}\n可能不是有效的JWT格式`;
resultElement.className = 'result error';
}
});
});
</script>
</body>
</html>

View File

@@ -104,7 +104,7 @@ export const getImageUrl = (imagePath, defaultImage = 'https://via.placeholder.c
if (!imagePath) return defaultImage;
// 如果路径已经是完整URL直接返回
if (imagePath.startsWith('http://') || imagePath.startsWith('https://')) {
if (imagePath.startsWith('https://') || imagePath.startsWith('http://')) {
return imagePath;
}

View File

@@ -133,12 +133,7 @@ func EnhanceImageHandler(c *gin.Context) {
}
// 构造URL和相对路径用于前端显示
scheme := "http"
if c.Request.TLS != nil {
scheme = "https"
}
host := c.Request.Host
baseURL := fmt.Sprintf("%s://%s", scheme, host)
baseURL := c.GetHeader("Origin")
originalRelPath := filepath.Join("assets", "handles", originalFilename)
enhancedRelPath := filepath.Join("assets", "handles", enhancedFilename)