mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
refactor(openflare): remove unused About page and API
Delete AboutService and GET /api/v1/d/about since the about page was never implemented in the Wavelet frontend.
This commit is contained in:
@@ -3528,50 +3528,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/d/about": {
|
||||
"get": {
|
||||
"description": "返回 OpenFlare 关于页面文本,无需登录",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"openflare-option"
|
||||
],
|
||||
"summary": "获取关于信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "关于信息",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/d/access-logs": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
||||
@@ -3521,50 +3521,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/d/about": {
|
||||
"get": {
|
||||
"description": "返回 OpenFlare 关于页面文本,无需登录",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"openflare-option"
|
||||
],
|
||||
"summary": "获取关于信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "关于信息",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/d/access-logs": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
||||
@@ -5169,32 +5169,6 @@ paths:
|
||||
summary: Sample Hello API
|
||||
tags:
|
||||
- custom
|
||||
/api/v1/d/about:
|
||||
get:
|
||||
description: 返回 OpenFlare 关于页面文本,无需登录
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 关于信息
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
"500":
|
||||
description: 内部错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 获取关于信息
|
||||
tags:
|
||||
- openflare-option
|
||||
/api/v1/d/access-logs:
|
||||
get:
|
||||
description: 分页返回 OpenFlare 访问日志,支持按节点、IP、主机与路径筛选,需要管理员权限
|
||||
|
||||
@@ -27,7 +27,6 @@ import {PushService} from './push';
|
||||
import {AdminUploadService, UploadService} from './upload';
|
||||
import {UserService} from './user';
|
||||
import {
|
||||
AboutService,
|
||||
AccessLogService,
|
||||
ApplyLogService,
|
||||
ConfigVersionService,
|
||||
@@ -62,7 +61,6 @@ const services = {
|
||||
adminUpload: AdminUploadService,
|
||||
dbManage: DbManageService,
|
||||
push: PushService,
|
||||
openflareAbout: AboutService,
|
||||
openflareNode: NodeService,
|
||||
openflareProxyRoute: ProxyRouteService,
|
||||
openflareConfigVersion: ConfigVersionService,
|
||||
@@ -183,7 +181,6 @@ export type { PushEvent, PushHistory, PushChannelConfig, ListPushHistoriesReques
|
||||
// ==================== OpenFlare 业务服务导出 ====================
|
||||
|
||||
export {
|
||||
AboutService,
|
||||
OpenFlareBaseService,
|
||||
NodeService,
|
||||
ProxyRouteService,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import {OpenFlareBaseService} from './base.service';
|
||||
|
||||
export class AboutService extends OpenFlareBaseService {
|
||||
static getAboutContent(): Promise<string> {
|
||||
return this.get<string>('/about');
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
export { AboutService } from './about.service';
|
||||
export { OpenFlareBaseService } from './base.service';
|
||||
|
||||
export { NodeService } from './node.service';
|
||||
@@ -119,7 +118,6 @@ export type {
|
||||
TlsCertificateMutationPayload,
|
||||
} from './types';
|
||||
|
||||
import {AboutService} from './about.service';
|
||||
import {AccessLogService} from './access-log.service';
|
||||
import {ApplyLogService} from './apply-log.service';
|
||||
import {ConfigVersionService} from './config-version.service';
|
||||
@@ -138,7 +136,6 @@ import {WafService} from './waf.service';
|
||||
import {WebsiteService} from './website.service';
|
||||
|
||||
export const openflareServices = {
|
||||
about: AboutService,
|
||||
node: NodeService,
|
||||
proxyRoute: ProxyRouteService,
|
||||
configVersion: ConfigVersionService,
|
||||
|
||||
@@ -146,13 +146,6 @@ func getNotice(ctx context.Context) (string, error) {
|
||||
return model.OptionValue("Notice"), nil
|
||||
}
|
||||
|
||||
func getAbout(ctx context.Context) (string, error) {
|
||||
if err := EnsureInitialized(ctx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return model.OptionValue("About"), nil
|
||||
}
|
||||
|
||||
func getStatus(ctx context.Context, baseAPIPath string) (*statusView, error) {
|
||||
if err := EnsureInitialized(ctx); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -73,21 +73,16 @@ func TestUpdateOptionHotReloadsOptionMap(t *testing.T) {
|
||||
assert.Equal(t, "HotReloaded", model.SystemName)
|
||||
}
|
||||
|
||||
func TestGetNoticeAndAbout(t *testing.T) {
|
||||
func TestGetNotice(t *testing.T) {
|
||||
cleanup := setupOptionTestDB(t)
|
||||
defer cleanup()
|
||||
ctx := context.Background()
|
||||
|
||||
require.NoError(t, updateOption(ctx, model.OpenFlareOption{Key: "Notice", Value: "hello"}))
|
||||
require.NoError(t, updateOption(ctx, model.OpenFlareOption{Key: "About", Value: "about-us"}))
|
||||
|
||||
notice, err := getNotice(ctx)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "hello", notice)
|
||||
|
||||
about, err := getAbout(ctx)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "about-us", about)
|
||||
}
|
||||
|
||||
func TestLookupGeoIPDisabledProvider(t *testing.T) {
|
||||
|
||||
@@ -50,24 +50,6 @@ func GetNoticeHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response.OK(notice))
|
||||
}
|
||||
|
||||
// getAboutHandler 获取关于信息。
|
||||
// @Summary 获取关于信息
|
||||
// @Description 返回 OpenFlare 关于页面文本,无需登录
|
||||
// @Tags openflare-option
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Any{data=string} "关于信息"
|
||||
// @Failure 400 {object} response.Any "参数错误"
|
||||
// @Failure 500 {object} response.Any "内部错误"
|
||||
// @Router /api/v1/d/about [get]
|
||||
// GetAboutHandler returns the about content.
|
||||
func GetAboutHandler(c *gin.Context) {
|
||||
about, err := getAbout(c.Request.Context())
|
||||
if apiutil.AbortBadRequestOnError(c, err) {
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, response.OK(about))
|
||||
}
|
||||
|
||||
// listOptionsHandler 列出全部配置项。
|
||||
// @Summary 列出 OpenFlare 配置项
|
||||
// @Description 返回全部非敏感 OpenFlare 配置项,需要管理员权限
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
func registerOptionRoutes(apiGroup *gin.RouterGroup) {
|
||||
apiGroup.GET("/status", option.GetStatusHandler)
|
||||
apiGroup.GET("/notice", option.GetNoticeHandler)
|
||||
apiGroup.GET("/about", option.GetAboutHandler)
|
||||
|
||||
optionRoute := apiGroup.Group("/option")
|
||||
optionRoute.Use(apiutil.AdminMiddlewares()...)
|
||||
|
||||
@@ -18,6 +18,7 @@ sidebar: false
|
||||
|
||||
### 移除
|
||||
|
||||
- 移除 Wavelet About 界面相关代码:删除 `AboutService` 与 `GET /api/v1/d/about` 接口(页面从未实现,属冗余遗留)。
|
||||
- 移除 Wavelet 中从旧系统迁移但未实装的全局 API / Web / 敏感接口限流选项(`GlobalApiRateLimit*`、`GlobalWebRateLimit*`、`CriticalRateLimit*`)及相关校验与数据库种子。
|
||||
- 移除 `internal/apps/openflare/legacy/` 控制台兼容层、`compat/auth.go`(`OpenFlare-Token` JWT 桥接)及前端 `legacy-base.service.ts`;`openflare-server/web` 不再能对接当前 Wavelet 后端管理 API。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user