fix: Plausible custom script
This commit is contained in:
parent
b081743f54
commit
98d901d06c
@ -7,7 +7,7 @@ import { checkContainer } from '$lib/haproxy';
|
|||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
|
|
||||||
function configureMiddleware(
|
function configureMiddleware(
|
||||||
{ id, container, port, domain, nakedDomain, isHttps, isWWW, isDualCerts },
|
{ id, container, port, domain, nakedDomain, isHttps, isWWW, isDualCerts, scriptName },
|
||||||
traefik
|
traefik
|
||||||
) {
|
) {
|
||||||
if (isHttps) {
|
if (isHttps) {
|
||||||
@ -125,6 +125,14 @@ function configureMiddleware(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (scriptName !== 'plausible.js') {
|
||||||
|
if (!traefik.http.routers[`${id}`].middlewares.includes(`${id}-redir`)) {
|
||||||
|
traefik.http.routers[`${id}`].middlewares.push(`${id}-redir`);
|
||||||
|
}
|
||||||
|
if (!traefik.http.routers[`${id}-secure`].middlewares.includes(`${id}-redir`)) {
|
||||||
|
traefik.http.routers[`${id}-secure`].middlewares.push(`${id}-redir`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export const get: RequestHandler = async (event) => {
|
export const get: RequestHandler = async (event) => {
|
||||||
const traefik = {
|
const traefik = {
|
||||||
@ -176,7 +184,7 @@ export const get: RequestHandler = async (event) => {
|
|||||||
} = application;
|
} = application;
|
||||||
if (destinationDockerId) {
|
if (destinationDockerId) {
|
||||||
const { engine, network } = destinationDocker;
|
const { engine, network } = destinationDocker;
|
||||||
const isRunning = await checkContainer(engine, id);
|
const isRunning = true;
|
||||||
if (fqdn) {
|
if (fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
const nakedDomain = domain.replace(/^www\./, '');
|
const nakedDomain = domain.replace(/^www\./, '');
|
||||||
@ -244,7 +252,7 @@ export const get: RequestHandler = async (event) => {
|
|||||||
if (found) {
|
if (found) {
|
||||||
const port = found.ports.main;
|
const port = found.ports.main;
|
||||||
const publicPort = service[type]?.publicPort;
|
const publicPort = service[type]?.publicPort;
|
||||||
const isRunning = await checkContainer(engine, id);
|
const isRunning = true;
|
||||||
if (fqdn) {
|
if (fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
const nakedDomain = domain.replace(/^www\./, '');
|
const nakedDomain = domain.replace(/^www\./, '');
|
||||||
|
Loading…
Reference in New Issue
Block a user