From 2ae6488249eb75cbc41d7f44a8d3ca34496f09f1 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 3 Mar 2025 00:02:09 +0100 Subject: [PATCH] Fixing some jekyll things and removing old subdomains --- _config.yml | 13 +++++++++++++ domains.yaml | 4 +--- update_cloudflare_dns.py | 17 +++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/_config.yml b/_config.yml index ddf0b0a..9be2bc1 100644 --- a/_config.yml +++ b/_config.yml @@ -1,9 +1,22 @@ title: Morlana - Pages description: >- Free Subdomains provided by Morlana + baseurl: "/" url: "https://morlana.page" + show_downloads: false + remote_theme: pages-themes/midnight@v0.2.0 plugins: - jekyll-remote-theme + +defaults: + - scope: + path: "README.md" + values: + layout: "default" + title: "Morlana.page Documentation" + +include: + - "README.md" diff --git a/domains.yaml b/domains.yaml index 0f10c9e..aea80c4 100644 --- a/domains.yaml +++ b/domains.yaml @@ -3,9 +3,7 @@ reserved_domains: - "^admin\\..*" - "^internal\\..*" -subdomains: - - name: sitiriotv - target: justin.morlana.space +subdomains: [] # - name: "example" # target: "example.com" # proxy: true diff --git a/update_cloudflare_dns.py b/update_cloudflare_dns.py index 666713c..3fb899c 100644 --- a/update_cloudflare_dns.py +++ b/update_cloudflare_dns.py @@ -29,13 +29,22 @@ def get_existing_records(): def update_cloudflare(): data = load_domains() reserved_patterns = data.get("reserved_domains", []) - subdomains = data.get("subdomains", []) + subdomains = {f"{sub['name']}.morlana.page": sub for sub in data.get("subdomains", [])} existing_records = get_existing_records() - for subdomain in subdomains: - full_domain = f"{subdomain['name']}.morlana.page" - + # Entferne Einträge, die nicht mehr in domains.yaml stehen + for existing_domain in existing_records: + if existing_domain.endswith(".morlana.page") and existing_domain not in subdomains: + record_id = existing_records[existing_domain]["id"] + response = requests.delete(f"{CLOUDFLARE_API_URL}/{record_id}", headers=HEADERS) + if response.status_code == 200: + print(f"Successfully removed {existing_domain}") + else: + print(f"Failed to remove {existing_domain}: {response.text}") + + # Neue Einträge hinzufügen oder bestehende aktualisieren + for full_domain, subdomain in subdomains.items(): if is_reserved(full_domain, reserved_patterns): print(f"Skipping reserved domain: {full_domain}") continue