mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 07:06:36 +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:
@@ -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()...)
|
||||
|
||||
Reference in New Issue
Block a user