feat(rphotos): fix gallery API routing and embed Immich at /album

Fix getApiBase() regex to match /rphotos instead of /photos, add
/album route with iframe embed via renderExternalAppShell, and update
Immich links to navigate within rSpace instead of opening externally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-01 14:31:19 -08:00
parent b66e9b44de
commit 1a615c29c9
2 changed files with 23 additions and 7 deletions

View File

@ -113,12 +113,12 @@ class FolkPhotoGallery extends HTMLElement {
private getApiBase(): string {
const path = window.location.pathname;
const match = path.match(/^\/([^/]+)\/photos/);
return match ? `/${match[1]}/photos` : "";
const match = path.match(/^\/([^/]+)\/rphotos/);
return match ? `/${match[1]}/rphotos` : "";
}
private getImmichUrl(): string {
return `https://${this.space}.rphotos.online`;
return `/${this.space}/rphotos/album`;
}
private async loadGallery() {
@ -357,7 +357,7 @@ class FolkPhotoGallery extends HTMLElement {
<div class="rapp-nav">
<span class="rapp-nav__title">Photos</span>
<div class="rapp-nav__actions">
<a class="rapp-nav__btn" href="${this.getImmichUrl()}" target="_blank" rel="noopener">
<a class="rapp-nav__btn" href="${this.getImmichUrl()}">
Open Immich
</a>
</div>
@ -368,7 +368,7 @@ class FolkPhotoGallery extends HTMLElement {
<div class="empty-icon">📸</div>
<h3>No photos yet</h3>
<p>Upload photos through Immich to see them here. Shared albums will appear automatically.</p>
<a class="rapp-nav__btn" href="${this.getImmichUrl()}" target="_blank" rel="noopener">
<a class="rapp-nav__btn" href="${this.getImmichUrl()}">
Open Immich to Upload
</a>
</div>
@ -419,7 +419,7 @@ class FolkPhotoGallery extends HTMLElement {
<button class="rapp-nav__back" data-back="gallery"> Photos</button>
<span class="rapp-nav__title">${this.esc(album.albumName)}</span>
<div class="rapp-nav__actions">
<a class="rapp-nav__btn rapp-nav__btn--secondary" href="${this.getImmichUrl()}/albums/${album.id}" target="_blank" rel="noopener">
<a class="rapp-nav__btn rapp-nav__btn--secondary" href="${this.getImmichUrl()}">
Open in Immich
</a>
</div>

View File

@ -7,7 +7,7 @@
*/
import { Hono } from "hono";
import { renderShell } from "../../server/shell";
import { renderShell, renderExternalAppShell } from "../../server/shell";
import { getModuleInfoList } from "../../shared/module";
import type { RSpaceModule } from "../../shared/module";
import { renderLanding } from "./landing";
@ -16,6 +16,7 @@ const routes = new Hono();
const IMMICH_BASE = process.env.RPHOTOS_IMMICH_URL || "http://localhost:2284";
const IMMICH_API_KEY = process.env.RPHOTOS_API_KEY || "";
const IMMICH_PUBLIC_URL = process.env.RPHOTOS_IMMICH_PUBLIC_URL || "https://demo.rphotos.online";
// ── Proxy: list shared albums ──
routes.get("/api/albums", async (c) => {
@ -106,6 +107,20 @@ routes.get("/api/assets/:id/original", async (c) => {
}
});
// ── Embedded Immich UI ──
routes.get("/album", (c) => {
const spaceSlug = c.req.param("space") || "demo";
return c.html(renderExternalAppShell({
title: `${spaceSlug} — Immich | rSpace`,
moduleId: "rphotos",
spaceSlug,
modules: getModuleInfoList(),
appUrl: IMMICH_PUBLIC_URL,
appName: "Immich",
theme: "dark",
}));
});
// ── Page route ──
routes.get("/", (c) => {
const spaceSlug = c.req.param("space") || "demo";
@ -129,6 +144,7 @@ export const photosModule: RSpaceModule = {
routes,
landingPage: renderLanding,
standaloneDomain: "rphotos.online",
externalApp: { url: IMMICH_PUBLIC_URL, name: "Immich" },
feeds: [
{
id: "rphotos",