feat(outlook-addin): serve static files and prevent SPA routing for add-in paths
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m6s

This commit is contained in:
2026-03-02 11:31:56 +01:00
parent 13c60ba052
commit af7540eb8c
2 changed files with 86 additions and 24 deletions

View File

@@ -26,7 +26,7 @@
<FormSettings>
<Form xsi:type="ItemEdit">
<DesktopSettings>
<SourceLocation DefaultValue="https://your-redlight-instance.com/outlook-addin/taskpane.html" />
<SourceLocation DefaultValue="https://redlight.scrunkly.cat/outlook-addin/taskpane.html" />
<RequestedHeight>600</RequestedHeight>
</DesktopSettings>
</Form>
@@ -37,8 +37,7 @@
<Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
</Rule>
<DisableEntityHighlighting>true</DisableEntityHighlighting>
<!-- VersionOverrides V1.0 (Desktop) -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides"
xsi:type="VersionOverridesV1_0">
<Requirements>
@@ -75,34 +74,17 @@
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
<!-- Mobile support -->
<MobileFormFactor>
<ExtensionPoint xsi:type="MobileOnlineMeetingCommandSurface">
<Control xsi:type="MobileButton" id="redlightMobileButton">
<Label resid="buttonLabel" />
<Icon>
<bt:Image size="25" resid="icon32" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="48" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="taskpaneUrl" />
</Action>
</Control>
</ExtensionPoint>
</MobileFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://your-redlight-instance.com/outlook-addin/assets/icon-16.png" />
<bt:Image id="icon32" DefaultValue="https://your-redlight-instance.com/outlook-addin/assets/icon-32.png" />
<bt:Image id="icon80" DefaultValue="https://your-redlight-instance.com/outlook-addin/assets/icon-80.png" />
<bt:Image id="icon16" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-16.png" />
<bt:Image id="icon32" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-32.png" />
<bt:Image id="icon80" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="taskpaneUrl" DefaultValue="https://your-redlight-instance.com/outlook-addin/taskpane.html" />
<bt:Url id="taskpaneUrl" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/taskpane.html" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="Redlight" />
@@ -113,5 +95,80 @@
</bt:LongStrings>
</Resources>
<!-- VersionOverrides V1.1 (Mobile) -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1"
xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.5">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="redlightGroup">
<Label resid="groupLabel" />
<Control xsi:type="Button" id="redlightButton">
<Label resid="buttonLabel" />
<Supertip>
<Title resid="buttonLabel" />
<Description resid="buttonDesc" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="taskpaneUrl" />
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
<MobileFormFactor>
<ExtensionPoint xsi:type="MobileOnlineMeetingCommandSurface">
<Control xsi:type="MobileButton" id="redlightMobileButton">
<Label resid="buttonLabel" />
<Icon>
<bt:Image size="25" resid="icon32" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="48" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="taskpaneUrl" />
</Action>
</Control>
</ExtensionPoint>
</MobileFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-16.png" />
<bt:Image id="icon32" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-32.png" />
<bt:Image id="icon80" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/assets/icon-80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="taskpaneUrl" DefaultValue="https://redlight.scrunkly.cat/outlook-addin/taskpane.html" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="Redlight" />
<bt:String id="buttonLabel" DefaultValue="Redlight Meeting" />
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="buttonDesc" DefaultValue="Create or select a Redlight meeting room and insert the join link into this event." />
</bt:LongStrings>
</Resources>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>

View File

@@ -59,10 +59,15 @@ async function start() {
app.use('/api/federation', calendarRoutes);
app.get('/.well-known/redlight', wellKnownHandler);
// Serve Outlook Add-in static files (before SPA catch-all)
app.use('/outlook-addin', express.static(path.join(__dirname, '..', 'outlook-addin')));
// Serve static files in production
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, '..', 'dist')));
app.get('*', (req, res) => {
// Don't serve SPA for outlook-addin paths
if (req.path.startsWith('/outlook-addin')) return res.status(404).end();
res.sendFile(path.join(__dirname, '..', 'dist', 'index.html'));
});
}