diff --git a/captcha-basic/package.json b/captcha-basic/package.json index 4e686cbf..3571a9bb 100644 --- a/captcha-basic/package.json +++ b/captcha-basic/package.json @@ -3,7 +3,7 @@ "private": true, "author": "Answer.dev", "description": "Basic for captcha", - "version": "1.0.4", + "version": "1.0.5", "files": [ "dist", "README.md" diff --git a/captcha-google-v2/package.json b/captcha-google-v2/package.json index 74392836..fec2bb28 100644 --- a/captcha-google-v2/package.json +++ b/captcha-google-v2/package.json @@ -3,7 +3,7 @@ "private": true, "author": "Answer.dev", "description": "google reCaptcha v2", - "version": "1.0.4", + "version": "1.0.5", "files": [ "dist", "README.md" diff --git a/connector-wallet/package.json b/connector-wallet/package.json index 3be3a035..a213e63c 100644 --- a/connector-wallet/package.json +++ b/connector-wallet/package.json @@ -1,6 +1,6 @@ { "name": "connector-wallet", - "version": "1.0.0", + "version": "1.0.1", "description": "Connect to Web3 wallet for third-party login", "author": "Ourai L. ", "type": "module", diff --git a/editor-chart/package.json b/editor-chart/package.json index 0fbbcd54..717b448f 100644 --- a/editor-chart/package.json +++ b/editor-chart/package.json @@ -2,7 +2,7 @@ "name": "editor-chart", "private": true, "author": "Answer.dev", - "version": "1.2.10", + "version": "1.2.11", "files": [ "dist", "README.md" diff --git a/editor-formula/package.json b/editor-formula/package.json index fbbbb4ed..67ad3b6d 100644 --- a/editor-formula/package.json +++ b/editor-formula/package.json @@ -2,7 +2,7 @@ "name": "editor-formula", "private": true, "author": "Answer.dev", - "version": "1.2.13", + "version": "1.2.14", "files": [ "dist", "README.md" diff --git a/embed-basic/package.json b/embed-basic/package.json index 35e2bb68..11a686b2 100644 --- a/embed-basic/package.json +++ b/embed-basic/package.json @@ -1,6 +1,6 @@ { "name": "embed-basic", - "version": "1.1.3", + "version": "1.1.4", "description": "", "files": [ "dist", diff --git a/plugins_desc.json b/plugins_desc.json index 51e68295..eff39f2d 100644 --- a/plugins_desc.json +++ b/plugins_desc.json @@ -1,220 +1,230 @@ { - "en_US": [ + "zh_CN": [ { - "name": "Redis Cache", - "desc": "Use Redis as cache", + "name": "Redis缓存", + "desc": "使用Redis作为缓存", "link": "https://github.com/apache/answer-plugins/tree/main/cache-redis" }, { - "name": "Basic Captcha", - "desc": "Default graphic verification code", + "name": "基础验证码", + "desc": "默认图形验证码", "link": "https://github.com/apache/answer-plugins/tree/main/captcha-basic" }, { "name": "Google reCAPTCHA v2", - "desc": "Google reCAPTCHA v2 plugin", + "desc": "Google reCAPTCHA v2 插件", "link": "https://github.com/apache/answer-plugins/tree/main/captcha-google-v2" }, { - "name": "Aliyun CDN", - "desc": "Speed up your website and enjoy greatly improved loading times around the world.", + "name": "阿里云CDN", + "desc": "通过阿里云CDN提升静态资源加速", "link": "https://github.com/apache/answer-plugins/tree/main/cdn-aliyun" }, { "name": "Amazon CloudFront", - "desc": "Speed up your website and enjoy greatly improved loading times around the world.", + "desc": "通过AWS CDN提升静态资源加速", "link": "https://github.com/apache/answer-plugins/tree/main/cdn-s3" }, { - "name": "Apache Connector", - "desc": "Connect to Apache Oauth", + "name": "Apache 连接器", + "desc": "用于接入 Apache Oauth", "link": "https://github.com/apache/answer-plugins/tree/main/connector-apache" }, { - "name": "OAuth2 Basic", - "desc": "Generic OAuth2 Plugin", + "name": "通用连接器", + "desc": "适用于各种 OAuth 登录的通用插件", "link": "https://github.com/apache/answer-plugins/tree/main/connector-basic" }, { - "name": "Dingtalk Connector", - "desc": "Connect to Dingtalk for third-party login", + "name": "钉钉连接器", + "desc": "用于接入钉钉第三方登录", "link": "https://github.com/apache/answer-plugins/tree/main/connector-dingtalk" }, { - "name": "Google Connector", - "desc": "Connect to Google for third-party login", + "name": "Google 连接器", + "desc": "用于接入 Google 第三方登录", "link": "https://github.com/apache/answer-plugins/tree/main/connector-google" }, { - "name": "Wallet Connector", - "desc": "Connect to Wallet for third-party login", + "name": "Wallet 连接器", + "desc": "用于接入 Wallet 第三方登录", "link": "https://github.com/apache/answer-plugins/tree/main/connector-wallet" }, { - "name": "Chart Editor", - "desc": "Render chart in editor", + "name": "图表编辑器", + "desc": "在编辑器中渲染图表", "link": "https://github.com/apache/answer-plugins/tree/main/editor-chart" }, { - "name": "Formula Editor", - "desc": "Render formula in editor", + "name": "公式编辑器", + "desc": "在编辑器中渲染公式", "link": "https://github.com/apache/answer-plugins/tree/main/editor-formula" }, { - "name": "Embed", - "desc": "Embed content from other sites", + "name": "内容嵌入", + "desc": "在内容中嵌入其他网站", "link": "https://github.com/apache/answer-plugins/tree/main/embed-basic" }, { - "name": "Ding talk Notification", - "desc": "Send notifications to Ding Talk", + "name": "钉钉通知", + "desc": "发送通知到钉钉", "link": "https://github.com/apache/answer-plugins/tree/main/notification-dingtalk" }, { - "name": "Slack Notification", - "desc": "Send notifications to Slack", + "name": "Slack 通知", + "desc": "发送通知到 Slack", "link": "https://github.com/apache/answer-plugins/tree/main/notification-slack" }, { - "name": "Code Highlight", - "desc": "Highlight code blocks in Markdown content", + "name": "企业微信通知", + "desc": "发送通知到企业微信", + "link": "https://github.com/apache/answer-plugins/tree/main/notification-wecom" + }, + { + "name": "代码高亮", + "desc": "高亮显示 Markdown 内容中的代码块", "link": "https://github.com/apache/answer-plugins/tree/main/render-markdown-codehighlight" }, { - "name": "Akismet Anti-Spam", - "desc": "Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.", + "name": "Akismet 反垃圾", + "desc": "Akismet 反垃圾用于检查帖子和评论内容,以确定它们是否像垃圾内容。", "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-akismet" }, { - "name": "Baidu Anti-Spam", - "desc": "Baidu Anti-Spam is used to check the content of posts and comments against the Baidu web service to see if they look like spam.", + "name": "百度反垃圾", + "desc": "百度反垃圾用于检查帖子和评论内容,通过百度内容审核平台查看它们是否像垃圾内容。", "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-baidu" }, { - "name": "Review Basic", - "desc": "Generic review rule plugin", + "name": "基础审核插件", + "desc": "基础的通用审核插件", "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-basic" }, { - "name": "Algolia Search", - "desc": "Use Algolia as a search engine.", + "name": "Algolia 搜索", + "desc": "使用 Algolia 作为搜索引擎.", "link": "https://github.com/apache/answer-plugins/tree/main/search-algolia" }, { - "name": "Elasticsearch Engine", - "desc": "Use Elasticsearch as search engine", + "name": "Elasticsearch 引擎", + "desc": "使用 Elasticsearch 作为搜索引擎", "link": "https://github.com/apache/answer-plugins/tree/main/search-elasticsearch" }, { "name": "MeiliSearch", - "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.", + "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。", "link": "https://github.com/apache/answer-plugins/tree/main/search-meilisearch" }, { - "name": "Aliyun OSS storage", - "desc": "Upload files to AliCloud OSS storage", + "name": "阿里云OSS存储", + "desc": "上传文件到阿里云OSS存储", "link": "https://github.com/apache/answer-plugins/tree/main/storage-aliyunoss" }, { - "name": "S3 storage", - "desc": "Upload files to S3 storage", + "name": "S3 存储", + "desc": "上传文件到S3存储", "link": "https://github.com/apache/answer-plugins/tree/main/storage-s3" }, { - "name": "Tencent COS storage", - "desc": "Upload files to Tencent COS storage", + "name": "腾讯云COS对象存储", + "desc": "上传文件到腾讯云COS对象存储", "link": "https://github.com/apache/answer-plugins/tree/main/storage-tencentyuncos" }, { - "name": "Slack User Center", - "desc": "A plugin for integrating Slack user management", + "name": "Slack", + "desc": "通过 Slack 进行登录", "link": "https://github.com/apache/answer-plugins/tree/main/user-center-slack" }, { - "name": "WeCom", - "desc": "Get user info from WeCom and sync to User Center", + "name": "企业微信", + "desc": "从企业微信获取用户信息并同步到用户中心", "link": "https://github.com/apache/answer-plugins/tree/main/user-center-wecom" } ], - "zh_CN": [ + "en_US": [ { - "name": "Redis缓存", - "desc": "使用Redis作为缓存", + "name": "Redis Cache", + "desc": "Use Redis as cache", "link": "https://github.com/apache/answer-plugins/tree/main/cache-redis" }, { - "name": "基础验证码", - "desc": "默认图形验证码", + "name": "Basic Captcha", + "desc": "Default graphic verification code", "link": "https://github.com/apache/answer-plugins/tree/main/captcha-basic" }, { "name": "Google reCAPTCHA v2", - "desc": "Google reCAPTCHA v2 插件", + "desc": "Google reCAPTCHA v2 plugin", "link": "https://github.com/apache/answer-plugins/tree/main/captcha-google-v2" }, { - "name": "阿里云CDN", - "desc": "通过阿里云CDN提升静态资源加速", + "name": "Aliyun CDN", + "desc": "Speed up your website and enjoy greatly improved loading times around the world.", "link": "https://github.com/apache/answer-plugins/tree/main/cdn-aliyun" }, { "name": "Amazon CloudFront", - "desc": "通过AWS CDN提升静态资源加速", + "desc": "Speed up your website and enjoy greatly improved loading times around the world.", "link": "https://github.com/apache/answer-plugins/tree/main/cdn-s3" }, { - "name": "Apache 连接器", - "desc": "用于接入 Apache Oauth", + "name": "Apache Connector", + "desc": "Connect to Apache Oauth", "link": "https://github.com/apache/answer-plugins/tree/main/connector-apache" }, { - "name": "通用连接器", - "desc": "适用于各种 OAuth 登录的通用插件", + "name": "OAuth2 Basic", + "desc": "Generic OAuth2 Plugin", "link": "https://github.com/apache/answer-plugins/tree/main/connector-basic" }, { - "name": "钉钉连接器", - "desc": "用于接入钉钉第三方登录", + "name": "Dingtalk Connector", + "desc": "Connect to Dingtalk for third-party login", "link": "https://github.com/apache/answer-plugins/tree/main/connector-dingtalk" }, { - "name": "Google 连接器", - "desc": "用于接入 Google 第三方登录", + "name": "Google Connector", + "desc": "Connect to Google for third-party login", "link": "https://github.com/apache/answer-plugins/tree/main/connector-google" }, { - "name": "Wallet 连接器", - "desc": "用于接入 Wallet 第三方登录", + "name": "Wallet Connector", + "desc": "Connect to Wallet for third-party login", "link": "https://github.com/apache/answer-plugins/tree/main/connector-wallet" }, { - "name": "图表编辑器", - "desc": "在编辑器中渲染图表", + "name": "Chart Editor", + "desc": "Render chart in editor", "link": "https://github.com/apache/answer-plugins/tree/main/editor-chart" }, { - "name": "公式编辑器", - "desc": "在编辑器中渲染公式", + "name": "Formula Editor", + "desc": "Render formula in editor", "link": "https://github.com/apache/answer-plugins/tree/main/editor-formula" }, { - "name": "内容嵌入", - "desc": "在内容中嵌入其他网站", + "name": "Embed", + "desc": "Embed content from other sites", "link": "https://github.com/apache/answer-plugins/tree/main/embed-basic" }, { - "name": "钉钉通知", - "desc": "发送通知到钉钉", + "name": "Ding talk Notification", + "desc": "Send notifications to Ding Talk", "link": "https://github.com/apache/answer-plugins/tree/main/notification-dingtalk" }, { - "name": "Slack 通知", - "desc": "发送通知到 Slack", + "name": "Slack Notification", + "desc": "Send notifications to Slack", "link": "https://github.com/apache/answer-plugins/tree/main/notification-slack" }, { - "name": "代码高亮", - "desc": "高亮显示 Markdown 内容中的代码块", + "name": "Wecom Notification", + "desc": "Send notifications to Wecom", + "link": "https://github.com/apache/answer-plugins/tree/main/notification-wecom" + }, + { + "name": "Code Highlight", + "desc": "Highlight code blocks in Markdown content", "link": "https://github.com/apache/answer-plugins/tree/main/render-markdown-codehighlight" }, { @@ -223,53 +233,53 @@ "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-akismet" }, { - "name": "百度反垃圾", - "desc": "百度反垃圾用于检查帖子和评论内容,通过百度内容审核平台查看它们是否像垃圾内容。", + "name": "Baidu Anti-Spam", + "desc": "Baidu Anti-Spam is used to check the content of posts and comments against the Baidu web service to see if they look like spam.", "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-baidu" }, { - "name": "基础审核插件", - "desc": "基础的通用审核插件", + "name": "Review Basic", + "desc": "Generic review rule plugin", "link": "https://github.com/apache/answer-plugins/tree/main/reviewer-basic" }, { - "name": "Algolia 搜索", - "desc": "使用 Algolia 作为搜索引擎.", + "name": "Algolia Search", + "desc": "Use Algolia as a search engine.", "link": "https://github.com/apache/answer-plugins/tree/main/search-algolia" }, { - "name": "Elasticsearch 引擎", - "desc": "使用 Elasticsearch 作为搜索引擎", + "name": "Elasticsearch Engine", + "desc": "Use Elasticsearch as search engine", "link": "https://github.com/apache/answer-plugins/tree/main/search-elasticsearch" }, { "name": "MeiliSearch", - "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。", + "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.", "link": "https://github.com/apache/answer-plugins/tree/main/search-meilisearch" }, { - "name": "阿里云OSS存储", - "desc": "上传文件到阿里云OSS存储", + "name": "Aliyun OSS storage", + "desc": "Upload files to AliCloud OSS storage", "link": "https://github.com/apache/answer-plugins/tree/main/storage-aliyunoss" }, { - "name": "S3 存储", - "desc": "上传文件到S3存储", + "name": "S3 storage", + "desc": "Upload files to S3 storage", "link": "https://github.com/apache/answer-plugins/tree/main/storage-s3" }, { - "name": "腾讯云COS对象存储", - "desc": "上传文件到腾讯云COS对象存储", + "name": "Tencent COS storage", + "desc": "Upload files to Tencent COS storage", "link": "https://github.com/apache/answer-plugins/tree/main/storage-tencentyuncos" }, { - "name": "Slack", - "desc": "通过Slack进行登录", + "name": "Slack User Center", + "desc": "A plugin for integrating Slack user management", "link": "https://github.com/apache/answer-plugins/tree/main/user-center-slack" }, { - "name": "企业微信", - "desc": "从企业微信获取用户信息并同步到用户中心", + "name": "WeCom", + "desc": "Get user info from WeCom and sync to User Center", "link": "https://github.com/apache/answer-plugins/tree/main/user-center-wecom" } ] diff --git a/render-markdown-codehighlight/package.json b/render-markdown-codehighlight/package.json index fe7a534b..d669fa3f 100644 --- a/render-markdown-codehighlight/package.json +++ b/render-markdown-codehighlight/package.json @@ -1,6 +1,6 @@ { "name": "render-markdown-codehighlight", - "version": "0.2.0", + "version": "1.0.0", "description": "", "type": "module", "files": [ diff --git a/reviewer-basic/basic.go b/reviewer-basic/basic.go index e3f47e95..db374459 100644 --- a/reviewer-basic/basic.go +++ b/reviewer-basic/basic.go @@ -38,9 +38,16 @@ type Reviewer struct { Config *ReviewerConfig } +const ( + OptionNone = "none" + OptionAll = "all" + OptionFirst = "first" +) + type ReviewerConfig struct { PostAllNeedReview bool `json:"review_post_all"` PostNeedReview bool `json:"review_post"` + PostReviewOption string `json:"review_post_option"` PostReviewKeywords string `json:"review_post_keywords"` PostDisallowedKeywords string `json:"disallowed_keywords"` } @@ -73,8 +80,7 @@ func (r *Reviewer) Review(content *plugin.ReviewContent) (result *plugin.ReviewR return result } - // all post need review - if r.Config.PostAllNeedReview { + if r.Config.PostReviewOption == OptionAll || (r.Config.PostReviewOption == "" && r.Config.PostAllNeedReview) { result = &plugin.ReviewResult{ Approved: false, ReviewStatus: plugin.ReviewStatusNeedReview, @@ -83,8 +89,7 @@ func (r *Reviewer) Review(content *plugin.ReviewContent) (result *plugin.ReviewR return result } - // this switch is true and have any other approved post, return directly - if r.Config.PostNeedReview && content.Author.ApprovedQuestionAmount+content.Author.ApprovedAnswerAmount == 0 { + if (r.Config.PostReviewOption == OptionFirst || (r.Config.PostReviewOption == "" && r.Config.PostNeedReview)) && content.Author.ApprovedQuestionAmount+content.Author.ApprovedAnswerAmount == 0 { result = &plugin.ReviewResult{ Approved: false, ReviewStatus: plugin.ReviewStatusNeedReview, @@ -140,7 +145,40 @@ func (r *Reviewer) Review(content *plugin.ReviewContent) (result *plugin.ReviewR } func (r *Reviewer) ConfigFields() []plugin.ConfigField { + defaultOption := OptionNone + if r.Config.PostReviewOption == "" { + if r.Config.PostAllNeedReview { + defaultOption = OptionAll + } else if r.Config.PostNeedReview { + defaultOption = OptionFirst + } + } else { + defaultOption = r.Config.PostReviewOption + } + return []plugin.ConfigField{ + { + Name: "review_post_option", + Type: plugin.ConfigTypeSelect, + Title: plugin.MakeTranslator(i18n.ConfigReviewPostTitle), + Required: false, + UIOptions: plugin.ConfigFieldUIOptions{}, + Value: defaultOption, + Options: []plugin.ConfigFieldOption{ + { + Value: OptionNone, + Label: plugin.MakeTranslator(i18n.ConfigSelectOption), + }, + { + Value: OptionAll, + Label: plugin.MakeTranslator(i18n.ConfigReviewPostLabelAll), + }, + { + Value: OptionFirst, + Label: plugin.MakeTranslator(i18n.ConfigReviewPostLabelFirst), + }, + }, + }, { Name: "review_post_all", Type: plugin.ConfigTypeSwitch, @@ -180,6 +218,18 @@ func (r *Reviewer) ConfigFields() []plugin.ConfigField { func (r *Reviewer) ConfigReceiver(config []byte) error { c := &ReviewerConfig{} _ = json.Unmarshal(config, c) + + if c.PostReviewOption == OptionAll { + c.PostAllNeedReview = true + c.PostNeedReview = false + } else if c.PostReviewOption == OptionFirst { + c.PostAllNeedReview = false + c.PostNeedReview = true + } else if c.PostReviewOption == OptionNone { + c.PostAllNeedReview = false + c.PostNeedReview = false + } + r.Config = c return nil } diff --git a/reviewer-basic/i18n/en_US.yaml b/reviewer-basic/i18n/en_US.yaml index 2971d62d..917a3723 100644 --- a/reviewer-basic/i18n/en_US.yaml +++ b/reviewer-basic/i18n/en_US.yaml @@ -28,11 +28,13 @@ plugin: title: other: Before a post appears label_all: - other: Post must be manually approved + other: All new posts must be manually approved label_first: other: Post author must have a previously approved post description: other: Questions or answers will be held in the review queue and will not be visible until they are approved. + select_option: + other: Select... review_post_keywords: title: other: Review post keywords diff --git a/reviewer-basic/i18n/translation.go b/reviewer-basic/i18n/translation.go index 1289fbc4..408dcdec 100644 --- a/reviewer-basic/i18n/translation.go +++ b/reviewer-basic/i18n/translation.go @@ -26,6 +26,7 @@ const ( ConfigReviewPostLabelFirst = "plugin.basic_reviewer.backend.config.review_post.label_first" ConfigReviewPostTitle = "plugin.basic_reviewer.backend.config.review_post.title" ConfigReviewPostDescription = "plugin.basic_reviewer.backend.config.review_post.description" + ConfigSelectOption = "plugin.basic_reviewer.backend.config.review_post.select_option" ConfigReviewPostKeywordsTitle = "plugin.basic_reviewer.backend.config.review_post_keywords.title" ConfigReviewPostKeywordsDescription = "plugin.basic_reviewer.backend.config.review_post_keywords.description" ConfigDisallowedKeywordsTitle = "plugin.basic_reviewer.backend.config.disallowed_post_keywords.title" diff --git a/reviewer-basic/i18n/zh_CN.yaml b/reviewer-basic/i18n/zh_CN.yaml index 4d047a73..048e6031 100644 --- a/reviewer-basic/i18n/zh_CN.yaml +++ b/reviewer-basic/i18n/zh_CN.yaml @@ -33,6 +33,8 @@ plugin: other: 内容发布者必须要有通过审核的帖子 description: other: 问题或答案将保存在审查队列中,在获得批准之前不可见。 + select_option: + other: 请选择... review_post_keywords: title: other: 审核帖子关键词 diff --git a/reviewer-basic/info.yaml b/reviewer-basic/info.yaml index da9f3e49..dbc8903d 100644 --- a/reviewer-basic/info.yaml +++ b/reviewer-basic/info.yaml @@ -17,6 +17,6 @@ slug_name: basic_reviewer type: reviewer -version: 1.0.6 +version: 1.0.7 author: answerdev link: https://github.com/apache/answer-plugins/tree/main/reviewer-basic