Discourse类别标题主题组件

那些标签是类别描述的一部分。我可以尝试对其进行 html-safe 处理,但不确定这是否会引入漏洞?

@NateDhaliwal 我不确定!抱歉,我不知道这些错误对应的是什么,也不知道如何找到与该页面直接相关的错误。

您是否查看过其他组件是如何处理的?
我猜它是安全的。至少我感觉官方的分类横幅组件在没有单独转义的情况下也使用了 html-safe

2 个赞

FWIW 这个问题似乎是由于某个东西试图使用旧路由而不是新的 /admin/config/user-fields.json 路由。

它还提到了:

所以也许 @RGJ 会知道更多? :crossed_fingers:

1 个赞

TL;DR 否。 :slight_smile:

长篇版本:
这是一个我们在托管服务(类似于 CDCK 的“托管站点”)上使用的内部插件,它添加了一些我们托管站点所需的额外功能。这一特定行将多站点“未找到”替换为更详细的错误消息,表明站点所有者可能错误配置了其 DNS。

由于它会修补多站点中间件,因此我们托管的每个站点的每次请求都会经过它。如果您在堆栈跟踪中看到此插件,并且 lib/middleware/enforce_hostname.rb 这一行紧随其上方,则这是一个正常调用,并非问题的原因。

3 个赞

您在稳定分支上吗?也许更新导致插件在稳定版上损坏了。然后,添加到兼容性文件中可能会有帮助。

2 个赞

@Moin 我不知道,我该如何检查我当前在哪个分支?

1 个赞

是的,你用的是稳定版 @jackierenee

5 个赞

感谢确认 @RGJ

那么,在将此组件重新添加到我们的网站之前,我是否只需要等待兼容性确认?

我正在处理一个有望解决此问题的 PR。

3 个赞

是的 :+1:

1 个赞

当然。

没有主题组件时,类别描述中的文本默认使用 --font-up-3。这是通过 .category-heading 类实现的。我认为这近年来有所增长。

使用主题组件时,类别描述中的文本为 --font-0。这可以增加到 --font-up-1(较大)或 font-up-2(最大)。但这些都无法达到新的常态!

1 个赞

好的,这样可以吗?
更小 → --font-up-2
正常 → --font-up-3
更大 → --font-up-4
最大 → --font-5
抄送:@Rhidian

1 个赞

你好 @jackierenee ,我合并了一个 PR。你能尝试更新看看是否有效吗?

1 个赞

您好 @NateDhaliwal,我刚尝试更新并把组件加回了我的网站。分类页面仍然是空白的。

而且,如果我尝试将它与最小化的分类框结合使用,我的主页也会变为空白。

也许是我哪里做错了,但我不知道如何解决。

我现在还在我的网站顶部看到一个错误:

另外,我认为这是与该错误消息相关的错误日志:

Message (报告了 4472 份)

[db6814] ActionController::RoutingError (No route matches [GET] "/admin/customize/user_fields.json")
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/processing_request.rb:12:in `call'
lib/middleware/request_tracker.rb:385:in `call'


Backtrace

actionpack (7.2.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:35:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'
logster (2.20.0) lib/logster/middleware/reporter.rb:40:in `call'
railties (7.2.2.1) lib/rails/rack/logger.rb:41:in `call_app'
railties (7.2.2.1) lib/rails/rack/logger.rb:29:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/request_id.rb:33:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
plugins/z-communiteq-features/plugin.rb:142:in `call'
rack (2.2.10) lib/rack/method_override.rb:24:in `call'
rack (2.2.10) lib/rack/sendfile.rb:110:in `call'
rack-mini-profiler (3.3.1) lib/mini_profiler.rb:191:in `call'
lib/middleware/processing_request.rb:12:in `call'
message_bus (4.3.8) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:385:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/remote_ip.rb:96:in `call'
rails_multisite (6.1.0) lib/rails_multisite/middleware.rb:26:in `call'
plugins/z-communiteq-features/plugin.rb:168:in `call'
railties (7.2.2.1) lib/rails/engine.rb:535:in `call'
railties (7.2.2.1) lib/rails/railtie.rb:226:in `public_send'
railties (7.2.2.1) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.10) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.10) lib/rack/urlmap.rb:58:in `each'
rack (2.2.10) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `


Env

HTTP HOSTS: community.eaie.org

谢谢!

浏览器控制台有错误吗?
您能否分享一下您目前使用的 Discourse 版本?这在 /admin 页面。
谢谢!

你好 @NateDhaliwal,抱歉,我不知道浏览器控制台中的错误具体是什么意思。

我相信我正在运行的 Discourse 版本是:Discourse 3.4.6 - GitHub - discourse/discourse: A platform for community discussion. Free, open, simple. 版本 3d149ba8244585f4bcb41db77aa8825e72468bdb

@NateDhaliwal 抱歉,我已自行解决,以下是一些错误:

Discourse v3.4.6 — https://github.com/discourse/discourse/commits/3d149ba824 — Ember v5.12.0
category-header.gjs:51 Uncaught TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at V.end (index.js:78:1)
    at V._runExpiredTimers (index.js:78:1)理解此错误
category-header.gjs:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._appendDefinition (index.js:78:1)
    at io.appendOutletView (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at index.js:78:1理解此错误
category-header.gjs:51 Uncaught TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at V.end (index.js:78:1)
    at V._runExpiredTimers (index.js:78:1)理解此错误
category-header.gjs:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at index.js:78:1理解此错误
1 个赞

这很奇怪。奇怪的是,这个错误现在才出现,因为 this.site.mobileView 在原始版本中就存在 :thinking:。我无法在最新的测试通过版本中重现此问题,这会不会是稳定版的一个限制(尽管这似乎不太可能——核心也使用了这个)。