2025-01-05 01:07:09 +00:00
|
|
|
diff --git a/owug.py b/owug.py
|
2025-01-05 02:02:26 +00:00
|
|
|
index b29f62f..6800440 100644
|
2025-01-05 01:07:09 +00:00
|
|
|
--- a/owug.py
|
|
|
|
+++ b/owug.py
|
2025-01-05 02:02:26 +00:00
|
|
|
@@ -75,6 +75,18 @@ for item in head:
|
|
|
|
|
|
|
|
item.attrs['href'] = f'data:{css_mime_type};base64,{b64encode_as_string(bytes(style_data, 'utf-8'))}'
|
2025-01-04 23:54:19 +00:00
|
|
|
|
2025-01-05 01:07:09 +00:00
|
|
|
+# hardcode javascript
|
|
|
|
+# doing it this way rather than like the css because where in the page it is matters
|
|
|
|
+js = soup.find_all('script')
|
|
|
|
+for item in js:
|
|
|
|
+ if 'src' in item.attrs:
|
|
|
|
+ url = absolute_url(item.attrs['src'], domain_thing)
|
|
|
|
+ mime_type = requests.head(url).headers['Content-Type']
|
|
|
|
+ as_base64 = b64encode_as_string(requests.get(url).content)
|
|
|
|
+ new_url = f'data:{mime_type};base64,{as_base64}'
|
2025-01-04 23:54:19 +00:00
|
|
|
+
|
2025-01-05 01:07:09 +00:00
|
|
|
+ item.attrs['src'] = new_url
|
2025-01-04 23:54:19 +00:00
|
|
|
+
|
2025-01-05 01:07:09 +00:00
|
|
|
# change relative links to absolute
|
|
|
|
links = soup.find_all('link')
|
|
|
|
for item in links:
|
|
|
|
diff --git a/secret-js.patch b/secret-js.patch
|
2025-01-05 02:02:26 +00:00
|
|
|
index 6ca6e18..e69de29 100644
|
2025-01-05 01:07:09 +00:00
|
|
|
--- a/secret-js.patch
|
|
|
|
+++ b/secret-js.patch
|
2025-01-05 02:02:26 +00:00
|
|
|
@@ -1,76 +0,0 @@
|
2025-01-05 01:07:09 +00:00
|
|
|
-diff --git a/owug.py b/owug.py
|
2025-01-05 02:02:26 +00:00
|
|
|
-index f4bcdf1..ab5b627 100644
|
2025-01-05 01:07:09 +00:00
|
|
|
---- a/owug.py
|
|
|
|
-+++ b/owug.py
|
2025-01-05 02:02:26 +00:00
|
|
|
-@@ -76,6 +76,18 @@ for item in head:
|
2025-01-05 01:07:09 +00:00
|
|
|
- soup.head.append(new_tag)
|
|
|
|
- item.decompose()
|
|
|
|
-
|
2025-01-05 02:02:26 +00:00
|
|
|
-+# hardcode javascript
|
|
|
|
-+# doing it this way rather than like the css because where in the page it is matters
|
2025-01-05 01:07:09 +00:00
|
|
|
-+js = soup.find_all('script')
|
|
|
|
-+for item in js:
|
|
|
|
-+ if 'src' in item.attrs:
|
|
|
|
-+ url = absolute_url(item.attrs['src'], domain_thing)
|
|
|
|
-+ mime_type = requests.head(url).headers['Content-Type']
|
|
|
|
-+ as_base64 = b64encode_as_string(requests.get(url).content)
|
|
|
|
-+ new_url = f'data:{mime_type};base64,{as_base64}'
|
|
|
|
-+
|
|
|
|
-+ item.attrs['src'] = new_url
|
|
|
|
-+
|
|
|
|
- # change relative links to absolute
|
|
|
|
- links = soup.find_all('link')
|
|
|
|
- for item in links:
|
|
|
|
-diff --git a/secret-js.patch b/secret-js.patch
|
2025-01-05 02:02:26 +00:00
|
|
|
-index d4a08c2..e69de29 100644
|
2025-01-05 01:07:09 +00:00
|
|
|
---- a/secret-js.patch
|
|
|
|
-+++ b/secret-js.patch
|
2025-01-05 02:02:26 +00:00
|
|
|
-@@ -1,48 +0,0 @@
|
|
|
|
--diff --git a/owug.py b/owug.py
|
|
|
|
--index f4bcdf1..df34af9 100644
|
|
|
|
----- a/owug.py
|
|
|
|
--+++ b/owug.py
|
|
|
|
--@@ -76,6 +76,16 @@ for item in head:
|
|
|
|
-- soup.head.append(new_tag)
|
|
|
|
-- item.decompose()
|
2025-01-05 01:07:09 +00:00
|
|
|
--
|
2025-01-05 02:02:26 +00:00
|
|
|
--+js = soup.find_all('script')
|
|
|
|
--+for item in js:
|
|
|
|
--+ if 'src' in item.attrs:
|
|
|
|
--+ url = absolute_url(item.attrs['src'], domain_thing)
|
|
|
|
--+ mime_type = requests.head(url).headers['Content-Type']
|
|
|
|
--+ as_base64 = b64encode_as_string(requests.get(url).content)
|
|
|
|
--+ new_url = f'data:{mime_type};base64,{as_base64}'
|
2025-01-05 01:07:09 +00:00
|
|
|
--+
|
2025-01-05 02:02:26 +00:00
|
|
|
--+ item.attrs['src'] = new_url
|
2025-01-05 01:07:09 +00:00
|
|
|
--+
|
2025-01-05 02:02:26 +00:00
|
|
|
-- # change relative links to absolute
|
|
|
|
-- links = soup.find_all('link')
|
|
|
|
-- for item in links:
|
|
|
|
--diff --git a/secret-js.patch b/secret-js.patch
|
|
|
|
--index b812b3a..e69de29 100644
|
|
|
|
----- a/secret-js.patch
|
|
|
|
--+++ b/secret-js.patch
|
|
|
|
--@@ -1,22 +0,0 @@
|
|
|
|
---diff --git a/.gitignore b/.gitignore
|
|
|
|
---index fb9df04..4329ec8 100644
|
|
|
|
------ a/.gitignore
|
|
|
|
---+++ b/.gitignore
|
|
|
|
---@@ -1 +1,2 @@
|
|
|
|
----/.venv
|
|
|
|
---\ No newline at end of file
|
|
|
|
---+/.venv
|
|
|
|
---+/.vscode
|
|
|
|
---\ No newline at end of file
|
|
|
|
---diff --git a/README.md b/README.md
|
|
|
|
---index 603ae5e..5920263 100644
|
|
|
|
------ a/README.md
|
|
|
|
---+++ b/README.md
|
|
|
|
---@@ -35,3 +35,7 @@ OWUG is licensed under `GPL-3.0-only`.
|
|
|
|
--- ## TODO
|
|
|
|
---
|
|
|
|
--- - Add font support
|
|
|
|
---+
|
|
|
|
---+---
|
|
|
|
---+
|
|
|
|
---+There's definitely not a secret patch to add JS support [here](/secret-js-patch.patch).
|