refactor: improve favicon handling and reorganize static assets

- Move public folder to project root for better organization
- Add proper favicon configuration for all routes using serve-favicon
- Add multiple favicon sizes and formats for better device compatibility
- Add theme-color meta tag for mobile browsers
- Add proper meta description for SEO
- Configure static file serving for both API and configuration page

Changes:
- Moved /configure/public to /public
- Added serve-favicon middleware
- Updated index.html with proper meta tags and favicon links
- Updated static file serving configuration in index.js
- Added proper cache headers for static assets

This change improves the organization of static assets and ensures
the favicon is properly displayed across all routes and devices.
This commit is contained in:
mrcanelas
2025-03-07 18:20:47 -03:00
parent e9185e5126
commit c857d18e2a
41 changed files with 87 additions and 55 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ COPY --from=builder /app/addon ./addon
COPY --from=builder /app/dist ./dist
# Copia a pasta public com as imagens
COPY --from=builder /app/configure/public ./public
COPY --from=builder /app/public ./public
# Exposição da porta
EXPOSE 1337
+3 -2
View File
@@ -1,4 +1,5 @@
const express = require("express");
const favicon = require('serve-favicon');
const path = require("path")
const addon = express();
const analytics = require('./utils/analytics');
@@ -16,6 +17,8 @@ const { blurImage } = require('./utils/imageProcessor');
const analyticsMiddleware = require('./middleware/analytics.middleware');
addon.use(analyticsMiddleware());
addon.use(favicon(path.join(__dirname, '../public/favicon.png')));
addon.use(express.static(path.join(__dirname, '../public')));
addon.use(express.static(path.join(__dirname, '../dist')));
const getCacheHeaders = function (opts) {
@@ -73,8 +76,6 @@ addon.get('/stats', async (req, res) => {
}
});
addon.use('/streaming', express.static(path.join(__dirname, '../public/streaming')));
addon.use('/configure', express.static(path.join(__dirname, '../dist')));
addon.use('/configure', (req, res, next) => {
+3 -3
View File
@@ -166,9 +166,9 @@ async function getManifest(config) {
return {
id: packageJson.name,
version: packageJson.version,
favicon: "https://github.com/mrcanelas/tmdb-addon/raw/main/addon/images/favicon.png",
logo: "https://github.com/mrcanelas/tmdb-addon/raw/main/addon/images/logo.png",
background: "https://github.com/mrcanelas/tmdb-addon/raw/main/addon/images/background.png",
favicon: `${process.env.HOST_NAME}/favicon.png`,
logo: `${process.env.HOST_NAME}/logo.png`,
background: `${process.env.HOST_NAME}/background.png`,
name: "The Movie Database Addon",
description: packageJson.description + descriptionSuffix,
resources: ["catalog", "meta"],
-25
View File
@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/svg+xml" href="/vite.svg"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Streaming Catalogs</title>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S47YFG3SDZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-S47YFG3SDZ');
</script>
<script type="module" crossorigin src="/assets/index.0f7d9069.js"></script>
<link rel="stylesheet" href="/assets/index.79bc1b06.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
+23 -23
View File
@@ -1,27 +1,27 @@
export const streamingServices = [
{ id: "nfx", name: "Netflix", icon: "/streaming/netflix.webp" },
{ id: "nfk", name: "Netflix Kids", icon: "/streaming/netflixkids.webp" },
{ id: "hbm", name: "HBO Max", icon: "/streaming/hbo.webp" },
{ id: "dnp", name: "Disney+", icon: "/streaming/disney.webp" },
{ id: "amp", name: "Prime Video", icon: "/streaming/prime.webp" },
{ id: "atp", name: "Apple TV+", icon: "/streaming/apple.webp" },
{ id: "pmp", name: "Paramount+", icon: "/streaming/paramount.webp" },
{ id: "pcp", name: "Peacock Premium", icon: "/streaming/peacock.webp" },
{ id: "hlu", name: "Hulu", icon: "/streaming/hulu.webp" },
{ id: "cts", name: "Curiosity Stream", icon: "/streaming/curiositystream.webp" },
{ id: "mgl", name: "MagellanTV", icon: "/streaming/magellan.webp" },
{ id: "cru", name: "Crunchyroll", icon: "/streaming/crunchyroll.webp" },
{ id: "hay", name: "Hayu", icon: "/streaming/hayu.webp" },
{ id: "clv", name: "Clarovideo", icon: "/streaming/claro.webp" },
{ id: "gop", name: "Globoplay", icon: "/streaming/globo.webp" },
{ id: "hst", name: "Hotstar", icon: "/streaming/hotstar.webp" },
{ id: "zee", name: "Zee5", icon: "/streaming/zee5.webp" },
{ id: "nlz", name: "NLZIET", icon: "/streaming/nlziet.webp" },
{ id: "vil", name: "Videoland", icon: "/streaming/videoland.webp" },
{ id: "sst", name: "SkyShowtime", icon: "/streaming/skyshowtime.webp" },
{ id: "blv", name: "BluTV", icon: "/streaming/blu.webp" },
{ id: "cpd", name: "Canal+", icon: "/streaming/canal-plus.webp" },
{ id: "dpe", name: "Discovery+", icon: "/streaming/discovery-plus.webp" }
{ id: "nfx", name: "Netflix", icon: "/netflix.webp" },
{ id: "nfk", name: "Netflix Kids", icon: "/netflixkids.webp" },
{ id: "hbm", name: "HBO Max", icon: "/hbo.webp" },
{ id: "dnp", name: "Disney+", icon: "/disney.webp" },
{ id: "amp", name: "Prime Video", icon: "/prime.webp" },
{ id: "atp", name: "Apple TV+", icon: "/apple.webp" },
{ id: "pmp", name: "Paramount+", icon: "/paramount.webp" },
{ id: "pcp", name: "Peacock Premium", icon: "/peacock.webp" },
{ id: "hlu", name: "Hulu", icon: "/hulu.webp" },
{ id: "cts", name: "Curiosity Stream", icon: "/curiositystream.webp" },
{ id: "mgl", name: "MagellanTV", icon: "/magellan.webp" },
{ id: "cru", name: "Crunchyroll", icon: "/crunchyroll.webp" },
{ id: "hay", name: "Hayu", icon: "/hayu.webp" },
{ id: "clv", name: "Clarovideo", icon: "/claro.webp" },
{ id: "gop", name: "Globoplay", icon: "/globo.webp" },
{ id: "hst", name: "Hotstar", icon: "/hotstar.webp" },
{ id: "zee", name: "Zee5", icon: "/zee5.webp" },
{ id: "nlz", name: "NLZIET", icon: "/nlziet.webp" },
{ id: "vil", name: "Videoland", icon: "/videoland.webp" },
{ id: "sst", name: "SkyShowtime", icon: "/skyshowtime.webp" },
{ id: "blv", name: "BluTV", icon: "/blu.webp" },
{ id: "cpd", name: "Canal+", icon: "/canal-plus.webp" },
{ id: "dpe", name: "Discovery+", icon: "/discovery-plus.webp" }
];
export const regions = {
+6 -1
View File
@@ -4,7 +4,12 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Movie Database Addon - Stremio Addon</title>
<link rel="shortcut icon" href="https://github.com/mrcanelas/tmdb-addon/raw/main/images/favicon.png" type="image/x-icon" />
<link rel="icon" href="/favicon.png" type="image/png" sizes="32x32" />
<link rel="icon" href="/favicon.png" type="image/png" sizes="16x16" />
<link rel="apple-touch-icon" href="/favicon.png" />
<link rel="shortcut icon" href="/favicon.png" type="image/png" />
<meta name="theme-color" content="#01b4e4" />
<meta name="description" content="Configure your TMDB Addon for Stremio" />
</head>
<body>
+50
View File
@@ -40,6 +40,7 @@
"react-dom": "^18.3.1",
"react-kofi": "^0.0.2",
"react-router-dom": "^6.26.2",
"serve-favicon": "^2.5.0",
"sharp": "^0.33.5",
"sonner": "^1.5.0",
"tailwind-merge": "^2.5.2",
@@ -7406,6 +7407,31 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/serve-favicon": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz",
"integrity": "sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA==",
"dependencies": {
"etag": "~1.8.1",
"fresh": "0.5.2",
"ms": "2.1.1",
"parseurl": "~1.3.2",
"safe-buffer": "5.1.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/serve-favicon/node_modules/ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"node_modules/serve-favicon/node_modules/safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"node_modules/serve-static": {
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
@@ -12897,6 +12923,30 @@
}
}
},
"serve-favicon": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz",
"integrity": "sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA==",
"requires": {
"etag": "~1.8.1",
"fresh": "0.5.2",
"ms": "2.1.1",
"parseurl": "~1.3.2",
"safe-buffer": "5.1.1"
},
"dependencies": {
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
}
}
},
"serve-static": {
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+1
View File
@@ -58,6 +58,7 @@
"react-dom": "^18.3.1",
"react-kofi": "^0.0.2",
"react-router-dom": "^6.26.2",
"serve-favicon": "^2.5.0",
"sharp": "^0.33.5",
"sonner": "^1.5.0",
"tailwind-merge": "^2.5.2",

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 720 B

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 864 B

After

Width:  |  Height:  |  Size: 864 B

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 914 B

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 848 B

After

Width:  |  Height:  |  Size: 848 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 828 B

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 998 B

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 594 B

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 181 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB