Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support hosting sofie under subdirectory #1405

Open
wants to merge 1 commit into
base: release53
Choose a base branch
from

Conversation

Julusian
Copy link
Contributor

About the Contributor

This pull request is posted on behalf of the BBC

Type of Contribution

This is a: Feature

New Behavior

This allows sofie to be hosted under a subdirectory instead of at the root of a domain.

It is controlled by the meteor ROOT_URL environment variable, should be set to something like http://my-domain/sofie/.

Going forward this will require some care from devs to not break, which should be limited to needing to ensure that the correct subpath prefix is used whenever generating urls or absolute paths.

To allow this to work purely runtime, when meteor serves the webui it is performing some path mangling to provide the correct paths. Vite is also setup to host in development in a similar way, for easier development testing.

As part of this, I have changed how the meteor config gets fed to the client. The webui is now reliant on loading the config before it can start to do other things or the paths will be wrong, making the previous approach of including a file hazardous. (This gave some frustration during dev, as if the config didnt load in time, react-router would decide that the subpath the page was loaded over to be 'wrong' and redirect to the root of the domain, causing subsequent page loads and some assets to fail).
As we already need to mangle the html file to update the paths, we now inject the config into the file instead.
During development it still loads as its own file, because the html does not touch meteor.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

I have tested this in dev with and without a subdir, both direct and behind nginx.
And in docker both with and without a subdir.

Affected areas

Time Frame

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@Julusian Julusian requested a review from a team as a code owner March 13, 2025 14:24
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 22.22222% with 77 lines in your changes missing coverage. Please review.

Project coverage is 56.26%. Comparing base (d7ca0ed) to head (9ac1d17).
Report is 1 commits behind head on release53.

Files with missing lines Patch % Lines
meteor/server/api/rest/koa.ts 23.72% 45 Missing ⚠️
meteor/server/webmanifest.ts 0.00% 29 Missing ⚠️
meteor/server/api/rest/api.ts 0.00% 2 Missing ⚠️
meteor/server/api/peripheralDevice.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           release53    #1405      +/-   ##
=============================================
- Coverage      56.87%   56.26%   -0.61%     
=============================================
  Files            404      404              
  Lines          73147    73197      +50     
  Branches        4041     4011      -30     
=============================================
- Hits           41603    41187     -416     
- Misses         31410    31876     +466     
  Partials         134      134              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jstarpl jstarpl added Contribution External contribution Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) labels Mar 20, 2025
@Julusian Julusian force-pushed the upstream/support-serving-sub-directory branch from daa08d0 to 9ac1d17 Compare March 26, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) Contribution External contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants