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

Fix/core url not set for gui SOFIE-94 #8

Draft
wants to merge 5 commits into
base: release51
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meteor/client/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" data-href="/site.webmanifest" />
<link rel="manifest" href="/site.webmanifest" data-href="./site.webmanifest" />
Copy link
Collaborator

@Julusian Julusian Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work properly.
If you load the page https://my-domain/sofie/settings/tools/snapshots, the client tries to find this at https://my-domain/sofie/settings/tools/site.webmanifest?lng=en-GB, which is not correct.

The other paths which are still absolute also fail to load

<link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#5bbad5" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="msapplication-TileColor" content="#da532c" />
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
// in some versions of Chrome, registering the Service Worker over HTTP throws an arror
if (window.location.protocol === 'https:' || window.location.hostname === 'localhost') {
navigator.serviceWorker.register('/sw.js').catch((err) => {
navigator.serviceWorker.register(Meteor.absoluteUrl('./sw.js')).catch((err) => {
logger.error('Error registering serviceWorker', err)
})
}
Expand Down
5 changes: 4 additions & 1 deletion meteor/client/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { DocumentTitleProvider } from '../lib/DocumentTitleProvider'
import { Spinner } from '../lib/Spinner'
import { catchError, isRunningInPWA } from '../lib/lib'
import { firstIfArray, protectString } from '../../lib/lib'
import { Meteor } from 'meteor/meteor'

const NullComponent = () => null

Expand Down Expand Up @@ -90,6 +91,8 @@ export const App: React.FC = function App() {
const roles = useRoles(user, subsReady)
const featureFlags = useFeatureFlags()

const sofieRootPath = new URL(Meteor.absoluteUrl()).pathname

useEffect(() => {
if (user) return

Expand Down Expand Up @@ -201,7 +204,7 @@ export const App: React.FC = function App() {
return (
<UserContext.Provider value={user}>
<UserSubscriptionReadyContext.Provider value={subsReady}>
<Router getUserConfirmation={onNavigationUserConfirmation}>
<Router getUserConfirmation={onNavigationUserConfirmation} basename={sofieRootPath}>
<div className="container-fluid header-clear">
{/* Header switch - render the usual header for all pages but the rundown view */}
{isAuthenticated && (
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/ui/RundownList/GettingStarted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function GettingStarted({ step }: Readonly<IGettingStartedProps>): JSX.El
visible={step === ToolTipStep.TOOLTIP_RUN_MIGRATIONS}
placement="bottom"
>
<a href="/settings/tools/migration">{t('Migrations')}</a>
<a href="./settings/tools/migration">{t('Migrations')}</a>
</Tooltip>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/ui/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const i18nOptions = {
},

backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json',
loadPath: Meteor.absoluteUrl('./locales/{{lng}}/{{ns}}.json'),
},

detection: {
Expand Down