项目名调整,功能优化

This commit is contained in:
2026-01-26 22:20:27 +08:00
parent c6e5e655f9
commit 50275265ac
25 changed files with 413 additions and 66 deletions

View File

@@ -189,6 +189,66 @@ const docTemplate = `{
}
}
},
"/admin/password": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "验证旧密码并设置新密码,自动更新配置文件",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "修改管理员密码",
"parameters": [
{
"description": "修改密码请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.ChangePasswordRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/admin/tokens": {
"get": {
"security": [
@@ -747,6 +807,21 @@ const docTemplate = `{
}
}
},
"handlers.ChangePasswordRequest": {
"type": "object",
"required": [
"new_password",
"old_password"
],
"properties": {
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
}
}
},
"handlers.CreateTokenRequest": {
"type": "object",
"required": [
@@ -835,7 +910,7 @@ var SwaggerInfo = &swag.Spec{
Host: "localhost:8080",
BasePath: "/api/v1",
Schemes: []string{},
Title: "BingDailyImage API",
Title: "BingPaper API",
Description: "必应每日一图抓取、存储、管理与公共 API 服务。",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,

View File

@@ -2,7 +2,7 @@
"swagger": "2.0",
"info": {
"description": "必应每日一图抓取、存储、管理与公共 API 服务。",
"title": "BingDailyImage API",
"title": "BingPaper API",
"contact": {},
"version": "1.0"
},
@@ -183,6 +183,66 @@
}
}
},
"/admin/password": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "验证旧密码并设置新密码,自动更新配置文件",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "修改管理员密码",
"parameters": [
{
"description": "修改密码请求",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.ChangePasswordRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/admin/tokens": {
"get": {
"security": [
@@ -741,6 +801,21 @@
}
}
},
"handlers.ChangePasswordRequest": {
"type": "object",
"required": [
"new_password",
"old_password"
],
"properties": {
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
}
}
},
"handlers.CreateTokenRequest": {
"type": "object",
"required": [

View File

@@ -121,6 +121,16 @@ definitions:
username:
type: string
type: object
handlers.ChangePasswordRequest:
properties:
new_password:
type: string
old_password:
type: string
required:
- new_password
- old_password
type: object
handlers.CreateTokenRequest:
properties:
expires_at:
@@ -172,7 +182,7 @@ host: localhost:8080
info:
contact: {}
description: 必应每日一图抓取、存储、管理与公共 API 服务。
title: BingDailyImage API
title: BingPaper API
version: "1.0"
paths:
/admin/cleanup:
@@ -283,6 +293,44 @@ paths:
summary: 管理员登录
tags:
- admin
/admin/password:
post:
consumes:
- application/json
description: 验证旧密码并设置新密码,自动更新配置文件
parameters:
- description: 修改密码请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/handlers.ChangePasswordRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: 修改管理员密码
tags:
- admin
/admin/tokens:
get:
description: 获取所有已创建的 API Token 列表