开发任务列表

  1. recommender system 推荐系统(全局 / 针对不同用户,定制 主页 / 相关话题)。弄清现在的 Discourse 自带的推荐/排序方法,再利用开源的 SOTA 方法进行改进。See more: Ideas behind requiring login to browse . 有人分析了 Discourse 是怎么统计用户阅读时间的:https://linux.do/t/topic/26966
    难度: :star: :star: :star:
    进展:无进展。现在使用 Discourse-AI 插件通过 Open AI text-embedding-ada-002 接口自动生成帖子的 embeddings,然后根据相似性推荐 5 条相关话题。

  2. Noto animated emojis,寻找和 Discourse emoji 的对应关系,转换成 AVIF/WebP, 压缩到现有 emoji 像素尺寸以减小文件大小,在文件系统层替换现有 emoji png 文件。

    Status: done. See 1. 你站正式進入全面動態 Emoji 時代,處於世界領先地位 2. 使用 webp_server 减少全站图片大小 使用 webp_server 加速 Discourse 图片加载

  3. Deprecated:
    修 Mastodon m.xjtu.app 无法使用的问题。(发现竟然是因为 caddy 没有读 mastodon 静态文件的权限造成的错误,忘了除了反代到 puma 的 3000 端口还要 serve static files)

  4. 共享.men, .live 等不同域名的登陆凭据,否则 xjtu.app 的用户会经常会跳转到 canonical name xjtu.app。自动识别插入的站内 URL 并自动替换到当前访问使用的域名(类似目前的 Watched words,可参考 https://github.com/openSUSE-zh/discourse-cjk-text-spacing)。解决 CSP 和 CORS 问题。

    难度::star: :dizzy:
    进展:放弃。在尝试用 non-Rails-native 方法在本地调试到接近成功的状态下无法进展,可在 GitHub - xjtumen/discourse_share_sessions 参观胚胎代码。Multi domain access may hurt SEO. Few people need to access via multiple domains.

  5. 加快网站首次打开速度。不知道这是否可行,有些网站是渐进式加载。Discourse 最好也能首先显示基本文本内容,在浏览的过程中逐渐加载各种功能。现在是几个点在那跳,让人等的很不爽。Discourse team 估计很难遇到低网速情况,应该是不会做这个功能的。

    进展:放弃,这个是 SPA 娘胎里带来的毛病,很难优化。https://www.webpagetest.org/result/250831_YiDcYR_1N2/

  6. GitHub - oracle/truffleruby: A high performance implementation of the Ruby programming language, built on GraalVM. 替代默认的 CRuby。根据 benchmark(https://eregon.me/blog/2022/01/06/benchmarking-cruby-mjit-yjit-jruby-truffleruby.html),性能提高了 N 多倍。
    进展:与 AI, github, steam-login 插件依赖的 gem, core hook 不兼容

  7. Discourse as blog fediverse
    进展:放弃。Discourse can be seen as a blog aggregator. /my/activity/topics 可认为是个人主页。测试了将 discourse 嵌入到其他页面作为评论系统以及自动触发在 Discourse 建立新话题。

  8. 自动在中英文之间加空格,之前看 SUSE 中文社区好像做过相关工作:https://github.com/openSUSE-zh/rubygem-cjk_auto_space,不知道能否直接拿来用。
    难度: :dizzy:
    进展:使用:GitHub - fokx/discourse-cjk-formatter: A Discourse plugin that reformat posts with CJK characters using autocorrect-rb

  9. 做本地 APP,利用 Hysteria 做网络优化,达到忽略线路丢包/延迟的极速访问的用户体验,最重要的是把很多静态资源缓存到本地。

    进展:1. 基于 Kotlin 的 Web 加壳 Android App 客户端 2. 基于 Electron 的 Web 加壳:桌面 App 已释出 v0.0.1 版本,请 Windows 用户务必使用,可对抗 DNS 污染并加速网站的访问 由于为了应对 DDoS,暂时失效。3. 正在 Tauri 2 基础上开发跨平台 App:用 tauri 做一个交大門跨平台应用 https://xjtu.app/t/topic/14216 https://xjtu.app/t/topic/14538/

  10. 类似 Reddit/百度贴吧的 折叠式 UI。已经有类似 Stack Overflow 的开源插件:Discourse Post Voting - Plugin - Discourse MetaHow the journal plugin works - Docs - Pavilion view 和 flat view 相比各有千秋,例如前者可以方便查看两个人交替的讨论(目前 Discourse 只能通过嵌套的引用来实现)。
    难度::star: :star:
    进展:通过 Journal Plugin 可以实现。当前 课程点评 - 🐷 日志 / 部落格 - 🐷 类别正是启用了此种 一层缩进式 UI。

  11. 参考 https://github.com/discourse/discourse-graphviz,给 Discourse 加上 tikz 支持。
    理论上有 GitHub - kisonecat/tikzjax: TikZJax is TikZ running under WebAssembly in the browser 这个开源项目,通过 js 和 wasm 将源码转成 svg,但问题在于正常情况下不允许用户插入 <script> 块以防止 mischief,所以得通过插件来实现,上面那个项目就是通过 viz.js 来支持 graphviz,所以理论上要支持 tikz 可以如法炮制。
    难度::star: :star:
    进展:Mermaid/Graphviz 都冇人用,做这个有乜意义 :a_grinning_face_with_sweat:

  12. 把 discourse 的 nginx 配置转成 caddy 的从而给反代加上缓存功能
    难度: :dizzy:
    进展:无需,不管是使用 cloudflared 还是 caddy 还是只用 nginx 反代,性能上都差不了太多。

  13. 完善不登录回复功能

    • 目前是外挂到一个 python 程序,调用 discourse api。用户体验上不如用插件的方式将回复功能嵌入到页面内,这方面 pkuanvil 做的快速回复 UI 就很好。
      外挂的实现方式有以下问题:
    • 假如因为 rate limit 而失败,直接返回草稿编辑页面(当前为需要人工 Alt + 返回)
    • 防止话题页面内滚动 post_id URL 变化引起的 iframe 刷新。
    • 没有亮暗色自动切换,可以通过 python 程序里读 header 来自适应。

    不如直接调用 Discourse原生 Composer进行匿名回帖/发帖。参考:GitHub - alangibson/discourse-loners: Discourse Loners plugin allows unregistered users to watch and reply to topics using only their email addresses.

    难度: :star:
    进展:禁用,Discourse Staff Alias - Plugin - Discourse Meta
    bug:匿名回复和问答模式插件冲突,最新的 Discourse API 升级使得插件失效。

  14. 完善评课社区,详见 交大門评课社区上线 网址 xjtu.app/course
    解决割裂的使用体验(不同的 UI,无法接入 AI),并且避免再次从 上游 人工合并,写一个插件,类似 https://meta.discourse.org/t/topic-ratings-plugin/39578,将 MySQL 里的数据批量导入 PG,增加该类别 topic 的 field,主要的关系是课程的老师的不同教学班,选修课该板块的其他课程,注意和导师信息的联系,学期信息、推荐星级无所谓,数据初始化的时候很多数据是无意义的平均值,成绩信息可视化不重要(数据来源无法说服用户可信、不同学期之间的差距、没有新人贡献数据)。可借助现有的 模板 功能应用到新的回复。
    难度: :star:
    进展:弃用 USTC 评课社区软件,改用 Discourse 的具有模板的类别:课程点评 - 🐷

  15. 定制主页和用户界面、配色、完善中文翻译,使用 Stable Diffusion 自动生成头像图片,Auto dark mode for instant reply + course review
    支持动态头像、动态徽标、动态格言(参考 www/craiglist theme 顶部的滚动栏])。对于不喜欢浏览时页面有像素改变的用户,提供设置允许静止一切。

    进展:已有动态头像的插件:https://meta.discourse.org/t/animated-avatar-plugin/220445,修改了部分 UI,可在 GitHub - xjtumen/discourse-xjtumen-custom-tc 参观代码

  16. 利用有关语料 finetune 并部署开源 LLM,用于自动回帖以及应答。(注:GPU 不是问题)
    开发 bot(@forward_bot)自动理解并回复现有的相关链接,不过这跟当前的 related topic 功能重叠。(进阶:Finetune LLM

    进展:(效果不好,已被禁用)试验:训练一个解答下交学生疑问的 Chatbot
    为了让门友和水友们更不孤独,我设置了一个自动回复的 bot

  17. 管理 tag(聚类),利用 LLM 自动打 tag,可视化:Discourse Tag Cloud - Theme component - Discourse Meta
    进展:discourse-ai 插件已有此类功能 https://meta.discourse.org/t/discourse-ai-post-classifier-automation-rule/281227,但尚未配置

  18. 基于地理位置的社区功能,现有 discourse 插件 discourse-locations 可以给帖子和用户增加位置属性,可以在此之上增加发现附近的人等功能。支持调用系统的 GPS 定位/手动输入位置。
    难度::star:
    进展:还不如基于 IP 显示位置:GitHub - xjtumen/discourse-ip-location

  19. 基于 SMS 的注册登录,大多数中国人没有 email 邮箱,但上网的人大多用行動裝置,因而虽然 SMS 不安全,SIM swap scam,实现 SMS 注册/登录依然很有意义。事实上,一些基于 Discourse 的网站如 https://swapd.co 已经实现了这个功能。
    进展:太烧钱了,还不如实现和 T 的深度结合

  20. 做点花里胡哨的网站挂件效果

    没有任何意义,厌网站上正常阅读的区域添加动来动去的东西会让人非常烦躁

  21. Upvote / downvote + karma → automatically promote a user to specific group + Category ACL 量化用户的活跃度/贡献度(已有 discourse-gamification),并自动授予相应的权限和功能(已有 trust level 系统)。没有任何意义。

  22. 实现 zulip → discourse 的消息传递,即正确处理 Zulip’s outgoing webhooks,监听在某个地址,识别出是对 xjtu-to-nk 这个 bot 的回复,并从文本中提取出 discourse 上的 topic id,然后调用 discourse 的 api 进行发帖。更进一步,实现 两个/多个 Discourse 之间的互联


:information_source: 学好了 Ruby on Rails, Ember.js, Discourse,有可能去 Discourse 背后的 CDCK 公司上班,或者 去 Discourse Marketplace 接活,或者开一家 Discourse Hosting 公司成为 CDCK 的伙伴

「いいね!」 5

支持

md,放寒假了,有没有同学想学学 ruby on rails 搞点开发练练手啊?

self-assign a SMS user login

关于这个我之前调研了一下,huawei aali 云公司只对企业服务,价格大概批量购买折合 0.几元一条。国外云公司发到国内短信几乎找不到。若果要做,需要再给注册界面加个 CAPTCHA,否则光靠 IP 做 rate limit,恶意攻击者一下子就把钱搞光了。

你可以再调研看看,如果难就知难而退。

Damn, change it first.

我感觉难度适中并且有通用意义的两个,

  1. 不同 Discourse 站之间的互通,包括:
    Synchronising/Crossposting topics across different Discourse sites - Feature - Discourse Meta
    这个功能做得好的话,大则我们实现可以类似 sub-Reddit,允许不同社区创建 sub-Discourse(目前是不同实例在不同域名下,可以把它做成在子目录下,类似 reddit.com/r/<sub-reddit-name>,同时共享身份系统/数据库);小则可以实现 npuer.life 和 xjtu.app 的互联。

再类似于 Matrix,Discourse 上的不同类别/话题对应 Matrix 不同服务器(域名)上的 Room,不同服务器(域名)上的用户不用另外注册,就能参与评论,到时候显示的用户名是 @admin:xjtu.app

  1. 参考目前话题底部的 related 智能推荐,在主页新增一个“For you”,通过历史浏览记录(浏览 1s 以上)。这个在将来也许会被 sam 开发出来:
    Could a List of Recommended Topics Be Added to the Top Menu? - Feature - Discourse Meta
    我之前也考虑过:
    Ideas behind requiring login to browse
「いいね!」 1

很困难的亚子

我感觉不困难,看看当前 discourse-ai 源码里怎么生成 related 部分的内容,无非之前调用过 openai 的 text-embedding-ada-002 接口把每篇 topic 的 embedding 存在数据库里,然后查询距离最近的几个 topic 显示出来(这方面功能由 pgvector 支持)。现在无非就是用户在选择 For You 而非当前默认的 Latest 的时候查询目前用户阅览过的 topic 的 embeddings 的平均值,找最近的几个 topic(当然这只是一种方案)显示出来

The first one is Guada Bridge, let’s give it a try.

不全是,有很多种实现的方式,哪天我们用 matrix chat 连个语音交流一下

「いいね!」 1

The solution I thought of is to synchronize posts and replies, allowing users to create accounts on both sites and bind them. If a user appears who hasn’t bound a local account, a new account is automatically created, with the name displayed as @username:example.com. Users can choose whether their posts are synchronized to the other site.

In the future, when this user joins the community, they can directly inherit the information of the automatically created account.

However, if we use this method, there will be cases where a user has already registered on this site but, because they haven’t bound their account, an automatic account is created. This would require merging the two accounts.

「いいね!」 2

The problem is still the same, I’ll post a question on Stack Overflow.

*redacted*@*redacted*:~/discourse$ d/rake db:migrate RAILS_ENV=development
fatal: detected dubious ownership in repository at '/src'
To add an exception for this directory, call:

	git config --global --add safe.directory /src
*redacted*@*redacted*:~/discourse$ git config --global --add safe.directory ~/discourse
*redacted*@*redacted*:~/discourse$ d/rake db:migrate RAILS_ENV=development
fatal: detected dubious ownership in repository at '/src'
To add an exception for this directory, call:

	git config --global --add safe.directory /src
*redacted*@*redacted*:~/discourse$ git config --global -l
user.name=*redacted*
user.email=*redacted*
user.signingkey=*redacted*
commit.gpgsign=true
safe.directory=*
safe.derectory=/src
safe.directory=/src
safe.directory=/home/*redacted*/discourse

应该不关 safe dir 什么事

whoami
ls -l ~/discourse
ls -ld ~/discourse

看看输出

Previously I also encountered a mkdir permission denied issue, so I gave everyone full permissions (recursively):

*1*@*2*:~/discourse$ whoami
*1*
*1*@*2*:~/discourse$ ls -ld ~/discourse
drwxrwxrwx 25 *1* *1* 4096 Jan 29 15:15 /home/*1*/discourse

我感觉d/rake db:migrate RAILS_ENV=development这个错是在容器里运行时报的

*1*@*2*:~/discourse$ ls -l ~/discourse
total 416
drwxrwxrwx  11 *1*  *1*    4096 Jan 29 14:56 app
drwxrwxrwx   3 *1*  *1*    4096 Jan 29 14:56 bin
-rw-rw-rw-   1 *1*  *1*     316 Jan 29 14:56 Brewfile
-rw-rw-rw-   1 *1*  *1*     148 Jan 29 14:56 CODEOWNERS
drwxrwxrwx   6 *1*  *1*    4096 Jan 29 14:56 config
-rw-rw-rw-   1 *1*  *1*     304 Jan 29 14:56 config.ru
-rw-rw-rw-   1 *1*  *1*    1303 Jan 29 14:56 CONTRIBUTING.md
-rw-rw-rw-   1 *1*  *1*    2347 Jan 29 14:56 COPYRIGHT.md
lrwxrwxrwx   1 *1*  *1*      10 Jan 29 14:56 d -> bin/docker
drwxrwxrwx   3 *1*  *1*    4096 Jan 29 14:57 data
drwxrwxrwx   5 *1*  *1*    4096 Jan 29 15:40 db
-rw-rw-rw-   1 *1*  *1*    1315 Jan 29 14:56 discourse.sublime-project
drwxrwxrwx   2 *1*  *1*    4096 Jan 29 14:56 docs
drwxrwxrwx   5 *1*  *1*    4096 Jan 29 14:56 documentation
-rw-rw-rw-   1 *1*  *1*    6675 Jan 29 14:56 Gemfile
-rw-rw-rw-   1 *1*  *1*   15384 Jan 29 15:12 Gemfile.lock
drwxrwxrwx   2 *1*  *1*    4096 Jan 29 14:56 images
-rw-rw-rw-   1 *1*  *1*    3885 Jan 29 14:56 jsconfig.json
-rw-rw-rw-   1 *1*  *1*    1937 Jan 29 14:56 lefthook.yml
drwxrwxrwx  47 *1*  *1*   12288 Jan 29 14:56 lib
-rw-rw-rw-   1 *1*  *1*   18092 Jan 29 14:56 LICENSE.txt
drwxrwxrwx   2 *1*  *1*    4096 Jan 29 15:15 log
drwxrwxrwx   8 *1*  *1*    4096 Jan 29 14:56 migrations
drwxrwxrwx 486 *1*  *1*   20480 Jan 29 15:10 node_modules
-rw-rw-rw-   1 *1*  *1*    3035 Jan 29 14:56 package.json
drwxrwxrwx  13 *1*  *1*    4096 Jan 29 14:56 plugins
drwxrwxrwx   5 *1*  *1*    4096 Jan 29 15:15 public
-rwxrwxrwx   1 *1*  *1*     305 Jan 29 14:56 Rakefile
-rw-rw-rw-   1 *1*  *1*    7819 Jan 29 14:56 README.md
drwxrwxrwx   6 *1*  *1*    4096 Jan 29 14:56 script
drwxrwxrwx  24 *1*  *1*    4096 Jan 29 14:56 spec
drwxrwxrwx   2 *1*  *1*    4096 Jan 29 14:56 test
drwxr-xr-x   4 100999 100999   4096 Jan 29 15:15 tmp
-rw-rw-rw-   1 *1*  *1*    3279 Jan 29 14:56 translator.yml
drwxrwxrwx   4 *1*  *1*    4096 Jan 29 14:56 vendor
-rw-rw-rw-   1 *1*  *1*  224288 Jan 29 14:56 yarn.lock

我们私聊,省得影响其他人

我发现对我而言一个经常的情况是列的东西(心中想的东西)越多实际做的往往越少。行动力不足,不能深入,经常一有点小的收获就浅尝辄止分心做其他事情了。涉猎的东西哪怕精通一门现在也就有正事可做了,不至于落得今天这么悲惨的局面。

「いいね!」 2

Isn’t there an internship?

「いいね!」 1