from os.path import expanduser from pathlib import Path from frontools import Config # type: ignore HOME = Path(expanduser("~")) PUBLIK_BASE_THEME_ROOT = HOME / "src/publik-base-theme" IMIO_THEME_ROOT = HOME / "src/imio-publik-themes" TEST_NODES = [ "cd31-test", "combo.node1.test-hds.saas.entrouvert", "combo.node1.test.saas.entrouvert.org", "cr-reunion-test", "grandlyon-guichet-test-1", "grenoble-test", "lille-test", "moselle-test", "nanterre-preprod-web1", "node1.test-re.saas.entrouvert", "sictiam-test", "sitiv-test", "toulouse-bac-a-sable", "toulouse-test-1", "villejuif-test", # "cnil-test", down ] PROD_NODES = [ "amiens-prod", "cd31-prod", "combo.node1.hds.saas.entrouvert", "combo.node1.prod.saas.entrouvert.org", "cr-reunion-prod", "grenoble-prod", "lille-prod", "moselle-prod", "node1.re.saas.entrouvert", "sictiam-prod", "sitiv-prod", "toulouse-1", "villejuif-prod", # "cnil-prod", down # "grandlyon-guichet-prod-1", no access to it ] # Misc urls I struggled to get on tenants EO_TEST_URLS = [ "https://portail-lessables.test.entrouvert.org", "https://demarches-recette.cr-reunion.fr/", ] EO_PROD_URLS = [ # "https://lessablesdolonneen1clic.fr" # en 1 clic mais en 2315 caractères, erreur avec aiohttp "https://demarches.cr-reunion.fr/" "https://demarches.grenoblealpesmetropole.fr/", "https://moncompte.grandlyon.com/login", "https://support.grandlyon.com/", "https://www.toodego.com/connect/", ] IMIO_URLS = [ "https://aiseaupresles.guichet-citoyen.be", "https://andenne.guichet-citoyen.be", "https://anderlues.guichet-citoyen.be", "https://ans.guichet-citoyen.be", "https://antoing.guichet-citoyen.be", "https://arlon.guichet-citoyen.be", "https://assesse.guichet-citoyen.be", "https://ath.guichet-citoyen.be", "https://awans.guichet-citoyen.be", "https://bastogne.guichet-citoyen.be", "https://beauraing.guichet-citoyen.be", "https://beauvechain.guichet-citoyen.be", "https://binche.guichet-citoyen.be", "https://boussu.guichet-citoyen.be", "https://burdinne.guichet-citoyen.be", "https://charleroi.guichet-citoyen.be", "https://chastre.guichet-citoyen.be", "https://chatelet.guichet-citoyen.be", "https://chaudfontaine.guichet-citoyen.be", "https://chaumontgistoux.guichet-citoyen.be", "https://chimay.guichet-citoyen.be", "https://colfontaine.guichet-citoyen.be", "https://comineswarneton.guichet-citoyen.be", "https://courcelles.guichet-citoyen.be", "https://couvin.guichet-citoyen.be", "https://dalhem.guichet-citoyen.be", "https://demo.guichet-citoyen.be", "https://dison.guichet-citoyen.be", "https://doische.guichet-citoyen.be", "https://e-guichet.braine-lalleud.be", "https://e-guichet.liege.be", "https://ecaussinnes.guichet-citoyen.be", "https://eghezee.guichet-citoyen.be", "https://enghien.guichet-citoyen.be", "https://engis.guichet-citoyen.be", "https://erquelinnes.guichet-citoyen.be", "https://eupen.guichet-citoyen.be", "https://faimes.guichet-citoyen.be", "https://farciennes.guichet-citoyen.be", "https://flemalle.guichet-citoyen.be", "https://fleron.guichet-citoyen.be", "https://florennes.guichet-citoyen.be", "https://florenville.guichet-citoyen.be", "https://fontaineleveque.guichet-citoyen.be", "https://frasneslezanvaing.guichet-citoyen.be", "https://froidchapelle.guichet-citoyen.be", "https://geer.guichet-citoyen.be", "https://gembloux.guichet-citoyen.be", "https://genappe.guichet-citoyen.be", "https://gerpinnes.guichet-citoyen.be", "https://grezdoiceau.guichet-citoyen.be", "https://habay.guichet-citoyen.be", "https://hamoir.guichet-citoyen.be", "https://helecine.guichet-citoyen.be", "https://hensies.guichet-citoyen.be", "https://honnelles.guichet-citoyen.be", "https://huy.guichet-citoyen.be", "https://iile.guichet-citoyen.be", "https://jalhay.guichet-citoyen.be", "https://jurbise.guichet-citoyen.be", "https://kelmis.guichet-citoyen.be", "https://lalouviere.guichet-citoyen.be", "https://lasne.guichet-citoyen.be", "https://leglise.guichet-citoyen.be", "https://lierneux.guichet-citoyen.be", "https://marche.guichet-citoyen.be", "https://merbeslechateau.guichet-citoyen.be", "https://messancy.guichet-citoyen.be", "https://mons.guichet-citoyen.be", "https://montsaintguibert.guichet-citoyen.be", "https://mouscron.guichet-citoyen.be", "https://musson.guichet-citoyen.be", "https://my.imio.be", "https://namur.guichet-citoyen.be", "https://olln.guichet-citoyen.be", "https://paliseul.guichet-citoyen.be", "https://pecq.guichet-citoyen.be", "https://peruwelz.guichet-citoyen.be", "https://ramillies.guichet-citoyen.be", "https://rebecq.guichet-citoyen.be", "https://remicourt.guichet-citoyen.be", "https://rixensart.guichet-citoyen.be", "https://rochefort.guichet-citoyen.be", "https://sainteode.guichet-citoyen.be", "https://sainthubert.guichet-citoyen.be", "https://saintnicolas.guichet-citoyen.be", "https://sambreville.guichet-citoyen.be", "https://seneffe.guichet-citoyen.be", "https://seraing.guichet-citoyen.be", "https://silly.guichet-citoyen.be", "https://sombreffe.guichet-citoyen.be", "https://sprimont.guichet-citoyen.be", "https://stavelot.guichet-citoyen.be", "https://stoumont.guichet-citoyen.be", "https://theux.guichet-citoyen.be", "https://thuin.guichet-citoyen.be", "https://tintigny.guichet-citoyen.be", "https://tournai.guichet-citoyen.be", "https://troisponts.guichet-citoyen.be", "https://usagers.wallonie-connect.be/login", "https://verviers.guichet-citoyen.be", "https://vielsalm.guichet-citoyen.be", "https://villerslebouillet.guichet-citoyen.be", "https://viroinval.guichet-citoyen.be", "https://virton.guichet-citoyen.be", "https://walhain.guichet-citoyen.be", "https://wanze.guichet-citoyen.be", "https://waterloo.guichet-citoyen.be", "https://welkenraedt.guichet-citoyen.be", "https://www.mytournai.be", "https://yvoir.guichet-citoyen.be", # "https://staging.guichet-citoyen.be", make aiohttp dangling # "https://staging2.guichet-citoyen.be/home", make aiohttp dangling ] IGNORED_THEMES = [ # eo - dangling / legacy tenants "alfortville", "blois-2018", "grandlyon-gnm", "marcoussis", "meaux", "region-reunion", "vincennes-2018", # eo - self-hosted instances ? "dauphine", # eo - legacy themes "castries-2020", # replaced by castries "hautes-alpes-2018", # replaced by hautes-alpes-cd05-2020 but not it's configured in hobo.json ??? "la-seyne-sur-mer", # replaced by la-seyne-sur-mer-v2 (sictiam) "pratic", # dangling "sables-d-olonne", # replaced by sables-dolonne-2022 "seine-et-marne", # replaced by seine-et-marne-apa ? "tonneville", # dangling "urville-nacqueville", # dangling # imio - shutted down / switched to e-guichet.be "ciney", "fernelmont", "lessines", "letsgocity", "malmedy", "orpjauche", "oupeye", "perwez", "ploneconf", "quaregnon", "rendeux", "wasseiges", # imio - legacy "brainelalleud", # Moved from IMIO to publik-base-theme braine-l-alleud "liege", # replaced by liege-pwa-2019 used # imio - crap "staging1", "test", "theme_clean", # sictiam "bandol", "bauxalpilles", "cannes", "capdail", "cdg46", "cdg47", "la-seyne-sur-mer-v2", "lecastellet", "smopaca", "theme-sictiam-demo-v2", "training-sictiam", "tsl", "vienneservices-v2", "villefranche", ] async def CONFIG(config: Config) -> None: config.add_local_themes_root(PUBLIK_BASE_THEME_ROOT, IMIO_THEME_ROOT) def _add_urls(urls: list[str], tags: list[str]): for url in urls: config.add_urls((url, tags, None)) _add_urls(IMIO_URLS, ["imio", "prod"]) _add_urls(EO_TEST_URLS, ["eo", "test"]) _add_urls(EO_PROD_URLS, ["eo", "prod"]) def _add_nodes(nodes: list[str], tags: list[str]): for node in nodes: config.add_nodes((node, tags)) _add_nodes(TEST_NODES, ["eo", "test"]) _add_nodes(PROD_NODES, ["eo", "prod"]) config.ignore_themes(*IGNORED_THEMES) config.add_override_source( "local", ( r".*static/(?P[\w-]*)/style.css(.map)?.*", rf"{PUBLIK_BASE_THEME_ROOT}/static/\g/style.css", ), ( r".*static/(?P[\w-]*)/style.css(.map)?.*", rf"{IMIO_THEME_ROOT}/static/\g/style.css", ), ) config.block_urls( ".*google-analytics.com.*", ".*matomo.entrouvert.org.*", ".*matomo.php.*", ".*matomo.js.*", ".*piwik.entrouvert.org.*", ".*piwik.php.*", ".*wikit.ai*", ".*xiti.com.*", r".*lessablesdolonneen1clic.fr/media/uploads/.*\.mp4", )