[hidecontent type="logged" desc="隐藏内容:登录后可查看"]
我们为 immers 提供了一个Docker Hub 镜像,immers-app 存储库包含 docker-compose 配置、配置脚本和各种设置的部署说明。如果您更喜欢在没有 docker 的情况下运行 immers,它可以像任何其他 NodeJS 和 MongoDB 应用程序一样部署。
如果与 Hubs Cloud 一起使用,但不使用我们的 docker 配置和 Hubs 部署程序, 请参阅手动 Hubs Cloud 配置部分。
大多数 API 访问将通过沉浸式网站上的immers-client库完成 ,但 immers 服务器还会尝试解析您的domain
选项以在 apex 域上设置登录会话 cookie,以便它可以在 CORS 请求中使用。只要您的沉浸式服务器和沉浸式网站位于相同的顶级域中,例如 immers.space 和 hub.immers.space,那么您就可以使用credentials: 'include'
fetch 选项发出经过身份验证的请求。
为以前登录的用户恢复会话:
let user
const token = await fetch('https://your.immer/auth/token', { method: 'POST', credentials: 'include' })
.then(res => {
if (!res.ok) {
// 401 if not logged in
return undefined
}
return res.text()
})
if (token) {
user = await window.fetch(`https://your.immer/auth/me`, {
headers: {
Accept: 'application/activity+json',
Authorization: `Bearer ${token}`
}
}).then(res => res.json());
}
注销会话而无需导航到 immers 个人资料页面:
fetch('https://your.immer/auth/logout', { method: 'POST', credentials: 'include' })
如果您有一个现有的用户帐户系统,您可能不希望为沉浸式功能创建另一个帐户来打扰用户。在这种情况下,您可以设置一个具有创建用户、以他们身份登录并代表他们执行操作的完全权限的服务帐户。
如果您使用我们的 docker Hubs 部署程序,则不需要这些步骤。如果不是,则需要在 Hubs Cloud admin -> setup -> server settings -> advanced 中添加以下内容
<meta name="env:immers_server" content="https://your.immers.server">
用您的沉浸式服务器 URL 替换内容中的值)https: wss:
允许 API 和流连接到远程用户主实例)*
用于头像共享的临时措施 cross-hub)沉浸
git clone https://github.com/immers-space/immers.git
cd immers
npm ci
npm run dev:server
集线器
git clone https://github.com/immers-space/hubs.git
cd hubs
git checkout immers-integration
npm ci
npm run dev
使用(使用集线器开发网络服务器)或npm run start
(连接到集线器云网络服务器)运行集线器。https://localhost:8081
,批准证书例外,自动转发到您的 hub https://localhost:8080
,批准另一个证书例外,创建一个房间,您将被重定向到登录或注册您的 immer。默认 immers 服务器是,用hubs repo 根文件夹文件中的https://localhost:8081
条目覆盖。IMMERS_SERVER
.env
如果运行本地集线器,请添加一个.env
带有HOST_IP=localhost
.
如果在 immers 服务器 Web 客户端上工作,请同时运行npm run dev:client
两者。npm run dev:server
CHANGELOG.md
- 使用新版本的版本和日期将顶部标题从“未发布”更新为“vx.xx (yyyy-mm-dd)”npm version [patch|minor|major]
npm run build:image
docker login -u your_user_name
如果需要)npm run publish:image
git push --follow-tags
[/hidecontent]