fix(workshop): harden deployment and deep links (#6542)
This commit is contained in:
1 parent
557ebe0a2f
commit
8ab3f136b8
9 files changed
+68
-5
No files matched your search
@@ -95,7 +95,8 @@ irreversible development reset.
|
||||
GitHub needs only the central callback `https://<workshop-host>/api/oauth2-redirect`. Keep PocketBase origins unrestricted
|
||||
unless every self-hosted Homarr caller is explicitly listed. Configure both `GITHUB_CLIENT_ID` and
|
||||
`GITHUB_CLIENT_SECRET`; supplying only one is a startup error. Set `WORKSHOP_PUBLIC_ORIGIN` in production so generated
|
||||
links and email use the public host. Configure SMTP for comment, report, and removal notices.
|
||||
links and email use the public host. Workshop uses the OAuth provider username as the public display name instead of
|
||||
the profile's full name. Configure SMTP for comment, report, and removal notices.
|
||||
|
||||
The public URL contract is:
|
||||
|
||||
|
||||
@@ -345,6 +345,55 @@ const config: Config = {
|
||||
function workshopRoutesPlugin() {
|
||||
return {
|
||||
name: "workshop-routes",
|
||||
injectHtmlTags() {
|
||||
return {
|
||||
headTags: [
|
||||
{
|
||||
tagName: "style",
|
||||
innerHTML: `
|
||||
#workshop-detail-route-fallback { display: none; }
|
||||
html[data-workshop-detail-loading] #__docusaurus { display: none; }
|
||||
html[data-workshop-detail-loading] #workshop-detail-route-fallback {
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
color: #4b5563;
|
||||
display: flex;
|
||||
font: 500 0.875rem/1.5 Inter, system-ui, sans-serif;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding: 2rem;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html[data-workshop-detail-loading] #workshop-detail-route-fallback {
|
||||
background: #18191a;
|
||||
color: #d1d5db;
|
||||
}
|
||||
}`,
|
||||
},
|
||||
{
|
||||
tagName: "script",
|
||||
innerHTML: `(function () {
|
||||
var match = window.location.pathname.match(/^\\/workshop\\/([^/]+)\\/?$/);
|
||||
if (match && match[1] !== "admin") {
|
||||
document.documentElement.setAttribute("data-workshop-detail-loading", "");
|
||||
}
|
||||
})();`,
|
||||
},
|
||||
],
|
||||
preBodyTags: [
|
||||
{
|
||||
tagName: "div",
|
||||
attributes: {
|
||||
id: "workshop-detail-route-fallback",
|
||||
role: "status",
|
||||
"aria-live": "polite",
|
||||
},
|
||||
innerHTML: "Loading Workshop…",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
async contentLoaded({ actions }) {
|
||||
actions.addRoute({
|
||||
path: "/workshop/:id",
|
||||
|
||||
@@ -1018,6 +1018,10 @@ export default function MarketplaceDetailPage() {
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
const configuredWorkshopUrl = (siteConfig.customFields?.workshopUrl as string | undefined) ?? "";
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.removeAttribute("data-workshop-detail-loading");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Layout title="Workshop" description="Community custom CSS and custom widgets for Homarr">
|
||||
<main className="marketplace bg-background text-foreground min-h-[80vh]">
|
||||
|
||||
Reference in new issue
Block a user