moosey-cms 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/PKG-INFO +1 -1
  2. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/pyproject.toml +1 -1
  3. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/hot_reload_script.py +8 -3
  4. moosey_cms-0.4.0/src/moosey_cms/.python-version +0 -1
  5. moosey_cms-0.4.0/src/moosey_cms/py.typed +0 -0
  6. moosey_cms-0.4.0/src/moosey_cms/pyproject.toml +0 -28
  7. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/.gitignore +0 -0
  8. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/.python-version +0 -0
  9. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/README.md +0 -0
  10. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/assets/example-1.jpeg +0 -0
  11. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/assets/example-2.jpeg +0 -0
  12. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/content/about.md +0 -0
  13. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/content/index.md +0 -0
  14. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/content/pages/features.md +0 -0
  15. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/content/posts/building-modern-apps.md +0 -0
  16. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/content/posts/index.md +0 -0
  17. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/main.py +0 -0
  18. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/404.html +0 -0
  19. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/components/sidebar.html +0 -0
  20. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/index.html +0 -0
  21. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/layout/base.html +0 -0
  22. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/page.html +0 -0
  23. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/post.html +0 -0
  24. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/example/templates/posts.html +0 -0
  25. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/__init__.py +0 -0
  26. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/cache.py +0 -0
  27. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/file_watcher.py +0 -0
  28. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/filters.py +0 -0
  29. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/helpers.py +0 -0
  30. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/main.py +0 -0
  31. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/md.py +0 -0
  32. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/models.py +0 -0
  33. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/seo.py +0 -0
  34. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/src/moosey_cms/static/js/reload-script.js +0 -0
  35. {moosey_cms-0.4.0 → moosey_cms-0.5.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moosey-cms
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: cachetools>=6.2.4
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "moosey-cms"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
@@ -17,11 +17,13 @@ class ScriptInjectorMiddleware(BaseHTTPMiddleware):
17
17
  self.script = script
18
18
 
19
19
  async def dispatch(self, request: Request, call_next):
20
+
20
21
  # Process the request and get the response
21
22
  response = await call_next(request)
22
23
 
23
24
  # We only want to touch HTML pages, not JSON APIs or Images
24
25
  content_type = response.headers.get("content-type", "")
26
+
25
27
  # get content length
26
28
  content_length = response.headers.get("content-length")
27
29
 
@@ -29,11 +31,10 @@ class ScriptInjectorMiddleware(BaseHTTPMiddleware):
29
31
  if "text/html" not in content_type:
30
32
  return response
31
33
 
32
- # Skip if too big (e.g. > 20KB) to prevent Memory DoS
33
- if content_length and int(content_length) > 20 * 1024 :
34
+ # Skip if too big (e.g. > 10mb) to prevent Memory DoS
35
+ if content_length and int(content_length) > 10 * 1024 * 1024 :
34
36
  return response
35
37
 
36
-
37
38
  # Read the response body
38
39
  # Note: Response body is a stream, we must consume it to modify it
39
40
  response_body = [section async for section in response.body_iterator]
@@ -51,6 +52,7 @@ class ScriptInjectorMiddleware(BaseHTTPMiddleware):
51
52
  # Fallback: Just append if no body tag found
52
53
  full_body += injection
53
54
 
55
+
54
56
  # Create a NEW Response object
55
57
  # We cannot modify the existing response easily because Content-Length
56
58
  # would be wrong. Creating a new one recalculates headers.
@@ -69,6 +71,7 @@ class ScriptInjectorMiddleware(BaseHTTPMiddleware):
69
71
 
70
72
 
71
73
  def inject_script_middleware(app, host, port):
74
+ # print('>>>>>>IIIIII')
72
75
  # Your custom script to inject
73
76
  package_root = Path(__file__).resolve().parent
74
77
  javascript_file = package_root / "static" / "js" / "reload-script.js"
@@ -85,6 +88,8 @@ def inject_script_middleware(app, host, port):
85
88
  f"{host}:{port}",
86
89
  )
87
90
 
91
+ # print('RELOAD ', script_data)
92
+
88
93
  # Add the middleware
89
94
  app.add_middleware(
90
95
  ScriptInjectorMiddleware, script=f"<script>{script_data}</script>"
@@ -1 +0,0 @@
1
- 3.12
File without changes
@@ -1,28 +0,0 @@
1
- [project]
2
- name = "moosey-cms"
3
- version = "0.1.0"
4
- description = "A drop-in Markdown CMS for FastAPI with Hot Reloading"
5
- readme = "README.md"
6
- requires-python = ">=3.12"
7
- dependencies = [
8
- "cachetools>=6.2.4",
9
- "inflection>=0.5.1",
10
- "jinja2>=3.1.6",
11
- "markdown>=3.10",
12
- "pymdown-extensions>=10.20",
13
- "python-frontmatter>=1.1.0",
14
- "python-slugify>=8.0.4",
15
- "slugify>=0.0.1",
16
- ]
17
-
18
- [build-system]
19
- requires = ["hatchling"]
20
- build-backend = "hatchling.build"
21
-
22
- # --- CRITICAL: INCLUDE STATIC FILES ---
23
- [tool.hatch.build.targets.wheel]
24
- packages = ["src/moosey_cms"]
25
-
26
- # This forces the inclusion of non-python files inside the package
27
- [tool.hatch.build.targets.wheel.force-include]
28
- "src/simple_cms/static" = "moosey_cms/static"
File without changes
File without changes
File without changes
File without changes
File without changes