# Development

**URL:** https://meta.discourse.org/c/dev/7.md?page=57

[最新版本](https://meta.discourse.org/latest.md) · [分類](https://meta.discourse.org/categories.md) · [標簽](https://meta.discourse.org/tags.md)

**Page:** 58

---

## [将组件的设置创建为文本区域/编辑器？](https://meta.discourse.org/t/creating-a-components-settings-as-a-textarea-editor/244989)

<div class="topic-metadata">

**Author:** [@craigconstantine](https://meta.discourse.org/u/craigconstantine)\
**回覆:** 2\
**Last updated:** [2022年十一月9日 14:55 UTC](https://meta.discourse.org/t/creating-a-components-settings-as-a-textarea-editor/244989 "2022-11-09T14:55:11Z")

</div>

在组件的设置中，我可以通过组件的 settings.yaml 文件轻松创建一个用于输入文本的字段…… example\_setting: default: "Sample default." description: en: "This is an ex…"

---

## [聊天是否稳定到可以创建不会中断的主题/组件？](https://meta.discourse.org/t/is-chat-stable-enough-to-create-themes-components-that-wont-break/244712)

<div class="topic-metadata">

**Author:** [@jimkleiber](https://meta.discourse.org/u/jimkleiber)\
**回覆:** 4\
**Last updated:** [2022年十一月8日 14:21 UTC](https://meta.discourse.org/t/is-chat-stable-enough-to-create-themes-components-that-wont-break/244712 "2022-11-08T14:21:12Z")

</div>

继续讨论：在聊天中滑动以回复：

---

## [特定主题的帖子3个月后自动删除 - 需要API选项](https://meta.discourse.org/t/auto-delete-the-post-after-3-months-on-specific-topic-need-api-option/244776)

<div class="topic-metadata">

**Author:** [@naresh](https://meta.discourse.org/u/naresh)\
**回覆:** 2\
**Last updated:** [2022年十一月8日 11:40 UTC](https://meta.discourse.org/t/auto-delete-the-post-after-3-months-on-specific-topic-need-api-option/244776 "2022-11-08T11:40:33Z")

</div>

专家您好， 我正在寻找一个REST API中的选项，可以在创建新主题时使用。该选项将允许我设置主题，以便自动删除超过3个月的帖子…

---

## [从API GET响应中仅返回特定字段](https://meta.discourse.org/t/return-only-specific-fields-from-the-api-get-response/244695)

<div class="topic-metadata">

**Author:** [@gassim](https://meta.discourse.org/u/gassim)\
**回覆:** 2\
**Last updated:** [2022年十一月7日 19:04 UTC](https://meta.discourse.org/t/return-only-specific-fields-from-the-api-get-response/244695 "2022-11-07T19:04:14Z")

</div>

继续讨论 Discourse API 文档： 你好 我找不到这个问题的答案，请问。有人知道是否可以指定 Discourse API 对 GET 请求的响应只返回 r

---

## [如何使用 api.onPageChange 和 api.createWidget？](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744)

<div class="topic-metadata">

**Author:** [@rahim123](https://meta.discourse.org/u/rahim123)\
**回覆:** 8\
**Last updated:** [2022年十一月6日 02:29 UTC](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744 "2022-11-06T02:29:10Z")

</div>

您好，我正在尝试向所有页面添加一个图片横幅，该横幅会从两张随机图片中随机选择一张。当我将其添加到主题的“Head”部分并强制重新加载主页时，它就能正常工作： 编辑：我更接近于此的尝试……

---

## [无参考的插件开发](https://meta.discourse.org/t/plugin-development-without-a-reference/244511)

<div class="topic-metadata">

**Author:** [@michaelhenderson](https://meta.discourse.org/u/michaelhenderson)\
**回覆:** 1\
**Last updated:** [2022年十一月5日 19:07 UTC](https://meta.discourse.org/t/plugin-development-without-a-reference/244511 "2022-11-05T19:07:32Z")

</div>

一周以来，我一直在尝试使用一个插件为我的论坛设置自定义路由。该路由应该对任何人公开访问。我希望该插件能够从 Handlebars 模板中显示 HTML，并将其设置在指定的路由上。……

---

## [创建主题时无法验证 CSRF 令牌的真实性](https://meta.discourse.org/t/cant-verify-csrf-token-authenticity-while-creating-topics/234331)

<div class="topic-metadata">

**Author:** [@attj](https://meta.discourse.org/u/attj)\
**回覆:** 1\
**Last updated:** [2022年十一月4日 19:06 UTC](https://meta.discourse.org/t/cant-verify-csrf-token-authenticity-while-creating-topics/234331 "2022-11-04T19:06:47Z")

</div>

我的 curl 命令如下： curl -X POST 'https://example.com/posts' \\ -H "Content-Type: multipart/form-data;" \\ --form 'Api-Key="redacted"' \\ --form 'Api-Username="redacted"' \\ --form 'title="测试主题"' \\ --form 'raw="…'

---

## [如何自定义 discourse composer 编辑器 discourse composer 编辑器](https://meta.discourse.org/t/how-to-customize-discourse-composer-editor/243882)

<div class="topic-metadata">

**Author:** [@YAN](https://meta.discourse.org/u/YAN)\
**回覆:** 1\
**Last updated:** [2022年十一月4日 14:17 UTC](https://meta.discourse.org/t/how-to-customize-discourse-composer-editor/243882 "2022-11-04T14:17:18Z")

</div>

我们的论坛有一个预期功能：当用户上传图片后，在点击“回复”按钮之前，文本区域可以自动弹出一些说明，要求为图片添加标签。例如，会有一个额外的……

---

## [主页更改为标签？](https://meta.discourse.org/t/change-homepage-to-tag/243954)

<div class="topic-metadata">

**Author:** [@bartv](https://meta.discourse.org/u/bartv)\
**回覆:** 7\
**Last updated:** [2022年十一月2日 12:32 UTC](https://meta.discourse.org/t/change-homepage-to-tag/243954 "2022-11-02T12:32:32Z")

</div>

我们在 BlenderArtists.org 上运营一个面向图形/设计的社区。我一直在想的一件事是，我们的主页应该有一些图形来更好地吸引我们的受众，而不是一排排的文字。这个问题……

---

## [为已发布的页面添加类别类](https://meta.discourse.org/t/adding-a-category-class-to-a-published-page/246404)

<div class="topic-metadata">

**Author:** [@Canapin](https://meta.discourse.org/u/Canapin)\
**回覆:** 5\
**Last updated:** [2022年十一月1日 23:04 UTC](https://meta.discourse.org/t/adding-a-category-class-to-a-published-page/246404 "2022-11-01T23:04:36Z")

</div>

如果我们在脚本标签中不能使用 type="text/discourse-plugin"，是否有办法获取已发布页面的当前类别 slug？目的是在页面的 HTML 标签中添加一个包含该 slug 的新类。

---

## [使用 Discourse API 创建主题](https://meta.discourse.org/t/create-topic-with-discourse-api/243760)

<div class="topic-metadata">

**Author:** [@alexcomp](https://meta.discourse.org/u/alexcomp)\
**回覆:** 0\
**Last updated:** [2022年十一月1日 16:32 UTC](https://meta.discourse.org/t/create-topic-with-discourse-api/243760 "2022-11-01T16:32:26Z")

</div>

你好 请帮助我。 我正在尝试使用 Discourse API 创建一个主题，但我每次尝试都失败了。这是我的代码： https://myDiscourse.com/posts.json?title=New+test+posted

---

## [我想在特定帖子中创建一个活动的彩色按钮（不是图片）](https://meta.discourse.org/t/i-want-to-create-an-active-colored-button-not-an-image-inside-a-specific-post/243264)

<div class="topic-metadata">

**Author:** [@Aizada\_M](https://meta.discourse.org/u/Aizada_M)\
**回覆:** 13\
**Last updated:** [2022年十月30日 12:23 UTC](https://meta.discourse.org/t/i-want-to-create-an-active-colored-button-not-an-image-inside-a-specific-post/243264 "2022-10-30T12:23:40Z")

</div>

您好。我不会编程。我想在特定帖子中创建一个活动的彩色按钮（不是图片）。帖子编辑器窗口中应写入什么代码。 我想要的是： 我的尝试是……

---

## [SSO无法连接](https://meta.discourse.org/t/sso-not-connecting/243287)

<div class="topic-metadata">

**Author:** [@alexcomp](https://meta.discourse.org/u/alexcomp)\
**回覆:** 0\
**Last updated:** [2022年十月29日 15:31 UTC](https://meta.discourse.org/t/sso-not-connecting/243287 "2022-10-29T15:31:01Z")

</div>

你好 我请求你的帮助。 我在我的网站上使用 Discourse，并且想要使用 SSO。在我的研究之后，我发现了这个脚本 https://gist.github.com/paxmanchris/e93018a3e8fbdfced039，我照着做了，一切似乎……

---

## [plugin.rb 中的 \`add\_to\_class()\` 方法未被调用](https://meta.discourse.org/t/method-add-to-class-in-plugin-rb-is-not-being-called/243302)

<div class="topic-metadata">

**Author:** [@SoothSinger](https://meta.discourse.org/u/SoothSinger)\
**回覆:** 0\
**Last updated:** [2022年十月30日 02:05 UTC](https://meta.discourse.org/t/method-add-to-class-in-plugin-rb-is-not-being-called/243302 "2022-10-30T02:05:23Z")

</div>

大家好， 我正在尝试通过add\_to\_tag向标签添加值，但根据我的观察，当我加载带有标签的主题时，它没有被调用。 另一方面，我可以看到当我执行以下操作时，该方法被调用： add\_……

---

## [如何在 email-group-user-chooser 中获取分阶段的用户](https://meta.discourse.org/t/how-to-get-staged-users-offered-in-email-group-user-chooser/243195)

<div class="topic-metadata">

**Author:** [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**回覆:** 0\
**Last updated:** [2022年十月28日 15:25 UTC](https://meta.discourse.org/t/how-to-get-staged-users-offered-in-email-group-user-chooser/243195 "2022-10-28T15:25:05Z")

</div>

pfaffman 又提出了一个奇怪的问题。 在一个具有自定义 Server 模型（属于 :user）的插件中，我在模板中使用了 {{email-group-user-chooser...。它能正常工作！ 现在我希望能够让那个选择器……

---

## [主题组件中更新脚本的缓存破坏？](https://meta.discourse.org/t/cache-busting-for-updated-scripts-in-theme-components/243036)

<div class="topic-metadata">

**Author:** [@rahim123](https://meta.discourse.org/u/rahim123)\
**回覆:** 0\
**Last updated:** [2022年十月27日 02:29 UTC](https://meta.discourse.org/t/cache-busting-for-updated-scripts-in-theme-components/243036 "2022-10-27T02:29:32Z")

</div>

您好，我想知道当我在 He... 中添加的此脚本的图片 URL 和/或 链接更改时，用户浏览器会话中缓存的 Javascript 有哪些可能的更新选项？

---

## [Sam的多主机忍者插件方法是否仍然有效？](https://meta.discourse.org/t/is-sams-multi-hostname-ninja-plugin-approach-still-valid/193965)

<div class="topic-metadata">

**Author:** [@downey](https://meta.discourse.org/u/downey)\
**回覆:** 4\
**Last updated:** [2022年十月26日 15:25 UTC](https://meta.discourse.org/t/is-sams-multi-hostname-ninja-plugin-approach-still-valid/193965 "2022-10-26T15:25:05Z")

</div>

继续讨论“强制主机名破坏了洋葱服务的支持”： 我们有一个用例，就像洋葱+明网使用一样，我们需要为同一个 Discourse 实例使用两个不同的主机名。在我们之前……

---

## [添加一个新的自定义注册按钮](https://meta.discourse.org/t/add-a-new-custom-signup-button/242945)

<div class="topic-metadata">

**Author:** [@dorl-moveo](https://meta.discourse.org/u/dorl-moveo)\
**回覆:** 0\
**Last updated:** [2022年十月26日 09:04 UTC](https://meta.discourse.org/t/add-a-new-custom-signup-button/242945 "2022-10-26T09:04:17Z")

</div>

你好！ 我正在尝试添加一个将打开注册模态框的新注册按钮，但它不起作用 这是我的代码： api.createWidget("custom-signup-button", { tagName: "button.become-member-button", function(helper){…

---

## [我如何同时更改标题菜单的悬停文字和背景颜色？](https://meta.discourse.org/t/how-do-i-change-both-the-hover-text-and-background-color-of-the-header-menu/276460)

<div class="topic-metadata">

**Author:** [@rickwatson](https://meta.discourse.org/u/rickwatson)\
**回覆:** 1\
**Last updated:** [2022年十月25日 16:40 UTC](https://meta.discourse.org/t/how-do-i-change-both-the-hover-text-and-background-color-of-the-header-menu/276460 "2022-10-25T16:40:53Z")

</div>

我如何同时更改标题菜单的悬停文本和背景颜色？我对 CSS 不熟悉。代码和放置位置会很有帮助，谢谢！@vinothkannans

---

## [添加新的语言界面 - 乌兹别克语](https://meta.discourse.org/t/add-a-new-language-interface-uzbek/242553)

<div class="topic-metadata">

**Author:** [@Riccardo\_Terzaghi](https://meta.discourse.org/u/Riccardo_Terzaghi)\
**回覆:** 5\
**Last updated:** [2022年十月25日 08:53 UTC](https://meta.discourse.org/t/add-a-new-language-interface-uzbek/242553 "2022-10-25T08:53:58Z")

</div>

您好！我正在尝试按照@gerhard 的指南添加乌兹别克语： 但在 app.yml 中添加插件并重建应用程序时，我遇到了这个错误： FAILED -------------------- Pups::ExecError: cd /var/www/d……

---

## [Discourse 用户笔记 API](https://meta.discourse.org/t/discourse-user-notes-api/240948)

<div class="topic-metadata">

**Author:** [@codetricity](https://meta.discourse.org/u/codetricity)\
**回覆:** 3\
**Last updated:** [2022年十月21日 23:20 UTC](https://meta.discourse.org/t/discourse-user-notes-api/240948 "2022-10-21T23:20:23Z")

</div>

我想使用 Discourse API 获取用户的所有笔记。这些笔记是通过 discourse-user-notes 应用的。使用按 ID 获取用户，我可以看到 user\_note\_count 字段。但是，我似乎找不到内容…

---

## [管理员报告数据的API](https://meta.discourse.org/t/api-for-admin-report-data/242426)

<div class="topic-metadata">

**Author:** [@codetricity](https://meta.discourse.org/u/codetricity)\
**回覆:** 4\
**Last updated:** [2022年十月21日 23:15 UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426 "2022-10-21T23:15:20Z")

</div>

我想通过 HTTP API 访问管理员报告数据。 这篇帖子似乎表明类似这样的东西会起作用： /admin/reports/posts.json 我现在收到 404 错误。 所有类似这样的 URL 似乎都不……

---

## [Discourse 导航中的空 



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































](https://meta.discourse.org/t/empty-li-in-discourse-navigation/242440)

<div class="topic-metadata">

**Author:** [@carson](https://meta.discourse.org/u/carson)\
**回覆:** 1\
**Last updated:** [2022年十月21日 22:15 UTC](https://meta.discourse.org/t/empty-li-in-discourse-navigation/242440 "2022-10-21T22:15:30Z")

</div>

你好，这不算什么大事，但我注意到 Discourse 导航栏的末尾总是有个空的 \`\`\`html \`\`\` 标签；我想知道这是开发者故意的吗？我想设置样式……

---

## [根据用户所属群组显示不同主题内容？](https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075)

<div class="topic-metadata">

**Author:** [@craigconstantine](https://meta.discourse.org/u/craigconstantine)\
**回覆:** 6\
**Last updated:** [2022年十月21日 19:56 UTC](https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075 "2022-10-21T19:56:15Z")

</div>

我正在使用 discourse.org 的托管服务，因此在这种情况下我无法使用插件。想象一下我发布了一个任何人都可以看到的主题。 如果某人属于“A”组，那么我希望他们看到此内容。如果不是，那么……

---

## [将一些CloudFlare路径添加到robots.txt，以避免爬虫程序错误地检查](https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561)

<div class="topic-metadata">

**Author:** [@albertoiNET](https://meta.discourse.org/u/albertoiNET)\
**回覆:** 1\
**Last updated:** [2022年十月21日 14:02 UTC](https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561 "2022-10-21T14:02:32Z")

</div>

首先，我想解释一下，有些网站依赖 CloudFlare 而不是 Discourse 来增加额外的安全层。这一层提供了一些功能，如电子邮件混淆和机器人对抗挑战，它使用一个虚拟路径，例如……

---

## [关于如何获取用户信息](https://meta.discourse.org/t/consultation-on-how-to-obtain-user-information/242465)

<div class="topic-metadata">

**Author:** [@Programer-D](https://meta.discourse.org/u/Programer-D)\
**回覆:** 4\
**Last updated:** [2022年十月21日 11:56 UTC](https://meta.discourse.org/t/consultation-on-how-to-obtain-user-information/242465 "2022-10-21T11:56:08Z")

</div>

我创建了一个表单作为插件，用于搜索我独立定义的某个用户字段中的用户。 我使用 Web API 将用户信息存储在外部数据库（AWS DynamoDB）中，并从中提取数据进行搜索……

---

## [无法从主机访问 VM 中的 Discourse 服务器](https://meta.discourse.org/t/cant-reach-discourse-server-in-vm-from-host/154151)

<div class="topic-metadata">

**Author:** [@Hugo\_Lol](https://meta.discourse.org/u/Hugo_Lol)\
**回覆:** 8\
**Last updated:** [2022年十月20日 22:15 UTC](https://meta.discourse.org/t/cant-reach-discourse-server-in-vm-from-host/154151 "2022-10-20T22:15:10Z")

</div>

你好！我已按照指南在 Ubuntu 18.04 虚拟机（使用 VMware Workstation 15 Player）中成功安装了 Discourse。从虚拟机内部访问 http://localhost:3000/ 没有问题，但我无法从外部访问……

---

## [要在类别页面顶部菜单中显示类别选项卡](https://meta.discourse.org/t/want-to-show-categories-tab-on-top-menu-in-categories-page/242390)

<div class="topic-metadata">

**Author:** [@Lai\_Chau\_Koi](https://meta.discourse.org/u/Lai_Chau_Koi)\
**回覆:** 5\
**Last updated:** [2022年十月19日 18:11 UTC](https://meta.discourse.org/t/want-to-show-categories-tab-on-top-menu-in-categories-page/242390 "2022-10-19T18:11:32Z")

</div>

大家好！ 我想在类别页面中显示“类别”选项卡。 我已经这样设置了 admin/site\_setting/top-menu：“categories, latest, top”，并将类别页面设为我的默认页面。 请问有人知道这个……

---

## [基于所选配色方案的 CSS 元素](https://meta.discourse.org/t/css-element-based-on-color-scheme-selected/242218)

<div class="topic-metadata">

**Author:** [@agf1997](https://meta.discourse.org/u/agf1997)\
**回覆:** 6\
**Last updated:** [2022年十月18日 20:10 UTC](https://meta.discourse.org/t/css-element-based-on-color-scheme-selected/242218 "2022-10-18T20:10:02Z")

</div>

我正在尝试弄清楚如何根据所选的配色方案设置元素的颜色。以下代码在我的浅色模式下运行良好，但在我的深色模式下效果不佳。 .d-header-icons .d-icon { width: 100%; line-h…

---

## [使用API发布到聊天频道？](https://meta.discourse.org/t/use-the-api-to-post-to-chat-channel/241871)

<div class="topic-metadata">

**Author:** [@ninermac](https://meta.discourse.org/u/ninermac)\
**回覆:** 3\
**Last updated:** [2022年十月18日 16:41 UTC](https://meta.discourse.org/t/use-the-api-to-post-to-chat-channel/241871 "2022-10-18T16:41:56Z")

</div>

正在为 Discourse 聊天开发机器人。是否可以利用 post API 调用并将某些内容放入聊天频道？

[上一頁](https://meta.discourse.org/c/dev/7.md?page=56)

[下一頁](https://meta.discourse.org/c/dev/7.md?page=58)
