mirror of https://gitee.com/answerdev/answer.git
Merge remote-tracking branch 'origin/feat/0.6.0/seo' into test
This commit is contained in:
commit
667414a75b
|
@ -9,6 +9,7 @@
|
|||
/.fleet
|
||||
/.vscode/*.log
|
||||
/cmd/answer/*.sh
|
||||
/cmd/answer/answer
|
||||
/cmd/answer/uploads/*
|
||||
/cmd/logs
|
||||
/configs/config-dev.yaml
|
||||
|
|
|
@ -4,3 +4,4 @@ import _ "embed"
|
|||
|
||||
//go:embed config.yaml
|
||||
var Config []byte
|
||||
var PathIgnore []byte
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# url path reserves the keywords list
|
||||
users:
|
||||
- settings
|
||||
- login
|
||||
- register
|
||||
- account-recovery
|
||||
- change-email
|
||||
- password-reset
|
||||
- account-activation
|
||||
- confirm-new-email
|
||||
- account-suspended
|
|
@ -5724,6 +5724,10 @@ const docTemplate = `{
|
|||
"description": "created time",
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"description": "description text",
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"description": "display name",
|
||||
"type": "string"
|
||||
|
|
|
@ -5712,6 +5712,10 @@
|
|||
"description": "created time",
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"description": "description text",
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"description": "display name",
|
||||
"type": "string"
|
||||
|
|
|
@ -650,6 +650,9 @@ definitions:
|
|||
created_at:
|
||||
description: created time
|
||||
type: integer
|
||||
description:
|
||||
description: description text
|
||||
type: string
|
||||
display_name:
|
||||
description: display name
|
||||
type: string
|
||||
|
|
|
@ -19,14 +19,14 @@ backend:
|
|||
other: "User"
|
||||
admin:
|
||||
other: "Admin"
|
||||
Moderator:
|
||||
moderator:
|
||||
other: "Moderator"
|
||||
description:
|
||||
user:
|
||||
other: "Default with no special access."
|
||||
admin:
|
||||
other: "Have the full power to access the site."
|
||||
Moderator:
|
||||
moderator:
|
||||
other: "Has access to all posts except admin settings."
|
||||
|
||||
email:
|
||||
|
|
|
@ -3,6 +3,7 @@ package controller
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/answerdev/answer/internal/base/constant"
|
||||
"github.com/answerdev/answer/internal/base/handler"
|
||||
"github.com/answerdev/answer/internal/schema"
|
||||
"github.com/answerdev/answer/internal/service/siteinfo_common"
|
||||
|
@ -78,13 +79,17 @@ func (sc *SiteinfoController) GetSiteLegalInfo(ctx *gin.Context) {
|
|||
|
||||
// GetManifestJson get manifest.json
|
||||
func (sc *SiteinfoController) GetManifestJson(ctx *gin.Context) {
|
||||
favicon := "favicon.ico"
|
||||
resp := &schema.GetManifestJsonResp{
|
||||
ShortName: "Answer",
|
||||
Name: "Answer.dev",
|
||||
ManifestVersion: 3,
|
||||
Version: constant.Version,
|
||||
ShortName: "Answer",
|
||||
Name: "Answer.dev",
|
||||
Icons: map[string]string{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon",
|
||||
"16": favicon,
|
||||
"32": favicon,
|
||||
"48": favicon,
|
||||
"128": favicon,
|
||||
},
|
||||
StartUrl: ".",
|
||||
Display: "standalone",
|
||||
|
@ -95,7 +100,10 @@ func (sc *SiteinfoController) GetManifestJson(ctx *gin.Context) {
|
|||
if err != nil {
|
||||
log.Error(err)
|
||||
} else if len(branding.Favicon) > 0 {
|
||||
resp.Icons["scr"] = branding.Favicon
|
||||
resp.Icons["16"] = branding.Favicon
|
||||
resp.Icons["32"] = branding.Favicon
|
||||
resp.Icons["48"] = branding.Favicon
|
||||
resp.Icons["128"] = branding.Favicon
|
||||
}
|
||||
ctx.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/answerdev/answer/internal/entity"
|
||||
"github.com/answerdev/answer/internal/service/permission"
|
||||
"github.com/segmentfault/pacman/log"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
|
@ -183,5 +186,27 @@ func addRoleFeatures(x *xorm.Engine) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfigTable := []*entity.Config{
|
||||
{ID: 115, Key: "rank.question.close", Value: `-1`},
|
||||
{ID: 116, Key: "rank.question.reopen", Value: `-1`},
|
||||
}
|
||||
for _, c := range defaultConfigTable {
|
||||
exist, err := x.Get(&entity.Config{ID: c.ID, Key: c.Key})
|
||||
if err != nil {
|
||||
return fmt.Errorf("get config failed: %w", err)
|
||||
}
|
||||
if exist {
|
||||
if _, err = x.Update(c, &entity.Config{ID: c.ID, Key: c.Key}); err != nil {
|
||||
log.Errorf("update %+v config failed: %s", c, err)
|
||||
return fmt.Errorf("update config failed: %w", err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if _, err = x.Insert(&entity.Config{ID: c.ID, Key: c.Key, Value: c.Value}); err != nil {
|
||||
log.Errorf("insert %+v config failed: %s", c, err)
|
||||
return fmt.Errorf("add config failed: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -143,6 +143,8 @@ type GetSMTPConfigResp struct {
|
|||
|
||||
// GetManifestJsonResp get manifest json response
|
||||
type GetManifestJsonResp struct {
|
||||
ManifestVersion int `json:"manifest_version"`
|
||||
Version string `json:"version"`
|
||||
ShortName string `json:"short_name"`
|
||||
Name string `json:"name"`
|
||||
Icons map[string]string `json:"icons"`
|
||||
|
|
Loading…
Reference in New Issue