diff --git a/.github/workflows/sync_build_deploy.yml b/.github/workflows/sync_build_deploy.yml index 124b710..4b757c7 100644 --- a/.github/workflows/sync_build_deploy.yml +++ b/.github/workflows/sync_build_deploy.yml @@ -97,24 +97,11 @@ jobs: echo "$(cat latest_versions.md)" >> $GITHUB_STEP_SUMMARY rm latest_versions.md - - name: Index and Push + - name: Index, Sitemap and Push if: ${{ env.IS_SYNC == 'true' }} run: | + python util/cli.py sitemap --base-url "https://mmrl.dergoogler.com/?module=" python util/cli.py index --push - - # Sitemap generator - - name: Generate sitemap - if: ${{ env.IS_SYNC == 'true' }} - run: | - python generate_sitemap.py - - - name: Commit sitemap - if: ${{ env.IS_SYNC == 'true' }} - run: | - git add json/sitemap.xml - git commit -sm "[SITEMAP] Update sitemap.xml" || true - git push || true - #### - name: Upload logs uses: actions/upload-artifact@v3 diff --git a/generate_sitemap.py b/generate_sitemap.py deleted file mode 100644 index 25396f5..0000000 --- a/generate_sitemap.py +++ /dev/null @@ -1,53 +0,0 @@ -import json -import xml.etree.ElementTree as ET -from xml.dom import minidom -from datetime import datetime - -# Open modules.json -with open('json/modules.json') as json_data: - data = json.load(json_data) - -# Access the "modules" object -modules = data.get("modules", []) - -# Create the root element for the sitemap -urlset = ET.Element("urlset", xmlns="http://www.sitemaps.org/schemas/sitemap/0.9", **{"xmlns:image": "http://www.google.com/schemas/sitemap-image/1.1"}) - -# Base URL for the modules -base_url = "http://mmrl.dergoogler.com/?module=" - -# Add URLs to the sitemap -for module in modules: - - # Convert Unix timestamp to datetime object - dt_object = datetime.utcfromtimestamp(module["timestamp"]) - - # Format the datetime object as 'YYYY-MM-DD' - formatted_date = dt_object.strftime('%Y-%m-%d') - - module_id = module["id"] - url = base_url + module_id - url_element = ET.SubElement(urlset, "url") - loc_element = ET.SubElement(url_element, "loc") - lastmod_element = ET.SubElement(url_element, "lastmod") - - cover = module.get("track").get("cover") - if cover: - url_image_image = ET.SubElement(url_element, "image:image") - url_image_image_loc = ET.SubElement(url_image_image, "image:loc") - url_image_image_loc.text = cover - - - lastmod_element.text = formatted_date - loc_element.text = url - -# Convert the ElementTree to a string -sitemap = ET.tostring(urlset, encoding="utf-8", method="xml") - -xmlstr = minidom.parseString(sitemap).toprettyxml(indent=" ") - -# Write to a file -with open("json/sitemap.xml", "w") as f: - f.write(xmlstr) - -print("Sitemap generated successfully.") diff --git a/json/sitemap.xml b/json/sitemap.xml index 80c5320..45890cf 100644 --- a/json/sitemap.xml +++ b/json/sitemap.xml @@ -110,7 +110,7 @@ http://mmrl.dergoogler.com/?module=mmrl - 2024-05-25 + 2024-06-22 https://raw.githubusercontent.com/DerGoogler/MMRL-CLI/master/assets/CLI-Banner.png @@ -119,7 +119,7 @@ http://mmrl.dergoogler.com/?module=mmrl_install_tools 2024-06-13 - https://mmrl.dergoogler.com/assets/MMRL-Cover.png + <CONFCWD>/assets/logcat-min.png