Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

getPod() assumes subdomain pattern, breaks path-based pods

未关闭
#651 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript

调研方向

从 src/utils/headerFooterHelpers.ts 中的 getPod() 开始,检查 authn.currentUser()、WebID 数据和 storage 在周边工具函数中是如何可用的。使用类似 http://server.com/alice/ 的基于路径的 pod 验证其行为,并保留现有的、针对子域名 pod 的基于 origin 的 fallback。

由索引模型根据 Issue 内容生成。

描述

Problem

The getPod() function in src/utils/headerFooterHelpers.ts assumes pods are at the origin (subdomain pattern), which breaks path-based pod servers.

Current code (line 17-20):

export function getPod (): NamedNode {
  // @@ TODO: This is given that mashlib runs on NSS - might need to change when we want it to run on other Pod servers
  return sym(document.location.origin).site()
}

The TODO comment acknowledges this limitation.

Impact

When using a path-based pod server (e.g., http://server.com/alice/), after login:

  • WebID: http://server.com/alice/profile/card#me
  • getPod() returns: http://server.com/
  • Profile guess becomes: http://server.com/profile/card#me
  • Should be: http://server.com/alice/profile/card#me

This causes 404 errors when mashlib tries to load the user's profile.

Affected Servers

  • Any path-based pod server
  • CSS (Community Solid Server) supports both subdomain and path patterns
  • JSS (JavaScript Solid Server) uses path pattern

Suggested Fix

Derive the pod root from the logged-in user's WebID rather than assuming document.location.origin:

export function getPod (): NamedNode {
  const user = authn.currentUser()
  if (user) {
    // Extract pod root from WebID's pim:storage or by convention
    const storage = getStorage(user)
    if (storage) return storage
  }
  // Fallback to origin-based (subdomain pattern)
  return sym(document.location.origin).site()
}

Or use the pim:storage triple from the user's profile which explicitly declares the pod root.

Environment

  • solid-ui version: latest (via mashlib CDN)
  • Server: JSS (JavaScript Solid Server) with path-based pods
主要语言
TypeScript
星标
153
派生
46
平均合并
1 天 8 小时
30 天内合并 PR
7

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SolidOS/solid-ui 的其他 Issue

查看 SolidOS/solid-ui 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。