Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: add advanced site settings and related API endpoints

LinkinStarsa5edc4fc013f
diff --git a/docs/docs.go b/docs/docs.go
index 9c984d26..57a23d43 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1393,6 +1393,77 @@ const docTemplate = `{
}
}
},
+ "/answer/admin/api/siteinfo/advanced": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get site advanced setting",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get site advanced setting",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteAdvancedResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update site advanced info",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update site advanced info",
+ "parameters": [
+ {
+ "description": "advanced settings",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteAdvancedReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/siteinfo/branding": {
"get": {
"security": [
@@ -1633,7 +1704,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteInterfaceResp"
+ "$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
}
}
}
@@ -1677,21 +1748,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/legal": {
+ "/answer/admin/api/siteinfo/login": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Set the legal information for the site",
+ "description": "get site info login config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "Set the legal information for the site",
+ "summary": "get site info login config",
"responses": {
"200": {
"description": "OK",
@@ -1704,7 +1775,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteLegalResp"
+ "$ref": "#/definitions/schema.SiteLoginResp"
}
}
}
@@ -1719,22 +1790,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site legal info",
+ "description": "update site login",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site legal info",
+ "summary": "update site login",
"parameters": [
{
- "description": "write info",
+ "description": "login info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteLegalReq"
+ "$ref": "#/definitions/schema.SiteLoginReq"
}
}
],
@@ -1748,21 +1819,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/login": {
+ "/answer/admin/api/siteinfo/polices": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site info login config",
+ "description": "Get the policies information for the site",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site info login config",
+ "summary": "Get the policies information for the site",
"responses": {
"200": {
"description": "OK",
@@ -1775,7 +1846,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteLoginResp"
+ "$ref": "#/definitions/schema.SitePoliciesResp"
}
}
}
@@ -1790,22 +1861,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site login",
+ "description": "update site policies configuration",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site login",
+ "summary": "update site policies configuration",
"parameters": [
{
- "description": "login info",
+ "description": "write info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteLoginReq"
+ "$ref": "#/definitions/schema.SitePoliciesReq"
}
}
],
@@ -1819,21 +1890,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/seo": {
+ "/answer/admin/api/siteinfo/question": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site seo information",
+ "description": "get site questions setting",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site seo information",
+ "summary": "get site questions setting",
"responses": {
"200": {
"description": "OK",
@@ -1846,7 +1917,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteSeoResp"
+ "$ref": "#/definitions/schema.SiteQuestionsResp"
}
}
}
@@ -1861,22 +1932,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site seo information",
+ "description": "update site question settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site seo information",
+ "summary": "update site question settings",
"parameters": [
{
- "description": "seo",
+ "description": "questions settings",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteSeoReq"
+ "$ref": "#/definitions/schema.SiteQuestionsReq"
}
}
],
@@ -1890,21 +1961,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/theme": {
+ "/answer/admin/api/siteinfo/security": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site info theme config",
+ "description": "Get the security information for the site",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site info theme config",
+ "summary": "Get the security information for the site",
"responses": {
"200": {
"description": "OK",
@@ -1917,7 +1988,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteThemeResp"
+ "$ref": "#/definitions/schema.SiteSecurityResp"
}
}
}
@@ -1932,22 +2003,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site custom css html config",
+ "description": "update site security configuration",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site custom css html config",
+ "summary": "update site security configuration",
"parameters": [
{
- "description": "login info",
+ "description": "write info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteThemeReq"
+ "$ref": "#/definitions/schema.SiteSecurityReq"
}
}
],
@@ -1961,21 +2032,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/users": {
+ "/answer/admin/api/siteinfo/seo": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site user config",
+ "description": "get site seo information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site user config",
+ "summary": "get site seo information",
"responses": {
"200": {
"description": "OK",
@@ -1988,7 +2059,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteUsersResp"
+ "$ref": "#/definitions/schema.SiteSeoResp"
}
}
}
@@ -2003,22 +2074,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site info config about users",
+ "description": "update site seo information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site info config about users",
+ "summary": "update site seo information",
"parameters": [
{
- "description": "users info",
+ "description": "seo",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteUsersReq"
+ "$ref": "#/definitions/schema.SiteSeoReq"
}
}
],
@@ -2032,21 +2103,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/siteinfo/write": {
+ "/answer/admin/api/siteinfo/tag": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site interface",
+ "description": "get site tags setting",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site interface",
+ "summary": "get site tags setting",
"responses": {
"200": {
"description": "OK",
@@ -2059,7 +2130,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteWriteResp"
+ "$ref": "#/definitions/schema.SiteTagsResp"
}
}
}
@@ -2074,22 +2145,22 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "update site write info",
+ "description": "update site tag settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site write info",
+ "summary": "update site tag settings",
"parameters": [
{
- "description": "write info",
+ "description": "tags settings",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteWriteReq"
+ "$ref": "#/definitions/schema.SiteTagsReq"
}
}
],
@@ -2103,57 +2174,64 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/theme/options": {
+ "/answer/admin/api/siteinfo/theme": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get theme options",
+ "description": "get site info theme config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "Get theme options",
+ "summary": "get site info theme config",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteThemeResp"
+ }
+ }
+ }
+ ]
}
}
}
- }
- },
- "/answer/admin/api/user": {
- "post": {
+ },
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add user",
- "consumes": [
- "application/json"
- ],
+ "description": "update site custom css html config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "add user",
+ "summary": "update site custom css html config",
"parameters": [
{
- "description": "user",
+ "description": "login info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.AddUserReq"
+ "$ref": "#/definitions/schema.SiteThemeReq"
}
}
],
@@ -2167,30 +2245,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/user/activation": {
+ "/answer/admin/api/siteinfo/users": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get user activation",
+ "description": "get site user config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get user activation",
- "parameters": [
- {
- "type": "string",
- "description": "user id",
- "name": "user_id",
- "in": "query",
- "required": true
- }
- ],
+ "summary": "get site user config",
"responses": {
"200": {
"description": "OK",
@@ -2203,7 +2272,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.GetUserActivationResp"
+ "$ref": "#/definitions/schema.SiteUsersResp"
}
}
}
@@ -2211,34 +2280,29 @@ const docTemplate = `{
}
}
}
- }
- },
- "/answer/admin/api/user/password": {
+ },
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user password",
- "consumes": [
- "application/json"
- ],
+ "description": "update site info config about users",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user password",
+ "summary": "update site info config about users",
"parameters": [
{
- "description": "user",
+ "description": "users info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.UpdateUserPasswordReq"
+ "$ref": "#/definitions/schema.SiteUsersReq"
}
}
],
@@ -2252,71 +2316,64 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/user/profile": {
- "put": {
+ "/answer/admin/api/siteinfo/users-settings": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "edit user profile",
- "consumes": [
- "application/json"
- ],
+ "description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "edit user profile",
- "parameters": [
- {
- "description": "user",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.EditUserProfileReq"
- }
- }
- ],
+ "summary": "get site interface",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteUsersSettingsResp"
+ }
+ }
+ }
+ ]
}
}
}
- }
- },
- "/answer/admin/api/user/role": {
+ },
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user role",
- "consumes": [
- "application/json"
- ],
+ "description": "update site info users settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user role",
+ "summary": "update site info users settings",
"parameters": [
{
- "description": "user",
+ "description": "general",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.UpdateUserRoleReq"
+ "$ref": "#/definitions/schema.SiteUsersSettingsReq"
}
}
],
@@ -2330,35 +2387,21 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/user/status": {
- "put": {
+ "/answer/admin/api/theme/options": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user",
- "consumes": [
- "application/json"
- ],
+ "description": "Get theme options",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user",
- "parameters": [
- {
- "description": "user",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.UpdateUserStatusReq"
- }
- }
- ],
+ "summary": "Get theme options",
"responses": {
"200": {
"description": "OK",
@@ -2369,7 +2412,248 @@ const docTemplate = `{
}
}
},
- "/answer/admin/api/users": {
+ "/answer/admin/api/user": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "add user",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "add user",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AddUserReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/activation": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get user activation",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get user activation",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "user id",
+ "name": "user_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetUserActivationResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/password": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user password",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user password",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserPasswordReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/profile": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "edit user profile",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "edit user profile",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.EditUserProfileReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/role": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user role",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user role",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserRoleReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/status": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserStatusReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/users": {
"post": {
"security": [
{
@@ -11480,19 +11764,71 @@ const docTemplate = `{
}
}
},
- "schema.SiteBrandingReq": {
+ "schema.SiteAdvancedReq": {
"type": "object",
"properties": {
- "favicon": {
- "type": "string",
- "maxLength": 512
- },
- "logo": {
- "type": "string",
- "maxLength": 512
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
- "mobile_logo": {
- "type": "string",
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.SiteAdvancedResp": {
+ "type": "object",
+ "properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.SiteBrandingReq": {
+ "type": "object",
+ "properties": {
+ "favicon": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "logo": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "mobile_logo": {
+ "type": "string",
"maxLength": 512
},
"square_icon": {
@@ -11580,9 +11916,6 @@ const docTemplate = `{
"site_url"
],
"properties": {
- "check_update": {
- "type": "boolean"
- },
"contact_email": {
"type": "string",
"maxLength": 512
@@ -11613,9 +11946,6 @@ const docTemplate = `{
"site_url"
],
"properties": {
- "check_update": {
- "type": "boolean"
- },
"contact_email": {
"type": "string",
"maxLength": 512
@@ -11654,7 +11984,7 @@ const docTemplate = `{
"$ref": "#/definitions/schema.SiteGeneralResp"
},
"interface": {
- "$ref": "#/definitions/schema.SiteInterfaceResp"
+ "$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
},
"login": {
"$ref": "#/definitions/schema.SiteLoginResp"
@@ -11665,21 +11995,33 @@ const docTemplate = `{
"revision": {
"type": "string"
},
+ "site_advanced": {
+ "$ref": "#/definitions/schema.SiteAdvancedResp"
+ },
"site_legal": {
"$ref": "#/definitions/schema.SiteLegalSimpleResp"
},
+ "site_questions": {
+ "$ref": "#/definitions/schema.SiteQuestionsResp"
+ },
+ "site_security": {
+ "$ref": "#/definitions/schema.SiteSecurityResp"
+ },
"site_seo": {
"$ref": "#/definitions/schema.SiteSeoResp"
},
+ "site_tags": {
+ "$ref": "#/definitions/schema.SiteTagsResp"
+ },
"site_users": {
"$ref": "#/definitions/schema.SiteUsersResp"
},
- "site_write": {
- "$ref": "#/definitions/schema.SiteWriteResp"
- },
"theme": {
"$ref": "#/definitions/schema.SiteThemeResp"
},
+ "users_settings": {
+ "$ref": "#/definitions/schema.SiteUsersSettingsResp"
+ },
"version": {
"type": "string"
}
@@ -11688,21 +12030,10 @@ const docTemplate = `{
"schema.SiteInterfaceReq": {
"type": "object",
"required": [
- "default_avatar",
"language",
"time_zone"
],
"properties": {
- "default_avatar": {
- "type": "string",
- "enum": [
- "system",
- "gravatar"
- ]
- },
- "gravatar_base_url": {
- "type": "string"
- },
"language": {
"type": "string",
"maxLength": 128
@@ -11713,24 +12044,13 @@ const docTemplate = `{
}
}
},
- "schema.SiteInterfaceResp": {
+ "schema.SiteInterfaceSettingsResp": {
"type": "object",
"required": [
- "default_avatar",
"language",
"time_zone"
],
"properties": {
- "default_avatar": {
- "type": "string",
- "enum": [
- "system",
- "gravatar"
- ]
- },
- "gravatar_base_url": {
- "type": "string"
- },
"language": {
"type": "string",
"maxLength": 128
@@ -11741,60 +12061,6 @@ const docTemplate = `{
}
}
},
- "schema.SiteLegalReq": {
- "type": "object",
- "required": [
- "external_content_display"
- ],
- "properties": {
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "privacy_policy_original_text": {
- "type": "string"
- },
- "privacy_policy_parsed_text": {
- "type": "string"
- },
- "terms_of_service_original_text": {
- "type": "string"
- },
- "terms_of_service_parsed_text": {
- "type": "string"
- }
- }
- },
- "schema.SiteLegalResp": {
- "type": "object",
- "required": [
- "external_content_display"
- ],
- "properties": {
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "privacy_policy_original_text": {
- "type": "string"
- },
- "privacy_policy_parsed_text": {
- "type": "string"
- },
- "terms_of_service_original_text": {
- "type": "string"
- },
- "terms_of_service_parsed_text": {
- "type": "string"
- }
- }
- },
"schema.SiteLegalSimpleResp": {
"type": "object",
"required": [
@@ -11827,9 +12093,6 @@ const docTemplate = `{
},
"allow_password_login": {
"type": "boolean"
- },
- "login_required": {
- "type": "boolean"
}
}
},
@@ -11850,9 +12113,6 @@ const docTemplate = `{
},
"allow_password_login": {
"type": "boolean"
- },
- "login_required": {
- "type": "boolean"
}
}
},
@@ -11881,6 +12141,118 @@ const docTemplate = `{
}
}
},
+ "schema.SitePoliciesReq": {
+ "type": "object",
+ "properties": {
+ "privacy_policy_original_text": {
+ "type": "string"
+ },
+ "privacy_policy_parsed_text": {
+ "type": "string"
+ },
+ "terms_of_service_original_text": {
+ "type": "string"
+ },
+ "terms_of_service_parsed_text": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.SitePoliciesResp": {
+ "type": "object",
+ "properties": {
+ "privacy_policy_original_text": {
+ "type": "string"
+ },
+ "privacy_policy_parsed_text": {
+ "type": "string"
+ },
+ "terms_of_service_original_text": {
+ "type": "string"
+ },
+ "terms_of_service_parsed_text": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.SiteQuestionsReq": {
+ "type": "object",
+ "properties": {
+ "min_content": {
+ "type": "integer",
+ "maximum": 65535,
+ "minimum": 0
+ },
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
+ "restrict_answer": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteQuestionsResp": {
+ "type": "object",
+ "properties": {
+ "min_content": {
+ "type": "integer",
+ "maximum": 65535,
+ "minimum": 0
+ },
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
+ "restrict_answer": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteSecurityReq": {
+ "type": "object",
+ "required": [
+ "external_content_display"
+ ],
+ "properties": {
+ "check_update": {
+ "type": "boolean"
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "login_required": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteSecurityResp": {
+ "type": "object",
+ "required": [
+ "external_content_display"
+ ],
+ "properties": {
+ "check_update": {
+ "type": "boolean"
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "login_required": {
+ "type": "boolean"
+ }
+ }
+ },
"schema.SiteSeoReq": {
"type": "object",
"required": [
@@ -11915,6 +12287,46 @@ const docTemplate = `{
}
}
},
+ "schema.SiteTagsReq": {
+ "type": "object",
+ "properties": {
+ "recommend_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ },
+ "required_tag": {
+ "type": "boolean"
+ },
+ "reserved_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ }
+ }
+ },
+ "schema.SiteTagsResp": {
+ "type": "object",
+ "properties": {
+ "recommend_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ },
+ "required_tag": {
+ "type": "boolean"
+ },
+ "reserved_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ }
+ }
+ },
"schema.SiteThemeReq": {
"type": "object",
"required": [
@@ -12038,111 +12450,39 @@ const docTemplate = `{
}
}
},
- "schema.SiteWriteReq": {
+ "schema.SiteUsersSettingsReq": {
"type": "object",
+ "required": [
+ "default_avatar"
+ ],
"properties": {
- "authorized_attachment_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "authorized_image_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "max_attachment_size": {
- "type": "integer"
- },
- "max_image_megapixel": {
- "type": "integer"
- },
- "max_image_size": {
- "type": "integer"
- },
- "min_content": {
- "type": "integer",
- "maximum": 65535,
- "minimum": 0
- },
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
- "recommend_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
- },
- "required_tag": {
- "type": "boolean"
- },
- "reserved_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
+ "default_avatar": {
+ "type": "string",
+ "enum": [
+ "system",
+ "gravatar"
+ ]
},
- "restrict_answer": {
- "type": "boolean"
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
- "schema.SiteWriteResp": {
+ "schema.SiteUsersSettingsResp": {
"type": "object",
+ "required": [
+ "default_avatar"
+ ],
"properties": {
- "authorized_attachment_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "authorized_image_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "max_attachment_size": {
- "type": "integer"
- },
- "max_image_megapixel": {
- "type": "integer"
- },
- "max_image_size": {
- "type": "integer"
- },
- "min_content": {
- "type": "integer",
- "maximum": 65535,
- "minimum": 0
- },
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
- "recommend_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
- },
- "required_tag": {
- "type": "boolean"
- },
- "reserved_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
+ "default_avatar": {
+ "type": "string",
+ "enum": [
+ "system",
+ "gravatar"
+ ]
},
- "restrict_answer": {
- "type": "boolean"
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
diff --git a/docs/swagger.json b/docs/swagger.json
index 67148ea4..dac2b38f 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -1366,6 +1366,77 @@
}
}
},
+ "/answer/admin/api/siteinfo/advanced": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get site advanced setting",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get site advanced setting",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteAdvancedResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update site advanced info",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update site advanced info",
+ "parameters": [
+ {
+ "description": "advanced settings",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteAdvancedReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/siteinfo/branding": {
"get": {
"security": [
@@ -1606,7 +1677,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteInterfaceResp"
+ "$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
}
}
}
@@ -1650,21 +1721,21 @@
}
}
},
- "/answer/admin/api/siteinfo/legal": {
+ "/answer/admin/api/siteinfo/login": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Set the legal information for the site",
+ "description": "get site info login config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "Set the legal information for the site",
+ "summary": "get site info login config",
"responses": {
"200": {
"description": "OK",
@@ -1677,7 +1748,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteLegalResp"
+ "$ref": "#/definitions/schema.SiteLoginResp"
}
}
}
@@ -1692,22 +1763,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site legal info",
+ "description": "update site login",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site legal info",
+ "summary": "update site login",
"parameters": [
{
- "description": "write info",
+ "description": "login info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteLegalReq"
+ "$ref": "#/definitions/schema.SiteLoginReq"
}
}
],
@@ -1721,21 +1792,21 @@
}
}
},
- "/answer/admin/api/siteinfo/login": {
+ "/answer/admin/api/siteinfo/polices": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site info login config",
+ "description": "Get the policies information for the site",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site info login config",
+ "summary": "Get the policies information for the site",
"responses": {
"200": {
"description": "OK",
@@ -1748,7 +1819,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteLoginResp"
+ "$ref": "#/definitions/schema.SitePoliciesResp"
}
}
}
@@ -1763,22 +1834,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site login",
+ "description": "update site policies configuration",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site login",
+ "summary": "update site policies configuration",
"parameters": [
{
- "description": "login info",
+ "description": "write info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteLoginReq"
+ "$ref": "#/definitions/schema.SitePoliciesReq"
}
}
],
@@ -1792,21 +1863,21 @@
}
}
},
- "/answer/admin/api/siteinfo/seo": {
+ "/answer/admin/api/siteinfo/question": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site seo information",
+ "description": "get site questions setting",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site seo information",
+ "summary": "get site questions setting",
"responses": {
"200": {
"description": "OK",
@@ -1819,7 +1890,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteSeoResp"
+ "$ref": "#/definitions/schema.SiteQuestionsResp"
}
}
}
@@ -1834,22 +1905,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site seo information",
+ "description": "update site question settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site seo information",
+ "summary": "update site question settings",
"parameters": [
{
- "description": "seo",
+ "description": "questions settings",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteSeoReq"
+ "$ref": "#/definitions/schema.SiteQuestionsReq"
}
}
],
@@ -1863,21 +1934,21 @@
}
}
},
- "/answer/admin/api/siteinfo/theme": {
+ "/answer/admin/api/siteinfo/security": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site info theme config",
+ "description": "Get the security information for the site",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site info theme config",
+ "summary": "Get the security information for the site",
"responses": {
"200": {
"description": "OK",
@@ -1890,7 +1961,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteThemeResp"
+ "$ref": "#/definitions/schema.SiteSecurityResp"
}
}
}
@@ -1905,22 +1976,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site custom css html config",
+ "description": "update site security configuration",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site custom css html config",
+ "summary": "update site security configuration",
"parameters": [
{
- "description": "login info",
+ "description": "write info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteThemeReq"
+ "$ref": "#/definitions/schema.SiteSecurityReq"
}
}
],
@@ -1934,21 +2005,21 @@
}
}
},
- "/answer/admin/api/siteinfo/users": {
+ "/answer/admin/api/siteinfo/seo": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site user config",
+ "description": "get site seo information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site user config",
+ "summary": "get site seo information",
"responses": {
"200": {
"description": "OK",
@@ -1961,7 +2032,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteUsersResp"
+ "$ref": "#/definitions/schema.SiteSeoResp"
}
}
}
@@ -1976,22 +2047,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site info config about users",
+ "description": "update site seo information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site info config about users",
+ "summary": "update site seo information",
"parameters": [
{
- "description": "users info",
+ "description": "seo",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteUsersReq"
+ "$ref": "#/definitions/schema.SiteSeoReq"
}
}
],
@@ -2005,21 +2076,21 @@
}
}
},
- "/answer/admin/api/siteinfo/write": {
+ "/answer/admin/api/siteinfo/tag": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get site interface",
+ "description": "get site tags setting",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get site interface",
+ "summary": "get site tags setting",
"responses": {
"200": {
"description": "OK",
@@ -2032,7 +2103,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.SiteWriteResp"
+ "$ref": "#/definitions/schema.SiteTagsResp"
}
}
}
@@ -2047,22 +2118,22 @@
"ApiKeyAuth": []
}
],
- "description": "update site write info",
+ "description": "update site tag settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update site write info",
+ "summary": "update site tag settings",
"parameters": [
{
- "description": "write info",
+ "description": "tags settings",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.SiteWriteReq"
+ "$ref": "#/definitions/schema.SiteTagsReq"
}
}
],
@@ -2076,57 +2147,64 @@
}
}
},
- "/answer/admin/api/theme/options": {
+ "/answer/admin/api/siteinfo/theme": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "Get theme options",
+ "description": "get site info theme config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "Get theme options",
+ "summary": "get site info theme config",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteThemeResp"
+ }
+ }
+ }
+ ]
}
}
}
- }
- },
- "/answer/admin/api/user": {
- "post": {
+ },
+ "put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "add user",
- "consumes": [
- "application/json"
- ],
+ "description": "update site custom css html config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "add user",
+ "summary": "update site custom css html config",
"parameters": [
{
- "description": "user",
+ "description": "login info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.AddUserReq"
+ "$ref": "#/definitions/schema.SiteThemeReq"
}
}
],
@@ -2140,30 +2218,21 @@
}
}
},
- "/answer/admin/api/user/activation": {
+ "/answer/admin/api/siteinfo/users": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "get user activation",
+ "description": "get site user config",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "get user activation",
- "parameters": [
- {
- "type": "string",
- "description": "user id",
- "name": "user_id",
- "in": "query",
- "required": true
- }
- ],
+ "summary": "get site user config",
"responses": {
"200": {
"description": "OK",
@@ -2176,7 +2245,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.GetUserActivationResp"
+ "$ref": "#/definitions/schema.SiteUsersResp"
}
}
}
@@ -2184,34 +2253,29 @@
}
}
}
- }
- },
- "/answer/admin/api/user/password": {
+ },
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user password",
- "consumes": [
- "application/json"
- ],
+ "description": "update site info config about users",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user password",
+ "summary": "update site info config about users",
"parameters": [
{
- "description": "user",
+ "description": "users info",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.UpdateUserPasswordReq"
+ "$ref": "#/definitions/schema.SiteUsersReq"
}
}
],
@@ -2225,71 +2289,64 @@
}
}
},
- "/answer/admin/api/user/profile": {
- "put": {
+ "/answer/admin/api/siteinfo/users-settings": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "edit user profile",
- "consumes": [
- "application/json"
- ],
+ "description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "edit user profile",
- "parameters": [
- {
- "description": "user",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.EditUserProfileReq"
- }
- }
- ],
+ "summary": "get site interface",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteUsersSettingsResp"
+ }
+ }
+ }
+ ]
}
}
}
- }
- },
- "/answer/admin/api/user/role": {
+ },
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user role",
- "consumes": [
- "application/json"
- ],
+ "description": "update site info users settings",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user role",
+ "summary": "update site info users settings",
"parameters": [
{
- "description": "user",
+ "description": "general",
"name": "data",
"in": "body",
"required": true,
"schema": {
- "$ref": "#/definitions/schema.UpdateUserRoleReq"
+ "$ref": "#/definitions/schema.SiteUsersSettingsReq"
}
}
],
@@ -2303,35 +2360,21 @@
}
}
},
- "/answer/admin/api/user/status": {
- "put": {
+ "/answer/admin/api/theme/options": {
+ "get": {
"security": [
{
"ApiKeyAuth": []
}
],
- "description": "update user",
- "consumes": [
- "application/json"
- ],
+ "description": "Get theme options",
"produces": [
"application/json"
],
"tags": [
"admin"
],
- "summary": "update user",
- "parameters": [
- {
- "description": "user",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.UpdateUserStatusReq"
- }
- }
- ],
+ "summary": "Get theme options",
"responses": {
"200": {
"description": "OK",
@@ -2342,7 +2385,248 @@
}
}
},
- "/answer/admin/api/users": {
+ "/answer/admin/api/user": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "add user",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "add user",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AddUserReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/activation": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get user activation",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get user activation",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "user id",
+ "name": "user_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetUserActivationResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/password": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user password",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user password",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserPasswordReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/profile": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "edit user profile",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "edit user profile",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.EditUserProfileReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/role": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user role",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user role",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserRoleReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/user/status": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update user",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update user",
+ "parameters": [
+ {
+ "description": "user",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateUserStatusReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/users": {
"post": {
"security": [
{
@@ -11453,19 +11737,71 @@
}
}
},
- "schema.SiteBrandingReq": {
+ "schema.SiteAdvancedReq": {
"type": "object",
"properties": {
- "favicon": {
- "type": "string",
- "maxLength": 512
- },
- "logo": {
- "type": "string",
- "maxLength": 512
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
- "mobile_logo": {
- "type": "string",
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.SiteAdvancedResp": {
+ "type": "object",
+ "properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.SiteBrandingReq": {
+ "type": "object",
+ "properties": {
+ "favicon": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "logo": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "mobile_logo": {
+ "type": "string",
"maxLength": 512
},
"square_icon": {
@@ -11553,9 +11889,6 @@
"site_url"
],
"properties": {
- "check_update": {
- "type": "boolean"
- },
"contact_email": {
"type": "string",
"maxLength": 512
@@ -11586,9 +11919,6 @@
"site_url"
],
"properties": {
- "check_update": {
- "type": "boolean"
- },
"contact_email": {
"type": "string",
"maxLength": 512
@@ -11627,7 +11957,7 @@
"$ref": "#/definitions/schema.SiteGeneralResp"
},
"interface": {
- "$ref": "#/definitions/schema.SiteInterfaceResp"
+ "$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
},
"login": {
"$ref": "#/definitions/schema.SiteLoginResp"
@@ -11638,21 +11968,33 @@
"revision": {
"type": "string"
},
+ "site_advanced": {
+ "$ref": "#/definitions/schema.SiteAdvancedResp"
+ },
"site_legal": {
"$ref": "#/definitions/schema.SiteLegalSimpleResp"
},
+ "site_questions": {
+ "$ref": "#/definitions/schema.SiteQuestionsResp"
+ },
+ "site_security": {
+ "$ref": "#/definitions/schema.SiteSecurityResp"
+ },
"site_seo": {
"$ref": "#/definitions/schema.SiteSeoResp"
},
+ "site_tags": {
+ "$ref": "#/definitions/schema.SiteTagsResp"
+ },
"site_users": {
"$ref": "#/definitions/schema.SiteUsersResp"
},
- "site_write": {
- "$ref": "#/definitions/schema.SiteWriteResp"
- },
"theme": {
"$ref": "#/definitions/schema.SiteThemeResp"
},
+ "users_settings": {
+ "$ref": "#/definitions/schema.SiteUsersSettingsResp"
+ },
"version": {
"type": "string"
}
@@ -11661,21 +12003,10 @@
"schema.SiteInterfaceReq": {
"type": "object",
"required": [
- "default_avatar",
"language",
"time_zone"
],
"properties": {
- "default_avatar": {
- "type": "string",
- "enum": [
- "system",
- "gravatar"
- ]
- },
- "gravatar_base_url": {
- "type": "string"
- },
"language": {
"type": "string",
"maxLength": 128
@@ -11686,24 +12017,13 @@
}
}
},
- "schema.SiteInterfaceResp": {
+ "schema.SiteInterfaceSettingsResp": {
"type": "object",
"required": [
- "default_avatar",
"language",
"time_zone"
],
"properties": {
- "default_avatar": {
- "type": "string",
- "enum": [
- "system",
- "gravatar"
- ]
- },
- "gravatar_base_url": {
- "type": "string"
- },
"language": {
"type": "string",
"maxLength": 128
@@ -11714,60 +12034,6 @@
}
}
},
- "schema.SiteLegalReq": {
- "type": "object",
- "required": [
- "external_content_display"
- ],
- "properties": {
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "privacy_policy_original_text": {
- "type": "string"
- },
- "privacy_policy_parsed_text": {
- "type": "string"
- },
- "terms_of_service_original_text": {
- "type": "string"
- },
- "terms_of_service_parsed_text": {
- "type": "string"
- }
- }
- },
- "schema.SiteLegalResp": {
- "type": "object",
- "required": [
- "external_content_display"
- ],
- "properties": {
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "privacy_policy_original_text": {
- "type": "string"
- },
- "privacy_policy_parsed_text": {
- "type": "string"
- },
- "terms_of_service_original_text": {
- "type": "string"
- },
- "terms_of_service_parsed_text": {
- "type": "string"
- }
- }
- },
"schema.SiteLegalSimpleResp": {
"type": "object",
"required": [
@@ -11800,9 +12066,6 @@
},
"allow_password_login": {
"type": "boolean"
- },
- "login_required": {
- "type": "boolean"
}
}
},
@@ -11823,9 +12086,6 @@
},
"allow_password_login": {
"type": "boolean"
- },
- "login_required": {
- "type": "boolean"
}
}
},
@@ -11854,6 +12114,118 @@
}
}
},
+ "schema.SitePoliciesReq": {
+ "type": "object",
+ "properties": {
+ "privacy_policy_original_text": {
+ "type": "string"
+ },
+ "privacy_policy_parsed_text": {
+ "type": "string"
+ },
+ "terms_of_service_original_text": {
+ "type": "string"
+ },
+ "terms_of_service_parsed_text": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.SitePoliciesResp": {
+ "type": "object",
+ "properties": {
+ "privacy_policy_original_text": {
+ "type": "string"
+ },
+ "privacy_policy_parsed_text": {
+ "type": "string"
+ },
+ "terms_of_service_original_text": {
+ "type": "string"
+ },
+ "terms_of_service_parsed_text": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.SiteQuestionsReq": {
+ "type": "object",
+ "properties": {
+ "min_content": {
+ "type": "integer",
+ "maximum": 65535,
+ "minimum": 0
+ },
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
+ "restrict_answer": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteQuestionsResp": {
+ "type": "object",
+ "properties": {
+ "min_content": {
+ "type": "integer",
+ "maximum": 65535,
+ "minimum": 0
+ },
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
+ "restrict_answer": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteSecurityReq": {
+ "type": "object",
+ "required": [
+ "external_content_display"
+ ],
+ "properties": {
+ "check_update": {
+ "type": "boolean"
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "login_required": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteSecurityResp": {
+ "type": "object",
+ "required": [
+ "external_content_display"
+ ],
+ "properties": {
+ "check_update": {
+ "type": "boolean"
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "login_required": {
+ "type": "boolean"
+ }
+ }
+ },
"schema.SiteSeoReq": {
"type": "object",
"required": [
@@ -11888,6 +12260,46 @@
}
}
},
+ "schema.SiteTagsReq": {
+ "type": "object",
+ "properties": {
+ "recommend_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ },
+ "required_tag": {
+ "type": "boolean"
+ },
+ "reserved_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ }
+ }
+ },
+ "schema.SiteTagsResp": {
+ "type": "object",
+ "properties": {
+ "recommend_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ },
+ "required_tag": {
+ "type": "boolean"
+ },
+ "reserved_tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteWriteTag"
+ }
+ }
+ }
+ },
"schema.SiteThemeReq": {
"type": "object",
"required": [
@@ -12011,111 +12423,39 @@
}
}
},
- "schema.SiteWriteReq": {
+ "schema.SiteUsersSettingsReq": {
"type": "object",
+ "required": [
+ "default_avatar"
+ ],
"properties": {
- "authorized_attachment_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "authorized_image_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "max_attachment_size": {
- "type": "integer"
- },
- "max_image_megapixel": {
- "type": "integer"
- },
- "max_image_size": {
- "type": "integer"
- },
- "min_content": {
- "type": "integer",
- "maximum": 65535,
- "minimum": 0
- },
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
- "recommend_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
- },
- "required_tag": {
- "type": "boolean"
- },
- "reserved_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
+ "default_avatar": {
+ "type": "string",
+ "enum": [
+ "system",
+ "gravatar"
+ ]
},
- "restrict_answer": {
- "type": "boolean"
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
- "schema.SiteWriteResp": {
+ "schema.SiteUsersSettingsResp": {
"type": "object",
+ "required": [
+ "default_avatar"
+ ],
"properties": {
- "authorized_attachment_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "authorized_image_extensions": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "max_attachment_size": {
- "type": "integer"
- },
- "max_image_megapixel": {
- "type": "integer"
- },
- "max_image_size": {
- "type": "integer"
- },
- "min_content": {
- "type": "integer",
- "maximum": 65535,
- "minimum": 0
- },
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
- "recommend_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
- },
- "required_tag": {
- "type": "boolean"
- },
- "reserved_tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.SiteWriteTag"
- }
+ "default_avatar": {
+ "type": "string",
+ "enum": [
+ "system",
+ "gravatar"
+ ]
},
- "restrict_answer": {
- "type": "boolean"
+ "gravatar_base_url": {
+ "type": "string"
}
}
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 03e3508b..7a7adb68 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -2285,6 +2285,40 @@ definitions:
prompt_config:
$ref: '#/definitions/schema.AIPromptConfig'
type: object
+ schema.SiteAdvancedReq:
+ properties:
+ authorized_attachment_extensions:
+ items:
+ type: string
+ type: array
+ authorized_image_extensions:
+ items:
+ type: string
+ type: array
+ max_attachment_size:
+ type: integer
+ max_image_megapixel:
+ type: integer
+ max_image_size:
+ type: integer
+ type: object
+ schema.SiteAdvancedResp:
+ properties:
+ authorized_attachment_extensions:
+ items:
+ type: string
+ type: array
+ authorized_image_extensions:
+ items:
+ type: string
+ type: array
+ max_attachment_size:
+ type: integer
+ max_image_megapixel:
+ type: integer
+ max_image_size:
+ type: integer
+ type: object
schema.SiteBrandingReq:
properties:
favicon:
@@ -2353,8 +2387,6 @@ definitions:
type: object
schema.SiteGeneralReq:
properties:
- check_update:
- type: boolean
contact_email:
maxLength: 512
type: string
@@ -2377,8 +2409,6 @@ definitions:
type: object
schema.SiteGeneralResp:
properties:
- check_update:
- type: boolean
contact_email:
maxLength: 512
type: string
@@ -2410,35 +2440,36 @@ definitions:
general:
$ref: '#/definitions/schema.SiteGeneralResp'
interface:
- $ref: '#/definitions/schema.SiteInterfaceResp'
+ $ref: '#/definitions/schema.SiteInterfaceSettingsResp'
login:
$ref: '#/definitions/schema.SiteLoginResp'
mcp_enabled:
type: boolean
revision:
type: string
+ site_advanced:
+ $ref: '#/definitions/schema.SiteAdvancedResp'
site_legal:
$ref: '#/definitions/schema.SiteLegalSimpleResp'
+ site_questions:
+ $ref: '#/definitions/schema.SiteQuestionsResp'
+ site_security:
+ $ref: '#/definitions/schema.SiteSecurityResp'
site_seo:
$ref: '#/definitions/schema.SiteSeoResp'
+ site_tags:
+ $ref: '#/definitions/schema.SiteTagsResp'
site_users:
$ref: '#/definitions/schema.SiteUsersResp'
- site_write:
- $ref: '#/definitions/schema.SiteWriteResp'
theme:
$ref: '#/definitions/schema.SiteThemeResp'
+ users_settings:
+ $ref: '#/definitions/schema.SiteUsersSettingsResp'
version:
type: string
type: object
schema.SiteInterfaceReq:
properties:
- default_avatar:
- enum:
- - system
- - gravatar
- type: string
- gravatar_base_url:
- type: string
language:
maxLength: 128
type: string
@@ -2446,19 +2477,11 @@ definitions:
maxLength: 128
type: string
required:
- - default_avatar
- language
- time_zone
type: object
- schema.SiteInterfaceResp:
+ schema.SiteInterfaceSettingsResp:
properties:
- default_avatar:
- enum:
- - system
- - gravatar
- type: string
- gravatar_base_url:
- type: string
language:
maxLength: 128
type: string
@@ -2466,46 +2489,9 @@ definitions:
maxLength: 128
type: string
required:
- - default_avatar
- language
- time_zone
type: object
- schema.SiteLegalReq:
- properties:
- external_content_display:
- enum:
- - always_display
- - ask_before_display
- type: string
- privacy_policy_original_text:
- type: string
- privacy_policy_parsed_text:
- type: string
- terms_of_service_original_text:
- type: string
- terms_of_service_parsed_text:
- type: string
- required:
- - external_content_display
- type: object
- schema.SiteLegalResp:
- properties:
- external_content_display:
- enum:
- - always_display
- - ask_before_display
- type: string
- privacy_policy_original_text:
- type: string
- privacy_policy_parsed_text:
- type: string
- terms_of_service_original_text:
- type: string
- terms_of_service_parsed_text:
- type: string
- required:
- - external_content_display
- type: object
schema.SiteLegalSimpleResp:
properties:
external_content_display:
@@ -2528,8 +2514,6 @@ definitions:
type: boolean
allow_password_login:
type: boolean
- login_required:
- type: boolean
type: object
schema.SiteLoginResp:
properties:
@@ -2543,8 +2527,6 @@ definitions:
type: boolean
allow_password_login:
type: boolean
- login_required:
- type: boolean
type: object
schema.SiteMCPReq:
properties:
@@ -2562,6 +2544,82 @@ definitions:
url:
type: string
type: object
+ schema.SitePoliciesReq:
+ properties:
+ privacy_policy_original_text:
+ type: string
+ privacy_policy_parsed_text:
+ type: string
+ terms_of_service_original_text:
+ type: string
+ terms_of_service_parsed_text:
+ type: string
+ type: object
+ schema.SitePoliciesResp:
+ properties:
+ privacy_policy_original_text:
+ type: string
+ privacy_policy_parsed_text:
+ type: string
+ terms_of_service_original_text:
+ type: string
+ terms_of_service_parsed_text:
+ type: string
+ type: object
+ schema.SiteQuestionsReq:
+ properties:
+ min_content:
+ maximum: 65535
+ minimum: 0
+ type: integer
+ min_tags:
+ maximum: 5
+ minimum: 0
+ type: integer
+ restrict_answer:
+ type: boolean
+ type: object
+ schema.SiteQuestionsResp:
+ properties:
+ min_content:
+ maximum: 65535
+ minimum: 0
+ type: integer
+ min_tags:
+ maximum: 5
+ minimum: 0
+ type: integer
+ restrict_answer:
+ type: boolean
+ type: object
+ schema.SiteSecurityReq:
+ properties:
+ check_update:
+ type: boolean
+ external_content_display:
+ enum:
+ - always_display
+ - ask_before_display
+ type: string
+ login_required:
+ type: boolean
+ required:
+ - external_content_display
+ type: object
+ schema.SiteSecurityResp:
+ properties:
+ check_update:
+ type: boolean
+ external_content_display:
+ enum:
+ - always_display
+ - ask_before_display
+ type: string
+ login_required:
+ type: boolean
+ required:
+ - external_content_display
+ type: object
schema.SiteSeoReq:
properties:
permalink:
@@ -2586,6 +2644,32 @@ definitions:
- permalink
- robots
type: object
+ schema.SiteTagsReq:
+ properties:
+ recommend_tags:
+ items:
+ $ref: '#/definitions/schema.SiteWriteTag'
+ type: array
+ required_tag:
+ type: boolean
+ reserved_tags:
+ items:
+ $ref: '#/definitions/schema.SiteWriteTag'
+ type: array
+ type: object
+ schema.SiteTagsResp:
+ properties:
+ recommend_tags:
+ items:
+ $ref: '#/definitions/schema.SiteWriteTag'
+ type: array
+ required_tag:
+ type: boolean
+ reserved_tags:
+ items:
+ $ref: '#/definitions/schema.SiteWriteTag'
+ type: array
+ type: object
schema.SiteThemeReq:
properties:
color_scheme:
@@ -2669,79 +2753,29 @@ definitions:
required:
- default_avatar
type: object
- schema.SiteWriteReq:
+ schema.SiteUsersSettingsReq:
properties:
- authorized_attachment_extensions:
- items:
- type: string
- type: array
- authorized_image_extensions:
- items:
- type: string
- type: array
- max_attachment_size:
- type: integer
- max_image_megapixel:
- type: integer
- max_image_size:
- type: integer
- min_content:
- maximum: 65535
- minimum: 0
- type: integer
- min_tags:
- maximum: 5
- minimum: 0
- type: integer
- recommend_tags:
- items:
- $ref: '#/definitions/schema.SiteWriteTag'
- type: array
- required_tag:
- type: boolean
- reserved_tags:
- items:
- $ref: '#/definitions/schema.SiteWriteTag'
- type: array
- restrict_answer:
- type: boolean
+ default_avatar:
+ enum:
+ - system
+ - gravatar
+ type: string
+ gravatar_base_url:
+ type: string
+ required:
+ - default_avatar
type: object
- schema.SiteWriteResp:
+ schema.SiteUsersSettingsResp:
properties:
- authorized_attachment_extensions:
- items:
- type: string
- type: array
- authorized_image_extensions:
- items:
- type: string
- type: array
- max_attachment_size:
- type: integer
- max_image_megapixel:
- type: integer
- max_image_size:
- type: integer
- min_content:
- maximum: 65535
- minimum: 0
- type: integer
- min_tags:
- maximum: 5
- minimum: 0
- type: integer
- recommend_tags:
- items:
- $ref: '#/definitions/schema.SiteWriteTag'
- type: array
- required_tag:
- type: boolean
- reserved_tags:
- items:
- $ref: '#/definitions/schema.SiteWriteTag'
- type: array
- restrict_answer:
- type: boolean
+ default_avatar:
+ enum:
+ - system
+ - gravatar
+ type: string
+ gravatar_base_url:
+ type: string
+ required:
+ - default_avatar
type: object
schema.SiteWriteTag:
properties:
@@ -4253,6 +4287,47 @@ paths:
summary: update smtp config
tags:
- admin
+ /answer/admin/api/siteinfo/advanced:
+ get:
+ description: get site advanced setting
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteAdvancedResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get site advanced setting
+ tags:
+ - admin
+ put:
+ description: update site advanced info
+ parameters:
+ - description: advanced settings
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteAdvancedReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update site advanced info
+ tags:
+ - admin
/answer/admin/api/siteinfo/branding:
get:
description: get site interface
@@ -4389,7 +4464,7 @@ paths:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
- $ref: '#/definitions/schema.SiteInterfaceResp'
+ $ref: '#/definitions/schema.SiteInterfaceSettingsResp'
type: object
security:
- ApiKeyAuth: []
@@ -4417,9 +4492,50 @@ paths:
summary: update site info interface
tags:
- admin
- /answer/admin/api/siteinfo/legal:
+ /answer/admin/api/siteinfo/login:
+ get:
+ description: get site info login config
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteLoginResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get site info login config
+ tags:
+ - admin
+ put:
+ description: update site login
+ parameters:
+ - description: login info
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteLoginReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update site login
+ tags:
+ - admin
+ /answer/admin/api/siteinfo/polices:
get:
- description: Set the legal information for the site
+ description: Get the policies information for the site
produces:
- application/json
responses:
@@ -4430,22 +4546,22 @@ paths:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
- $ref: '#/definitions/schema.SiteLegalResp'
+ $ref: '#/definitions/schema.SitePoliciesResp'
type: object
security:
- ApiKeyAuth: []
- summary: Set the legal information for the site
+ summary: Get the policies information for the site
tags:
- admin
put:
- description: update site legal info
+ description: update site policies configuration
parameters:
- description: write info
in: body
name: data
required: true
schema:
- $ref: '#/definitions/schema.SiteLegalReq'
+ $ref: '#/definitions/schema.SitePoliciesReq'
produces:
- application/json
responses:
@@ -4455,12 +4571,12 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
- summary: update site legal info
+ summary: update site policies configuration
tags:
- admin
- /answer/admin/api/siteinfo/login:
+ /answer/admin/api/siteinfo/question:
get:
- description: get site info login config
+ description: get site questions setting
produces:
- application/json
responses:
@@ -4471,22 +4587,22 @@ paths:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
- $ref: '#/definitions/schema.SiteLoginResp'
+ $ref: '#/definitions/schema.SiteQuestionsResp'
type: object
security:
- ApiKeyAuth: []
- summary: get site info login config
+ summary: get site questions setting
tags:
- admin
put:
- description: update site login
+ description: update site question settings
parameters:
- - description: login info
+ - description: questions settings
in: body
name: data
required: true
schema:
- $ref: '#/definitions/schema.SiteLoginReq'
+ $ref: '#/definitions/schema.SiteQuestionsReq'
produces:
- application/json
responses:
@@ -4496,7 +4612,48 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
- summary: update site login
+ summary: update site question settings
+ tags:
+ - admin
+ /answer/admin/api/siteinfo/security:
+ get:
+ description: Get the security information for the site
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteSecurityResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: Get the security information for the site
+ tags:
+ - admin
+ put:
+ description: update site security configuration
+ parameters:
+ - description: write info
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteSecurityReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update site security configuration
tags:
- admin
/answer/admin/api/siteinfo/seo:
@@ -4540,6 +4697,47 @@ paths:
summary: update site seo information
tags:
- admin
+ /answer/admin/api/siteinfo/tag:
+ get:
+ description: get site tags setting
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteTagsResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get site tags setting
+ tags:
+ - admin
+ put:
+ description: update site tag settings
+ parameters:
+ - description: tags settings
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteTagsReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update site tag settings
+ tags:
+ - admin
/answer/admin/api/siteinfo/theme:
get:
description: get site info theme config
@@ -4622,7 +4820,7 @@ paths:
summary: update site info config about users
tags:
- admin
- /answer/admin/api/siteinfo/write:
+ /answer/admin/api/siteinfo/users-settings:
get:
description: get site interface
produces:
@@ -4635,7 +4833,7 @@ paths:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
- $ref: '#/definitions/schema.SiteWriteResp'
+ $ref: '#/definitions/schema.SiteUsersSettingsResp'
type: object
security:
- ApiKeyAuth: []
@@ -4643,14 +4841,14 @@ paths:
tags:
- admin
put:
- description: update site write info
+ description: update site info users settings
parameters:
- - description: write info
+ - description: general
in: body
name: data
required: true
schema:
- $ref: '#/definitions/schema.SiteWriteReq'
+ $ref: '#/definitions/schema.SiteUsersSettingsReq'
produces:
- application/json
responses:
@@ -4660,7 +4858,7 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
- summary: update site write info
+ summary: update site info users settings
tags:
- admin
/answer/admin/api/theme/options:
diff --git a/internal/migrations/v32.go b/internal/migrations/v32.go
deleted file mode 100644
index 89b97047..00000000
--- a/internal/migrations/v32.go
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package migrations
-
-import (
- "context"
- "encoding/json"
- "fmt"
-
- "github.com/apache/answer/internal/base/constant"
- "github.com/apache/answer/internal/entity"
- "github.com/apache/answer/internal/schema"
- "github.com/segmentfault/pacman/log"
- "xorm.io/xorm"
-)
-
-func aiFeat(ctx context.Context, x *xorm.Engine) error {
- if err := addAIConversationTables(ctx, x); err != nil {
- return fmt.Errorf("add ai conversation tables failed: %w", err)
- }
- if err := addAPIKey(ctx, x); err != nil {
- return fmt.Errorf("add api key failed: %w", err)
- }
- log.Info("AI feature migration completed successfully")
- return nil
-}
-
-func addAIConversationTables(ctx context.Context, x *xorm.Engine) error {
- if err := x.Context(ctx).Sync(new(entity.AIConversation)); err != nil {
- return fmt.Errorf("sync ai_conversation table failed: %w", err)
- }
-
- if err := x.Context(ctx).Sync(new(entity.AIConversationRecord)); err != nil {
- return fmt.Errorf("sync ai_conversation_record table failed: %w", err)
- }
-
- return nil
-}
-
-func addAPIKey(ctx context.Context, x *xorm.Engine) error {
- err := x.Context(ctx).Sync(new(entity.APIKey))
- if err != nil {
- return err
- }
-
- defaultConfigTable := []*entity.Config{
- {ID: 10000, Key: "ai_config.provider", Value: `[{"default_api_host":"https://api.openai.com","display_name":"OpenAI","name":"openai"},{"default_api_host":"https://generativelanguage.googleapis.com","display_name":"Gemini","name":"gemini"},{"default_api_host":"https://api.anthropic.com","display_name":"Anthropic","name":"anthropic"}]`},
- }
- for _, c := range defaultConfigTable {
- exist, err := x.Context(ctx).Get(&entity.Config{Key: c.Key})
- if err != nil {
- return fmt.Errorf("get config failed: %w", err)
- }
- if exist {
- continue
- }
- if _, err = x.Context(ctx).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)
- }
- }
-
- aiSiteInfo := &entity.SiteInfo{
- Type: constant.SiteTypeAI,
- }
- exist, err := x.Context(ctx).Get(aiSiteInfo)
- if err != nil {
- return fmt.Errorf("get config failed: %w", err)
- }
- if exist {
- content := &schema.SiteAIReq{}
- _ = json.Unmarshal([]byte(aiSiteInfo.Content), content)
- content.PromptConfig = &schema.AIPromptConfig{
- ZhCN: constant.DefaultAIPromptConfigZhCN,
- EnUS: constant.DefaultAIPromptConfigEnUS,
- }
- data, _ := json.Marshal(content)
- aiSiteInfo.Content = string(data)
- _, err = x.Context(ctx).ID(aiSiteInfo.ID).Cols("content").Update(aiSiteInfo)
- if err != nil {
- return fmt.Errorf("update site info failed: %w", err)
- }
- } else {
- content := &schema.SiteAIReq{
- PromptConfig: &schema.AIPromptConfig{
- ZhCN: constant.DefaultAIPromptConfigZhCN,
- EnUS: constant.DefaultAIPromptConfigEnUS,
- },
- }
- data, _ := json.Marshal(content)
- aiSiteInfo.Content = string(data)
- aiSiteInfo.Type = constant.SiteTypeAI
- if _, err = x.Context(ctx).Insert(aiSiteInfo); err != nil {
- return fmt.Errorf("insert site info failed: %w", err)
- }
- log.Infof("insert site info %+v", aiSiteInfo)
- }
- return nil
-}