Skip to content

Backmerge hotfix : v0.117.11 #1345

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions docker/dockerfiles/frontend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ COPY --from=builder /app/build /usr/share/nginx/html
# Copy custom NGINX configuration
COPY --from=builder /app/nginx.conf /etc/nginx/nginx.conf

# Create config directory and set permissions
RUN mkdir -p /usr/share/nginx/html/config && \
chmod 777 /usr/share/nginx/html/config

# Copy the environment script
COPY ../frontend/generate-runtime-config.sh /docker-entrypoint.d/40-env.sh
RUN chmod +x /docker-entrypoint.d/40-env.sh

EXPOSE 80

USER nginx
Expand Down
3 changes: 0 additions & 3 deletions frontend/generate-runtime-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
# This script generates a runtime config file with environment variables
# It will be executed when the container starts

# Create config directory if it doesn't exist
mkdir -p /usr/share/nginx/html/config

# Generate the runtime-config.js file with the current environment variables
cat > /usr/share/nginx/html/config/runtime-config.js << EOF
// This file is auto-generated at runtime. Do not modify manually.
Expand Down
18 changes: 0 additions & 18 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,5 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module">
// Set favicon dynamically based on configuration
import config from '../src/config.js';

// Create a new link element for the favicon
const faviconLink = document.createElement('link');
faviconLink.rel = 'icon';
faviconLink.type = 'image/svg+xml';
faviconLink.href = config.favicon;

// Replace any existing favicon or add if none exists
const existingFavicon = document.querySelector('link[rel="icon"]');
if (existingFavicon) {
document.head.removeChild(existingFavicon);
}
document.head.appendChild(faviconLink);

</script>
</body>
</html>
15 changes: 15 additions & 0 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { GenericLoader } from "./components/generic-loader/GenericLoader";
import { LazyLoader } from "./components/widgets/lazy-loader/LazyLoader.jsx";
import { SocketProvider } from "./helpers/SocketContext.js";
import "./index.css";
import config from "./config.js";

const enablePosthog = process.env.REACT_APP_ENABLE_POSTHOG;
if (enablePosthog !== "false") {
Expand All @@ -22,6 +23,20 @@ if (enablePosthog !== "false") {
});
}

// Utility to set favicon
function setFavicon(url) {
let link = document.querySelector("link[rel~='icon']");
if (!link) {
link = document.createElement("link");
link.rel = "icon";
document.head.appendChild(link);
}
link.href = url;
}

// Call this after config is loaded
setFavicon(config.favicon);

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
Expand Down