Add short-link sharing for feedback forms via shlink #2
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Let admins create memorable short links (e.g.
https://msbls.de/vote) that redirect to a feedback form's long URL (https://fdbck.msbls.de/f/<32-char-slug>). Mirror the pattern flexsiebels already uses against m's shlink instance.Reference: flexsiebels integration
flexsiebels/website/src/routes/api/share/+server.ts— POST wraps shlink REST v3 (/rest/v3/short-urls).SHLINK_URL(defaulthttps://msbls.de),SHLINK_API_KEY.ShareCreateSchema(longUrl, customSlug?, maxVisits?, domain?).Scope
Server
src/lib/server/shlink.ts— port thecreateShortUrl()helper from flexsiebels'api/share/+server.ts. Same env vars. Throw on missing key.src/routes/api/admin/feedback/[id]/share/+server.ts(POST):[id]/+server.ts).{ customSlug?: string, maxVisits?: number }.longUrl = \${PUBLIC_SITE_URL}/f/${instance.slug}``.createShortUrl({ longUrl, customSlug, maxVisits }).{ shortUrl, shortCode, customSlug }or shlink's full response.feedback_instances.short_url TEXTcolumn — see Schema).ShareCreateSchematosrc/lib/schemas.ts(zod, mirror flexsiebels).Schema
Migration: add
short_url TEXT NULLtofdbck.feedback_instances(andshort_code TEXT NULLif useful for revoke later). Apply via Supabase migration helper.Admin UI
In
src/routes/admin/feedback/[id]/+page.svelte, add a self-contained "Share" section (new block, don't restyle anything else — dokploy is restyling buttons in parallel; stay out of his way).instance.short_urlexists: display it with a Copy button.customSlug(optional, e.g. "vote"), submit creates short link via POST and refreshes.Out of scope
DELETE /rest/v3/short-urls/{shortCode})Acceptance
/admin/feedback/<id>, optionally with custom slug.SHLINK_URL+SHLINK_API_KEYenv vars wired into the Dokploy app config (head will set after merge — flag in your completion report so head knows to copy from flexsiebels.de-app).How to work
Branch off main:
mai/<your-name>/shlink-integration. dokploy is in parallel onmai/dokploy/button-system— DO NOT touch existing buttons, the icon system, feedback.css buttons, or any inline styles. Append only; let dokploy's restyle win for shared elements.Two-three commits is fine (helper + endpoint + UI + migration). Push, head will merge after dokploy lands first to avoid conflicts.
Done — shlink integration ready for review
Branch:
mai/hermes/fdbck-shlink-short-link(compare)What landed
Server
src/lib/server/shlink.ts—createShortUrl()helper, ports flexsiebelsapi/share/+server.ts1:1. ReadsSHLINK_URL(defaulthttps://msbls.de) +SHLINK_API_KEY. Throws if key is unset.POST /api/admin/feedback/[id]/share— auth-gated. Body{ customSlug?, maxVisits? }. BuildslongUrl = ${PUBLIC_SITE_URL}/f/${instance.slug}, calls shlink, persistsshort_url+short_codeonto the instance, returns{ shortUrl, shortCode, customSlug, instance }.ShareCreateSchemainsrc/lib/schemas.ts—customSlugregex-restricted to[A-Za-z0-9_-]{1,64},maxVisitspositive int.FeedbackInstanceextended withshort_url: string | null,short_code: string | null.Schema
fdbck_feedback_instances_add_short_urlapplied via Supabase MCP — addsshort_url TEXT NULLandshort_code TEXT NULLtofdbck.feedback_instances(idempotentADD COLUMN IF NOT EXISTS).Admin UI
Sharesection on/admin/feedback/[id]— appears between the header and the tabs. Append-only: does not touch existing buttons, the icon system, orfeedback.cssclasses — uses inline styles + existingfb-*classes so dokploy's parallelmai/dokploy/button-systemwork wins on shared elements.⚠️ Action required for head before merge
SHLINK_URL+SHLINK_API_KEYmust be copied from the flexsiebels.de Dokploy app to the fdbck.msbls.de Dokploy app config — otherwise the Share endpoint throwsShlink API key is not configured..env.examplenow documents both vars.Verification
bun run check— 0 errors, 26 pre-existing warnings (none in changed files).bun run test— 20 pass, 0 fail.bun run build— succeeds.Commits
c5d0b2ashlink server: helper + share endpoint + schema696b796admin Share section + env-var docsOut of scope (per brief)
Ready for head to merge after dokploy's
mai/dokploy/button-systemlands, to avoid conflicts on the detail page.