diff --git a/docs/src/Advanced/creating_custom_image.md b/docs/src/Advanced/creating_custom_image.md
new file mode 100644
index 0000000000..6230b9fd9a
--- /dev/null
+++ b/docs/src/Advanced/creating_custom_image.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Bazzite_resources.md b/docs/src/Bazzite_resources.md
new file mode 100644
index 0000000000..85e29493d0
--- /dev/null
+++ b/docs/src/Bazzite_resources.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Gaming/Common_gaming_issues.md b/docs/src/Gaming/Common_gaming_issues.md
new file mode 100644
index 0000000000..5ec7c04527
--- /dev/null
+++ b/docs/src/Gaming/Common_gaming_issues.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Gaming/Hardware_compatibility_for_gaming.md b/docs/src/Gaming/Hardware_compatibility_for_gaming.md
new file mode 100644
index 0000000000..cd198eaedc
--- /dev/null
+++ b/docs/src/Gaming/Hardware_compatibility_for_gaming.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Gaming/Managing_and_modding_games.md b/docs/src/Gaming/Managing_and_modding_games.md
new file mode 100644
index 0000000000..c295be9623
--- /dev/null
+++ b/docs/src/Gaming/Managing_and_modding_games.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/General/Installation_Guide/dual_boot_setup_guide.md b/docs/src/General/Installation_Guide/dual_boot_setup_guide.md
new file mode 100644
index 0000000000..db999ba1ee
--- /dev/null
+++ b/docs/src/General/Installation_Guide/dual_boot_setup_guide.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/General/Installation_Guide/secure_boot.md b/docs/src/General/Installation_Guide/secure_boot.md
new file mode 100644
index 0000000000..3d41e3d2e3
--- /dev/null
+++ b/docs/src/General/Installation_Guide/secure_boot.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/General/Installation_Guide/troubleshoot_guide.md b/docs/src/General/Installation_Guide/troubleshoot_guide.md
new file mode 100644
index 0000000000..5e54df7967
--- /dev/null
+++ b/docs/src/General/Installation_Guide/troubleshoot_guide.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/General/reporting_bugs.md b/docs/src/General/reporting_bugs.md
new file mode 100644
index 0000000000..1457eec4c0
--- /dev/null
+++ b/docs/src/General/reporting_bugs.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/bazzite_rollback_helper.md b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/bazzite_rollback_helper.md
new file mode 100644
index 0000000000..6d2aadc27f
--- /dev/null
+++ b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/bazzite_rollback_helper.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing.md b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/index.md
similarity index 100%
rename from docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing.md
rename to docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/index.md
diff --git a/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rebase_guide.md b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rebase_guide.md
new file mode 100644
index 0000000000..5b9ee53ffc
--- /dev/null
+++ b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rebase_guide.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rolling_back_system_updates.md b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rolling_back_system_updates.md
new file mode 100644
index 0000000000..8c6d454d08
--- /dev/null
+++ b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rolling_back_system_updates.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/updating_guide.md b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/updating_guide.md
new file mode 100644
index 0000000000..06067defda
--- /dev/null
+++ b/docs/src/Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/updating_guide.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md
index 41830c8f2a..b9e5b1698e 100644
--- a/docs/src/SUMMARY.md
+++ b/docs/src/SUMMARY.md
@@ -4,29 +4,36 @@
-# General
+# Table of Contents
-- [📜 Bazzite's README](Bazzite_README.md)
-- [❓️ FAQ](General/FAQ.md)
-- [📖 Installation Guide](General/Installation_Guide/index.md)
+- [Bazzite's README](Bazzite_README.md)
+- [Bazzite Resources](Bazzite_resources.md)
+- [FAQ](General/FAQ.md)
+- [Installation Guide](General/Installation_Guide/index.md)
- - [🖥️ Installing Bazzite for Desktop/Laptop Hardware](General/Installation_Guide/Installing_Bazzite_for_Desktop_or_Laptop_Hardware.md)
- - [⚙️ Installing Bazzite for Framework Laptop 16](General/Installation_Guide/Installing_Bazzite_for_Framework_Laptop_16.md)
- - [💻️ Installing Bazzite for Framework Laptop 13 (AMD/Intel GPU)](General/Installation_Guide/Installing_Bazzite_Framework_Laptop_13.md)
- - [🎮️ Installing Bazzite for Home Theater PC (HTPC) Setups](General/Installation_Guide/Installing_Bazzite_for_HTPC_Setups.md)\*
- - [🚂 Installing Bazzite on the Steam Deck](General/Installation_Guide/Installing_Bazzite_for_Steam_Deck.md)\*
- - [📟️ Installing Bazzite on Handheld PCs](General/Installation_Guide/Installing_Bazzite_for_Handheld_PCs.md)\*
+ - [Installing Bazzite for Desktop/Laptop Hardware](General/Installation_Guide/Installing_Bazzite_for_Desktop_or_Laptop_Hardware.md)
+ - [Installing Bazzite for Framework Laptop 16](General/Installation_Guide/Installing_Bazzite_for_Framework_Laptop_16.md)
+ - [Installing Bazzite for Framework Laptop 13 (AMD/Intel GPU)](General/Installation_Guide/Installing_Bazzite_Framework_Laptop_13.md)
+ - [Installing Bazzite for Home Theater PC (HTPC) Setups](General/Installation_Guide/Installing_Bazzite_for_HTPC_Setups.md)\*
+ - [Installing Bazzite on the Steam Deck](General/Installation_Guide/Installing_Bazzite_for_Steam_Deck.md)\*
+ - [Installing Bazzite on Handheld PCs](General/Installation_Guide/Installing_Bazzite_for_Handheld_PCs.md)\*
+ - [Installation Troubleshoot Guide](General/Installation_Guide/troubleshoot_guide.md)
+ - [Secure Boot Instructions](General/Installation_Guide/secure_boot.md)
+ - [Dual Boot Preliminary Setup and Post-Setup Guide](General/Installation_Guide/dual_boot_setup_guide.md)
\* _Indicates that Steam Gaming Mode is intended for this device and ships with the ISO._
-- [📝 Desktop Environment Tweaks](General/Desktop_Environment_Tweaks.md)
-- [🤝 Contributing to Bazzite](General/Contributing_to_Bazzite.md)
-- [🎲 Gaming](Gaming/index.md)
+- [Gaming](Gaming/index.md)
- [Game Launchers](Gaming/Game_Launchers.md)
+ - [Managing & Modding Games](Gaming/Managing_and_modding_games.md)
+ - [Common Gaming Issues](Gaming/Common_gaming_issues.md)
+ - [Hardware Compatibility for Gaming](Gaming/Common_gaming_issues.md)
+- [Desktop Environment Tweaks](General/Desktop_Environment_Tweaks.md)
+- [Reporting Bugs](General/reporting_bugs.md)
# Steam Gaming Mode / Handheld & HTPC Hardware
-- [📺️ Steam Gaming Mode Overview](Handheld_and_HTPC_edition/Steam_Gaming_Mode/index.md)
+- [Steam Gaming Mode Overview](Handheld_and_HTPC_edition/Steam_Gaming_Mode/index.md)
- [Change Physical Keyboard Layout for Steam Gaming Mode](Handheld_and_HTPC_edition/Change_Physical_Keyboard_Layout_for_Steam_Gaming_Mode.md)
- [Handheld Wiki](Handheld_and_HTPC_edition/Handheld_Wiki/index.md)
- [Steam Deck](Handheld_and_HTPC_edition/Handheld_Wiki/Steam_Deck.md)
@@ -46,9 +53,13 @@
- [Distrobox](Installing_and_Managing_Software/Distrobox.md)
- [Appimage](Installing_and_Managing_Software/AppImage.md)
- [rpm-ostree](Installing_and_Managing_Software/rpm-ostree.md)
- - [Waydroid Setup Guide](Installing_and_Managing_Software/Waydroid_Setup_Guide.md)
- [Tutorials for Installing Other Software](Installing_and_Managing_Software/index.md)
-- [Updates, Rollbacks, & Rebasing](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing.md)
+- [Updates, Rollbacks, & Rebasing](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/index.md)
+ - [Updating Guide](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/updating_guide.md)
+ - [Rolling Back System Updates](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rolling_back_system_updates.md)
+ - [Rebase Guide](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/rebase_guide.md)
+ - [Bazzite Rollback Helper](Installing_and_Managing_Software/Updates_Rollbacks_&_Rebasing/bazzite_rollback_helper.md)
+- [Waydroid Setup Guide](Installing_and_Managing_Software/Waydroid_Setup_Guide.md)
# Advanced
diff --git a/docs/utils/fetch_discourse_md.py b/docs/utils/fetch_discourse_md.py
index 9ad8721c04..b1a8c75420 100755
--- a/docs/utils/fetch_discourse_md.py
+++ b/docs/utils/fetch_discourse_md.py
@@ -85,7 +85,6 @@ def get_markdown_from_raw(cls, batch: UrlBatch) -> Markdown:
from argparse import ArgumentParser
-from copy import copy
from datetime import datetime, UTC
import fcntl
import html
@@ -95,7 +94,7 @@ def get_markdown_from_raw(cls, batch: UrlBatch) -> Markdown:
from string import Template
from sys import stdout, stderr
from time import sleep
-from typing import NamedTuple
+from typing import NamedTuple, cast
import requests
@@ -146,30 +145,10 @@ class Patterns:
imgs_urls = re.compile(
r"https://(?:[a-zA-Z0-9./_-]+)).*data-base62-sha1=\"(?P[a-zA-Z0-9]+)\".*\">"
)
- hashed_images_urls = re.compile(r"upload://[a-zA-Z0-9]{27}\.(?:jpe?g|png|svg)")
-
- @staticmethod
- def is_valid_doc_topic_url(url: str) -> bool:
- """Check if the passed discourse topic url is valid doc
-
- Args:
- url (str)
-
- Returns:
- bool
- """
-
- return (
- # re.match(r"https\:\/\/universal-blue\.discourse\.group/docs\?topic=\d+", url)
- re.match(
- re.escape(_BASE_URL) + r"/docs\?topic=\d+",
- url,
- )
- is not None
- )
+ hashed_images_urls = re.compile(r"upload://([a-zA-Z0-9]{27})")
@classmethod
- def transform_to_url_batch(cls, url: str) -> UrlBatch | None:
+ def transform_to_url_batch(cls, url: str) -> UrlBatch:
"""Input a discourse url topic and return a batch of urls such as `/raw/{id}` and `/t/{id}.json`
Args:
@@ -177,11 +156,8 @@ def transform_to_url_batch(cls, url: str) -> UrlBatch | None:
"""
res = None
- if not cls.is_valid_doc_topic_url(url):
- raise TypeError("Url is not valid")
-
# Get topic id
- id = re.search(re.escape(_BASE_URL) + r"/docs\?topic=(\d+)", url)
+ id = re.search(rf"{re.escape(_BASE_URL)}/docs\?topic=(\d+)", url)
if id is None:
raise Exception("id was not found")
id = int(id.group(1))
@@ -194,23 +170,6 @@ def transform_to_url_batch(cls, url: str) -> UrlBatch | None:
return res
- @classmethod
- def get_page_from_json(cls, batch: UrlBatch) -> HTMLPage:
- """Get webpage contents from an url link
-
- This includes images urls from discourse cdn
-
- Args:
- batch (UrlBatch)
- """
- json_content = (res := cls.fetch(batch.json_url)).json()
- debug(f"{res.url} res.status = {res.status_code}")
- if res.status_code != 200:
- raise Exception(res.reason)
-
- # json_content = json.loads(json_content)
- return json_content["post_stream"]["posts"][0]["cooked"]
-
@classmethod
def fetch(cls, url: str) -> requests.Response:
tries = 2
@@ -228,41 +187,9 @@ def fetch(cls, url: str) -> requests.Response:
return res
- @classmethod
- def get_markdown_from_raw(cls, batch: UrlBatch) -> Markdown:
- """Get markdown from page
-
- This is recommended for extracting text transcriptions
-
- Args:
- batch (UrlBatch): _description_
-
- Returns:
- str:
- """
-
- return requests.get(batch.raw_url).text
-
- @classmethod
- def get_images_url_assocs_from_page(cls, page: HTMLPage) -> ImageUrlAssocs:
- result: list[tuple] = []
- for match in re.finditer(DiscourseProcessor.Patterns.imgs_urls, page):
- debug(match.__str__())
- (sha1, image_cdn_url) = match.group("sha1", "image_cdn_url")
- result.append((sha1, image_cdn_url))
- return result
-
- @classmethod
- def replace_images_urls_in_markdown(
- cls, page: Markdown, assocs: ImageUrlAssocs
- ) -> Markdown:
- result = page
- for assoc in assocs:
- result = result.replace(
- f"upload://{assoc[0]}",
- os.path.splitext(assoc[1])[0],
- )
- return result
+ @staticmethod
+ def get_markdown_from_url(url: str):
+ return requests.get(url).text
@staticmethod
def add_metadata_to_markdown(md: Markdown, url_discourse: str) -> Markdown:
@@ -296,12 +223,18 @@ def add_metadata_to_markdown(md: Markdown, url_discourse: str) -> Markdown:
return "\n".join(md_split)
+def simple_replace_match(match: re.Match) -> str:
+ hash = match.group(1)
+ if hash:
+ return f"{_BASE_URL}/uploads/short-url/{hash}"
+ return ""
+
+
def main():
argparser = ArgumentParser()
argparser.add_argument(
"url",
type=str,
- nargs=1, # Change this to `+` if you wish to process multiple urls
help="discourse urls to be processed",
)
argparser.add_argument(
@@ -317,32 +250,22 @@ def main():
global _is_debug
_is_debug = os.getenv("DEBUG") == "1" or args.debug
- urls = args.url
-
- urls_batches_list: list[UrlBatch] = []
+ urls = cast(str, DiscourseProcessor.transform_to_url_batch(args.url).raw_url)
- for url in urls:
- batch = DiscourseProcessor.transform_to_url_batch(url)
- if batch is None:
- continue
- urls_batches_list.append(batch)
-
- for batch in urls_batches_list:
- image_urls_assocs = DiscourseProcessor.get_images_url_assocs_from_page(
- DiscourseProcessor.get_page_from_json(batch)
- )
- result = DiscourseProcessor.replace_images_urls_in_markdown(
- page=DiscourseProcessor.get_markdown_from_raw(batch),
- assocs=image_urls_assocs,
- )
+ result = DiscourseProcessor.get_markdown_from_url(urls)
+ result = re.sub(
+ DiscourseProcessor.Patterns.hashed_images_urls,
+ simple_replace_match,
+ result,
+ )
- # Remove comments
- result = DiscourseProcessor.Patterns.post_sep_markdown.split(result, 1)[0].rstrip()
+ # Remove comments
+ result = DiscourseProcessor.Patterns.post_sep_markdown.split(result, 1)[0].rstrip()
- # Add metadata
- result = DiscourseProcessor.add_metadata_to_markdown(result, batch.source_url)
+ # Add metadata
+ result = DiscourseProcessor.add_metadata_to_markdown(result, urls)
- print(result, file=stdout)
+ print(result, file=stdout)
if __name__ == "__main__":