diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0bda5d7b..9dc282b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,6 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-yaml - id: check-added-large-files - repo: https://github.com/pre-commit/mirrors-prettier rev: "v2.7.1" # Use the sha / tag you want to point at diff --git a/proxy/kube.yml b/proxy/kube.yml index 197447b2..896924cd 100644 --- a/proxy/kube.yml +++ b/proxy/kube.yml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: taxonium-proxy-deployment spec: - replicas: 1 # Number of replicas + replicas: 1 # Number of replicas selector: matchLabels: app: taxonium-proxy @@ -13,10 +13,10 @@ spec: app: taxonium-proxy spec: containers: - - name: taxonium-proxy - image: theosanderson/taxonium_proxy:master - ports: - - containerPort: 3000 + - name: taxonium-proxy + image: theosanderson/taxonium_proxy:master + ports: + - containerPort: 3000 --- apiVersion: v1 @@ -36,20 +36,20 @@ kind: Ingress metadata: name: taxonium-proxy-ingress annotations: - kubernetes.io/ingress.class: "nginx" # assuming you are using nginx ingress controller + kubernetes.io/ingress.class: "nginx" # assuming you are using nginx ingress controller spec: rules: - - host: proxy.taxonium.org - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: taxonium-proxy-service - port: - number: 80 + - host: proxy.taxonium.org + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: taxonium-proxy-service + port: + number: 80 tls: - - hosts: - - proxy.taxonium.org - secretName: tls-proxy2 \ No newline at end of file + - hosts: + - proxy.taxonium.org + secretName: tls-proxy2 diff --git a/proxy/server.js b/proxy/server.js index f0a1fb1e..72dfff39 100644 --- a/proxy/server.js +++ b/proxy/server.js @@ -22,7 +22,6 @@ const corsOptions = { app.use(cors(corsOptions)); - // Rate limiting middleware const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes diff --git a/taxonium_component/src/utils/processNextstrain.js b/taxonium_component/src/utils/processNextstrain.js index d6950344..1dc79754 100644 --- a/taxonium_component/src/utils/processNextstrain.js +++ b/taxonium_component/src/utils/processNextstrain.js @@ -419,26 +419,31 @@ async function json_to_tree(json) { console.log("META PROV", json.meta.data_provenance); config.source = ""; if (json.meta && json.meta.data_provenance) { - config.source = config.source + - json.meta.data_provenance.map((source) => source.name).join(" & ") - + config.source = + config.source + + json.meta.data_provenance.map((source) => source.name).join(" & "); } config.overlay = `
This is a tree generated from a Nextstrain JSON file, being visualised in Taxonium.
.`; if (json.meta && json.meta.updated) { - config.source = config.source + " on " + - json.meta.updated ; + config.source = config.source + " on " + json.meta.updated; } if (json.meta && json.meta.maintainers) { - config.source = config.source + " in a build maintained by " + + config.source = + config.source + + " in a build maintained by " + json.meta.maintainers.map((source) => source.name).join(" & "); - - const maintainerLinks = json.meta.maintainers.map((source) => `${source.name}`).join(" & "); + + const maintainerLinks = json.meta.maintainers + .map( + (source) => + `${source.name}` + ) + .join(" & "); config.overlay += `The Nextstrain build is maintained by ${maintainerLinks}.
`; } - if (json.meta.build_url) { config.overlay += `The Nextstrain build is available here.
`; } diff --git a/taxonium_website/src/components/InputSupplier.jsx b/taxonium_website/src/components/InputSupplier.jsx index cd951791..63804e65 100644 --- a/taxonium_website/src/components/InputSupplier.jsx +++ b/taxonium_website/src/components/InputSupplier.jsx @@ -30,17 +30,24 @@ export const InputSupplier = ({ inputHelper, className }) => { }); const [tempURL, setTempURL] = useState(""); + const [useProxy, setUseProxy] = useState(true); // New state for proxy usage const { inputs, setInputs } = inputHelper; const [addingText, setAddingText] = useState(false); const [text, setText] = useState(""); const addFromTempURL = useCallback(() => { - if (tempURL) { - inputHelper.addFromURL(tempURL); + let finalURL = tempURL; + if (useProxy) { + finalURL = `https://proxy.taxonium.org/proxy?url=${encodeURIComponent( + tempURL + )}`; + } + if (finalURL) { + inputHelper.addFromURL(finalURL); setTempURL(""); } - }, [tempURL, inputHelper]); + }, [tempURL, useProxy, inputHelper]); // Include useProxy in the dependency array return (