feat: improve workshop publishing flow

This commit is contained in:
Thomas Camlong committed 2026-08-14 23:16:39 +02:00
1 parent 168091134d
commit b491d45fdc
19 files changed
+254 -82

No files matched your search

+2
View File
@@ -23,6 +23,7 @@ export const env = createEnv({
DEMO_READ_ONLY: createBooleanSchema(true),
HOMARR_WEBSITE_URL: publicHttpUrl("HOMARR_WEBSITE_URL").default("https://homarr.dev"),
WORKSHOP_API_URL: publicHttpUrl("WORKSHOP_API_URL").optional(),
WORKSHOP_WEB_URL: publicHttpUrl("WORKSHOP_WEB_URL").optional(),
},
runtimeEnv: {
KUBERNETES_SERVICE_ACCOUNT_NAME: process.env.KUBERNETES_SERVICE_ACCOUNT_NAME,
@@ -30,5 +31,6 @@ export const env = createEnv({
DEMO_READ_ONLY: process.env.DEMO_READ_ONLY,
HOMARR_WEBSITE_URL: process.env.HOMARR_WEBSITE_URL,
WORKSHOP_API_URL: process.env.WORKSHOP_API_URL,
WORKSHOP_WEB_URL: process.env.WORKSHOP_WEB_URL,
},
});
@@ -23,8 +23,11 @@ const logger = createLogger({ module: "custom-widget:workshop" });
const workshopUrls = resolveHomarrUrlConfig({
homarrWebsiteUrl: env.HOMARR_WEBSITE_URL,
workshopApiUrl: env.WORKSHOP_API_URL,
workshopWebUrl: env.WORKSHOP_WEB_URL,
});
const workshop = new WorkshopBackend(workshopUrls.workshopApiUrl);
const getWorkshopSubmissionUrl = (submissionId: string) =>
`${workshopUrls.workshopWebUrl}/${encodeURIComponent(submissionId)}`;
function throwWorkshopUnavailable(
message: string,
@@ -94,6 +97,7 @@ export const workshopProcedures = {
.filter((item) => item.widgetSchema === CUSTOM_WIDGET_SCHEMA)
.map((item) => ({
id: item.id,
url: getWorkshopSubmissionUrl(item.id),
title: item.title,
description: item.description,
authorName: item.authorName,
@@ -117,6 +121,7 @@ export const workshopProcedures = {
return {
submission: {
id: submission.id,
url: getWorkshopSubmissionUrl(submission.id),
title: submission.title,
description: submission.description,
authorName: submission.authorName,
+15
View File
@@ -1385,6 +1385,8 @@
"title": "Workshop",
"importFromWorkshop": "Import from Workshop",
"openCommunity": "Open Workshop",
"manageSubmissionsTitle": "Manage submissions on Workshop",
"manageSubmissionsDescription": "Publishing starts in Homarr, but updates, reports, outdated status, and deletion are managed directly on the Workshop website. Sign in there and select Yours to find your submissions.",
"description": "Community Custom JSX v2 widgets. Inspect the source and network capabilities before installing.",
"descriptionCss": "Community Custom CSS themes. Preview every rule before importing it into a board.",
"securityNotice": "Workshop widgets can call their declared API sources and perform declared actions with credentials you configure locally. Secrets are never included.",
@@ -1445,16 +1447,29 @@
"voteError": "The vote could not be saved.",
"publish": {
"title": "Publish to Workshop",
"introTitle": "Share this widget with the community",
"introDescription": "Homarr exports a credential-free copy of the current widget. Add clear listing details so people know what it does before installing it.",
"listingDetails": "Workshop listing",
"listingDetailsDescription": "These details appear publicly alongside the exported widget definition.",
"success": "Published immediately. Community members can now install and report this widget.",
"successTitle": "Your widget is live",
"manageTitle": "Continue on Workshop",
"manageDescription": "Open the submission to update its listing, review reports, mark it outdated, or delete it. Submission management is handled directly on the Workshop website.",
"viewSubmission": "View and manage submission",
"done": "Done",
"signInHint": "Sign in to publish under your Workshop identity.",
"titleField": "Title",
"descriptionField": "Description",
"screenshots": "Screenshots",
"screenshotsDescription": "Up to five PNG, JPEG, or WebP images",
"screenshotsPlaceholder": "Choose screenshots",
"invalidScreenshot": "Use PNG, JPEG, or WebP images no larger than 5 MB each.",
"privateSourceWarning": "This widget contains private source URLs for: {sources}. Replace personal hosts or IP addresses with safe service placeholders before publishing.",
"reviewSourcesTitle": "Review private source URLs",
"privateSourceConfirmation": "I reviewed these source URLs and they do not expose private infrastructure details",
"action": "Publish now",
"cancel": "Cancel",
"publicationNote": "Publishing is immediate. You can manage the submission afterward on Workshop.",
"definitionChanged": "The widget changed while publication was being prepared. Review its private source URLs again, then retry.",
"error": "Publication failed"
},
+14
View File
@@ -32,6 +32,20 @@ describe("Workshop URL configuration", () => {
});
});
test("uses an explicit Workshop web URL for public Workshop links", () => {
expect(
resolveHomarrUrlConfig({
homarrWebsiteUrl: "https://homarr.example.com",
workshopApiUrl: "https://api.example.com",
workshopWebUrl: "https://community.example.com/workshop",
}),
).toEqual({
homarrWebsiteUrl: "https://homarr.example.com",
workshopApiUrl: "https://api.example.com",
workshopWebUrl: "https://community.example.com/workshop",
});
});
test("rejects unsafe or ambiguous public URLs", () => {
expect(() => normalizeHttpUrl("file:///tmp/workshop", "WORKSHOP_API_URL")).toThrow("HTTP or HTTPS");
expect(() => normalizeHttpUrl("https://user:secret@example.com", "WORKSHOP_API_URL")).toThrow("credentials");