Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于后端获取前端地址 #276

Closed
Jinvic opened this issue Feb 13, 2025 · 0 comments
Closed

关于后端获取前端地址 #276

Jinvic opened this issue Feb 13, 2025 · 0 comments
Labels
feature-request New feature request
Milestone

Comments

@Jinvic
Copy link
Contributor

Jinvic commented Feb 13, 2025

原帖链接: #272 (comment)

RSS 在 十年之约 订阅成功了,但我修改了地址,自动生成的 /rss?frontend_host=https%3A%2F%2Fm.xwsir.com 中,%3A%2F%2F 识别不了,改为 :// 才成功的。

根据RFC 3986规范,某些字符需要进行百分比编码以避免歧义和确保兼容性。但编码后反而不能识别确实有些奇怪。

为了遵守规范,我并不打算取消编码。也许可以在readme中提示用户,rss链接不可用时尝试修改%3A%2F%2F://

由于项目是前后端分离的,后端并不能直接获取前端地址,所以请求接口时需要这样额外传参。也可以将这个参数改成系统设置或环境变量,那就需要用户进行额外配置,而现在的方案对用户是无感的。

    {
      rel: 'alternate',
      type: 'application/rss+xml',
      title: '我的 RSS 订阅',
      href: sysConfigVO.rss || `/rss?frontend_host=${encodeURIComponent(window.location.origin)}`,
    },

也许这个问题需要进一步讨论。

@Jinvic Jinvic closed this as completed Feb 14, 2025
@xuewenG xuewenG added the feature-request New feature request label Feb 14, 2025
@xuewenG xuewenG added this to the v0.2.9 milestone Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request
Projects
None yet
Development

No branches or pull requests

2 participants