移除Notice

This commit is contained in:
ryan
2026-06-22 12:00:43 +08:00
parent 6719c02d05
commit ffe98f6307
11 changed files with 10 additions and 155 deletions
-44
View File
@@ -7301,50 +7301,6 @@ const docTemplate = `{
}
}
},
"/api/v1/d/notice": {
"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/option": {
"get": {
"security": [
-44
View File
@@ -7294,50 +7294,6 @@
}
}
},
"/api/v1/d/notice": {
"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/option": {
"get": {
"security": [
-26
View File
@@ -8289,32 +8289,6 @@ paths:
summary: 轮换引导令牌
tags:
- openflare-node
/api/v1/d/notice:
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/option:
get:
description: 返回全部非敏感 OpenFlare 配置项,需要管理员权限
@@ -38,7 +38,6 @@ import {
buildCertificateLabel,
getCertificateStatus,
getErrorMessage,
getMatchTypeMeta,
isRouteRelatedToManagedDomain,
} from '../components/website-utils';
@@ -175,9 +174,7 @@ export function WebsiteDetailPageClient() {
);
}
const matchType = getMatchTypeMeta(website.domain);
const certificateStatus = certificate ? getCertificateStatus(certificate) : null;
const enabledRoutesCount = relatedRoutes.filter((route) => route.enabled).length;
return (
<div className="py-6 px-1 space-y-6">
-7
View File
@@ -143,13 +143,6 @@ func updateOptions(ctx context.Context, options []model.OpenFlareOption) error {
return nil
}
func getNotice(ctx context.Context) (string, error) {
if err := EnsureInitialized(ctx); err != nil {
return "", err
}
return model.OptionValue("Notice"), nil
}
func getStatus(ctx context.Context, baseAPIPath string) (*statusView, error) {
if err := EnsureInitialized(ctx); err != nil {
return nil, err
@@ -73,18 +73,6 @@ func TestUpdateOptionHotReloadsOptionMap(t *testing.T) {
assert.Equal(t, "HotReloaded", model.SystemName)
}
func TestGetNotice(t *testing.T) {
cleanup := setupOptionTestDB(t)
defer cleanup()
ctx := context.Background()
require.NoError(t, updateOption(ctx, model.OpenFlareOption{Key: "Notice", Value: "hello"}))
notice, err := getNotice(ctx)
require.NoError(t, err)
assert.Equal(t, "hello", notice)
}
func TestLookupGeoIPDisabledProvider(t *testing.T) {
cleanup := setupOptionTestDB(t)
defer cleanup()
-17
View File
@@ -32,23 +32,6 @@ func GetStatusHandler(c *gin.Context) {
c.JSON(http.StatusOK, response.OK(view))
}
// GetNoticeHandler 获取系统公告。
// @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/notice [get]
func GetNoticeHandler(c *gin.Context) {
notice, err := getNotice(c.Request.Context())
if apiutil.AbortBadRequestOnError(c, err) {
return
}
c.JSON(http.StatusOK, response.OK(notice))
}
// ListOptionsHandler 列出全部配置项。
// @Summary 列出 OpenFlare 配置项
// @Description 返回全部非敏感 OpenFlare 配置项,需要管理员权限
@@ -0,0 +1,5 @@
-- +goose Up
DELETE FROM of_options WHERE key = 'Notice';
-- +goose Down
INSERT OR IGNORE INTO of_options (key, value) VALUES ('Notice', '');
@@ -0,0 +1,5 @@
-- +goose Up
DELETE FROM of_options WHERE key = 'Notice';
-- +goose Down
INSERT OR IGNORE INTO of_options (key, value) VALUES ('Notice', '');
-1
View File
@@ -159,7 +159,6 @@ func DefaultOpenFlareOptions() map[string]string {
"SMTPPort": strconv.Itoa(SMTPPort),
"SMTPAccount": "",
"SMTPToken": "",
"Notice": "",
"About": "",
"Footer": Footer,
"HomePageLink": HomePageLink,
@@ -11,7 +11,6 @@ import (
func registerOptionRoutes(apiGroup *gin.RouterGroup) {
apiGroup.GET("/status", option.GetStatusHandler)
apiGroup.GET("/notice", option.GetNoticeHandler)
optionRoute := apiGroup.Group("/option")
optionRoute.Use(apiutil.AdminMiddlewares()...)