authoring service changes
All checks were successful
Build Org Website / build (push) Successful in 46s
All checks were successful
Build Org Website / build (push) Successful in 46s
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
@@ -12,14 +12,15 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import cgi
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from email.parser import BytesParser
|
||||||
|
from email.policy import default as email_default_policy
|
||||||
from email.utils import formatdate
|
from email.utils import formatdate
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any, Callable
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
|
|
||||||
@@ -272,12 +273,16 @@ class BuildQueue:
|
|||||||
job.started_at = time.time()
|
job.started_at = time.time()
|
||||||
job.message = "Publishing site and search index."
|
job.message = "Publishing site and search index."
|
||||||
self._current = job
|
self._current = job
|
||||||
ok, message, log = run_build_commands()
|
def append_log(chunk: str) -> None:
|
||||||
|
with self._lock:
|
||||||
|
job.log = (job.log + chunk)[-200000:]
|
||||||
|
|
||||||
|
ok, message, log = run_build_commands(append_log)
|
||||||
with self._lock:
|
with self._lock:
|
||||||
job.finished_at = time.time()
|
job.finished_at = time.time()
|
||||||
job.ok = ok
|
job.ok = ok
|
||||||
job.message = message
|
job.message = message
|
||||||
job.log = log
|
job.log = log[-200000:]
|
||||||
self._recent.append(job)
|
self._recent.append(job)
|
||||||
self._recent = self._recent[-20:]
|
self._recent = self._recent[-20:]
|
||||||
self._current = None
|
self._current = None
|
||||||
@@ -643,7 +648,7 @@ def save_upload(filename: str, payload: bytes, page_path: str = "") -> dict[str,
|
|||||||
absolute_url = f"https://zainezq.com/{rel}"
|
absolute_url = f"https://zainezq.com/{rel}"
|
||||||
relative_url = relative_asset_path(page_path, rel)
|
relative_url = relative_asset_path(page_path, rel)
|
||||||
is_markdown = page_path.endswith(".md")
|
is_markdown = page_path.endswith(".md")
|
||||||
insert_text = f"" if is_markdown else f"[[{relative_url}]]"
|
insert_text = f"" if is_markdown else f"[[{relative_url}]]"
|
||||||
return {
|
return {
|
||||||
"url": absolute_url,
|
"url": absolute_url,
|
||||||
"relativeUrl": relative_url,
|
"relativeUrl": relative_url,
|
||||||
@@ -654,7 +659,35 @@ def save_upload(filename: str, payload: bytes, page_path: str = "") -> dict[str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def run_build_commands() -> tuple[bool, str, str]:
|
def parse_upload_form(content_type: str, body: bytes) -> tuple[str, bytes, str]:
|
||||||
|
if not content_type.lower().startswith("multipart/form-data"):
|
||||||
|
raise ValueError("Uploads must use multipart/form-data.")
|
||||||
|
message = BytesParser(policy=email_default_policy).parsebytes(
|
||||||
|
f"Content-Type: {content_type}\r\nMIME-Version: 1.0\r\n\r\n".encode("utf-8") + body
|
||||||
|
)
|
||||||
|
if not message.is_multipart():
|
||||||
|
raise ValueError("Upload form is not multipart.")
|
||||||
|
|
||||||
|
filename = ""
|
||||||
|
payload = b""
|
||||||
|
page_path = ""
|
||||||
|
for part in message.iter_parts():
|
||||||
|
name = part.get_param("name", header="content-disposition")
|
||||||
|
if name == "attachment":
|
||||||
|
filename = part.get_filename() or ""
|
||||||
|
payload = part.get_payload(decode=True) or b""
|
||||||
|
elif name == "pagePath":
|
||||||
|
raw_value = part.get_payload(decode=True) or b""
|
||||||
|
page_path = raw_value.decode(part.get_content_charset() or "utf-8", errors="replace")
|
||||||
|
|
||||||
|
if not filename:
|
||||||
|
raise ValueError("No attachment was uploaded.")
|
||||||
|
if not payload:
|
||||||
|
raise ValueError("Attachment is empty.")
|
||||||
|
return filename, payload, page_path
|
||||||
|
|
||||||
|
|
||||||
|
def run_build_commands(log_callback: Callable[[str], None] | None = None) -> tuple[bool, str, str]:
|
||||||
venv_python = ROOT / ".venv" / "bin" / "python"
|
venv_python = ROOT / ".venv" / "bin" / "python"
|
||||||
venv_pip = ROOT / ".venv" / "bin" / "pip"
|
venv_pip = ROOT / ".venv" / "bin" / "pip"
|
||||||
commands = [["emacs", "-Q", "--script", "build-site.el"]]
|
commands = [["emacs", "-Q", "--script", "build-site.el"]]
|
||||||
@@ -667,20 +700,33 @@ def run_build_commands() -> tuple[bool, str, str]:
|
|||||||
)
|
)
|
||||||
commands.append([str(venv_python), "search-index-json.py"])
|
commands.append([str(venv_python), "search-index-json.py"])
|
||||||
combined = []
|
combined = []
|
||||||
|
|
||||||
|
def append_log(text: str) -> None:
|
||||||
|
combined.append(text)
|
||||||
|
if log_callback:
|
||||||
|
log_callback(text)
|
||||||
|
|
||||||
ok = True
|
ok = True
|
||||||
for command in commands:
|
for command in commands:
|
||||||
combined.append(f"$ {' '.join(command)}\n")
|
append_log(f"$ {' '.join(command)}\n")
|
||||||
proc = subprocess.run(
|
env = os.environ.copy()
|
||||||
|
env["PYTHONUNBUFFERED"] = "1"
|
||||||
|
proc = subprocess.Popen(
|
||||||
command,
|
command,
|
||||||
cwd=ROOT,
|
cwd=ROOT,
|
||||||
|
env=env,
|
||||||
text=True,
|
text=True,
|
||||||
stdout=subprocess.PIPE,
|
bufsize=1,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
combined.append(proc.stdout)
|
assert proc.stdout is not None
|
||||||
if proc.returncode != 0:
|
for line in proc.stdout:
|
||||||
|
append_log(line)
|
||||||
|
return_code = proc.wait()
|
||||||
|
if return_code != 0:
|
||||||
ok = False
|
ok = False
|
||||||
combined.append(f"\nCommand exited with {proc.returncode}.\n")
|
append_log(f"\nCommand exited with {return_code}.\n")
|
||||||
break
|
break
|
||||||
message = "Build complete. The site output and search index were regenerated." if ok else "Build failed. Check the log below."
|
message = "Build complete. The site output and search index were regenerated." if ok else "Build failed. Check the log below."
|
||||||
return ok, message, "".join(combined)
|
return ok, message, "".join(combined)
|
||||||
@@ -1058,9 +1104,21 @@ APP_HTML = r"""<!doctype html>
|
|||||||
return String(value).replace(/[&<>"']/g, (char) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[char]));
|
return String(value).replace(/[&<>"']/g, (char) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[char]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function previewImageUrl(src) {
|
||||||
|
const value = String(src || "");
|
||||||
|
if (value.startsWith("https://author.zainezq.com/assets/")) {
|
||||||
|
return value.replace("https://author.zainezq.com/assets/", "https://zainezq.com/assets/");
|
||||||
|
}
|
||||||
|
const relativeAsset = value.match(/^(?:\.\.\/)+assets\/(.+)$/);
|
||||||
|
if (relativeAsset) return `https://zainezq.com/assets/${relativeAsset[1]}`;
|
||||||
|
if (value.startsWith("/assets/")) return `https://zainezq.com${value}`;
|
||||||
|
if (value.startsWith("assets/")) return `https://zainezq.com/${value}`;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
function renderInlineMarkdown(value) {
|
function renderInlineMarkdown(value) {
|
||||||
let out = html(value);
|
let out = html(value);
|
||||||
out = out.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1">');
|
out = out.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_match, alt, src) => `<img src="${previewImageUrl(src)}" alt="${alt}">`);
|
||||||
out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
||||||
out = out.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
out = out.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
||||||
out = out.replace(/\*([^*]+)\*/g, '<em>$1</em>');
|
out = out.replace(/\*([^*]+)\*/g, '<em>$1</em>');
|
||||||
@@ -1173,14 +1231,15 @@ APP_HTML = r"""<!doctype html>
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function refreshBuild() {
|
async function refreshBuild() {
|
||||||
|
const wasRunning = Boolean(state.build && state.build.running);
|
||||||
try {
|
try {
|
||||||
state.build = await api("/api/build");
|
state.build = await api("/api/build");
|
||||||
renderStatus();
|
renderStatus();
|
||||||
|
if (wasRunning && !state.build.running) await refreshPages();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusBox.className = "status fail";
|
statusBox.className = "status fail";
|
||||||
statusBox.textContent = `Could not refresh build status: ${err.message}`;
|
statusBox.textContent = `Could not refresh build status: ${err.message}`;
|
||||||
}
|
}
|
||||||
await refreshPages();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.title.addEventListener("input", () => {
|
editor.title.addEventListener("input", () => {
|
||||||
@@ -1224,6 +1283,7 @@ APP_HTML = r"""<!doctype html>
|
|||||||
const saved = await api("/api/page", { method: "POST", body: JSON.stringify(payload) });
|
const saved = await api("/api/page", { method: "POST", body: JSON.stringify(payload) });
|
||||||
setForm(saved);
|
setForm(saved);
|
||||||
saveMessage.textContent = "Saved. Build queued.";
|
saveMessage.textContent = "Saved. Build queued.";
|
||||||
|
await refreshPages();
|
||||||
await refreshBuild();
|
await refreshBuild();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
saveMessage.textContent = err.message;
|
saveMessage.textContent = err.message;
|
||||||
@@ -1509,24 +1569,12 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
def do_POST(self) -> None:
|
def do_POST(self) -> None:
|
||||||
if self.path == "/api/upload":
|
if self.path == "/api/upload":
|
||||||
try:
|
try:
|
||||||
form = cgi.FieldStorage(
|
length = int(self.headers.get("Content-Length", "0"))
|
||||||
fp=self.rfile,
|
filename, payload, page_path = parse_upload_form(
|
||||||
headers=self.headers,
|
self.headers.get("Content-Type", ""),
|
||||||
environ={
|
self.rfile.read(length),
|
||||||
"REQUEST_METHOD": "POST",
|
|
||||||
"CONTENT_TYPE": self.headers.get("Content-Type", ""),
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
field = form["attachment"] if "attachment" in form else None
|
self.send_json(save_upload(filename, payload, page_path))
|
||||||
if field is None or not getattr(field, "filename", ""):
|
|
||||||
raise ValueError("No attachment was uploaded.")
|
|
||||||
payload = field.file.read()
|
|
||||||
if not payload:
|
|
||||||
raise ValueError("Attachment is empty.")
|
|
||||||
page_path = ""
|
|
||||||
if "pagePath" in form:
|
|
||||||
page_path = str(form["pagePath"].value or "")
|
|
||||||
self.send_json(save_upload(field.filename, payload, page_path))
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.send_json({"error": str(exc)}, HTTPStatus.BAD_REQUEST)
|
self.send_json({"error": str(exc)}, HTTPStatus.BAD_REQUEST)
|
||||||
return
|
return
|
||||||
|
|||||||
5
lima/index.md
Executable file → Normal file
5
lima/index.md
Executable file → Normal file
@@ -9,3 +9,8 @@ I made quite a few changes. It all started when I realised that not everyone kno
|
|||||||
- I probably didn’t explain it as well, but you can create folders and files under the `lima-website` directory. The files must have a `.md` extension at the end (markdown).
|
- I probably didn’t explain it as well, but you can create folders and files under the `lima-website` directory. The files must have a `.md` extension at the end (markdown).
|
||||||
|
|
||||||
- One other thing, a more personal one: what do you think of all this? am i doing too much? am i doing too little? am i overengineering things? am i forcing you to do something you dont wanna do? these little trinkets work for me, but i’m not sure if it would work for someone else, so at any point if you have reservations, let me know okay?
|
- One other thing, a more personal one: what do you think of all this? am i doing too much? am i doing too little? am i overengineering things? am i forcing you to do something you dont wanna do? these little trinkets work for me, but i’m not sure if it would work for someone else, so at any point if you have reservations, let me know okay?
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This is a test
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
See the categories: @@html:<a href="../home/categories.html">Categories</a>@@
|
See the categories: @@html:<a href="../home/categories.html">Categories</a>@@
|
||||||
|
|
||||||
* Posts:
|
* Posts:
|
||||||
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">09-05-2026 15:06</span>@@
|
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">09-05-2026 16:24</span>@@
|
||||||
- [[file:posts-list.sync-conflict-20260509-150632-VT6366A.org][Posts List]] @@html:<span class="post-date">09-05-2026 15:06</span>@@
|
|
||||||
- [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:<span class="post-date">11-03-2026 17:18</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
- [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:<span class="post-date">11-03-2026 17:18</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
||||||
- [[file:career/javascript.org][Understands the Javascript language]] @@html:<span class="post-date">11-03-2026 16:52</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
- [[file:career/javascript.org][Understands the Javascript language]] @@html:<span class="post-date">11-03-2026 16:52</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
||||||
- [[file:career/restful-api.org][Restful API]] @@html:<span class="post-date">15-02-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
- [[file:career/restful-api.org][Restful API]] @@html:<span class="post-date">15-02-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#+TITLE: Posts List
|
|
||||||
#+OPTIONS: toc:nil num:nil
|
|
||||||
|
|
||||||
See the categories: @@html:<a href="../home/categories.html">Categories</a>@@
|
|
||||||
|
|
||||||
* Posts:
|
|
||||||
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">09-05-2026 15:05</span>@@
|
|
||||||
- [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:<span class="post-date">11-03-2026 17:18</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/javascript.org][Understands the Javascript language]] @@html:<span class="post-date">11-03-2026 16:52</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/restful-api.org][Restful API]] @@html:<span class="post-date">15-02-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/monitoring-and-logging.org][Monitoring and Logging]] @@html:<span class="post-date">18-01-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/pipelines.org][Pipelines and how they work (as well as CI/CD)]] @@html:<span class="post-date">18-01-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/database-permissions.org][Database Permissions, Roles, and Accounts]] @@html:<span class="post-date">18-01-2026 23:00</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/probation-objectives.org][Probation Objectives:]] @@html:<span class="post-date">08-12-2025 17:55</span>@@ @@html:<a href="/tags/review.html"><span class="post-tag">review</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/airflow.org][Datamarts, Airflow and DAG's]] @@html:<span class="post-date">15-11-2025 18:37</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/normalisation.org][Benefits of Normalisation]] @@html:<span class="post-date">10-11-2025 18:04</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/wireframe-designs.org][Wireframe Designs]] @@html:<span class="post-date">06-11-2025 22:01</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/management-of-self.org][Management of self training]] @@html:<span class="post-date">06-11-2025 22:01</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/requirements-features.org][Requirements, features, user stories, tasks, walking skeletons]] @@html:<span class="post-date">06-11-2025 22:01</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/career-intro.org][Career Introduction]] @@html:<span class="post-date">06-11-2025 21:29</span>@@ @@html:<a href="/tags/introduction.html"><span class="post-tag">introduction</span></a>@@
|
|
||||||
- [[file:career/invest-principles.org][Invest Principles]] @@html:<span class="post-date">06-11-2025 21:08</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/lean.org][Lean]] @@html:<span class="post-date">05-11-2025 20:46</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/retrospectives.org][Retrospectives]] @@html:<span class="post-date">05-11-2025 20:46</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/owasp.org][OWASP Top Ten]] @@html:<span class="post-date">19-10-2025 13:21</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:career/solid-principles.org][SOLID Principles]] @@html:<span class="post-date">18-10-2025 19:14</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
|
||||||
- [[file:posts-intro.org][Posts Introduction]] @@html:<span class="post-date">06-08-2025 00:00</span>@@ @@html:<a href="/tags/introduction.html"><span class="post-tag">introduction</span></a>@@
|
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
#+OPTIONS: toc:nil num:nil
|
#+OPTIONS: toc:nil num:nil
|
||||||
|
|
||||||
* Recently Updated (top 26 files)
|
* Recently Updated (top 26 files)
|
||||||
- [[file:posts/posts-list.sync-conflict-20260509-150632-VT6366A.org][Posts List]] @@html:<span class="post-date">2026-05-09 15:06</span>@@
|
|
||||||
- [[file:sitemap.sync-conflict-20260509-150632-VT6366A.org][Sitemap]] @@html:<span class="post-date">2026-05-09 15:06</span>@@
|
|
||||||
- [[file:sitemap.sync-conflict-20260509-150611-VT6366A.org][Sitemap]] @@html:<span class="post-date">2026-05-09 15:06</span>@@
|
|
||||||
- [[file:home/notes.org][Notes]] @@html:<span class="post-date">2026-05-09 15:05</span>@@
|
- [[file:home/notes.org][Notes]] @@html:<span class="post-date">2026-05-09 15:05</span>@@
|
||||||
- [[file:home/wird-tracker.org][Wird Tracker]] @@html:<span class="post-date">2026-05-09 01:18</span>@@
|
- [[file:home/wird-tracker.org][Wird Tracker]] @@html:<span class="post-date">2026-05-09 01:18</span>@@
|
||||||
- [[file:home/status.org][Competency Status Board]] @@html:<span class="post-date">2026-05-09 01:18</span>@@
|
- [[file:home/status.org][Competency Status Board]] @@html:<span class="post-date">2026-05-09 01:18</span>@@
|
||||||
@@ -28,3 +25,6 @@
|
|||||||
- [[file:blogs/2026/04-april/12-04-week-review.org][[12-04-2026] - Weekly Review]] @@html:<span class="post-date">2026-04-12 12:00</span>@@
|
- [[file:blogs/2026/04-april/12-04-week-review.org][[12-04-2026] - Weekly Review]] @@html:<span class="post-date">2026-04-12 12:00</span>@@
|
||||||
- [[file:blogs/2026/04-april/starting-new-rotation-08-04-26.org][Starting new rotation]] @@html:<span class="post-date">2026-04-08 16:15</span>@@
|
- [[file:blogs/2026/04-april/starting-new-rotation-08-04-26.org][Starting new rotation]] @@html:<span class="post-date">2026-04-08 16:15</span>@@
|
||||||
- [[file:blogs/2026/04-april/action-plan-07-04-26.org][Action plan to change teams]] @@html:<span class="post-date">2026-04-07 10:04</span>@@
|
- [[file:blogs/2026/04-april/action-plan-07-04-26.org][Action plan to change teams]] @@html:<span class="post-date">2026-04-07 10:04</span>@@
|
||||||
|
- [[file:blogs/2026/04-april/weekly-target-06-04-26.org][[06-04-2026] - Weekly target]] @@html:<span class="post-date">2026-04-06 22:53</span>@@
|
||||||
|
- [[file:blogs/2026/04-april/making-notes-through-org-noter-06-05.org][Making Notes through Org Noter]] @@html:<span class="post-date">2026-04-06 14:30</span>@@
|
||||||
|
- [[file:blogs/2026/04-april/05-04-week-review.org][[05-04-2026] - Weekly Review]] @@html:<span class="post-date">2026-04-05 12:00</span>@@
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
lxml
|
lxml
|
||||||
|
legacy-cgi
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#+TITLE: Sitemap
|
#+TITLE: Sitemap
|
||||||
|
|
||||||
- [[file:index.org][Home]]
|
- [[file:index.org][Home]]
|
||||||
- [[file:sitemap.sync-conflict-20260509-150611-VT6366A.org][Sitemap]]
|
|
||||||
- [[file:sitemap.sync-conflict-20260509-150632-VT6366A.org][Sitemap]]
|
|
||||||
- [[file:wip.org][Work in progress]]
|
- [[file:wip.org][Work in progress]]
|
||||||
- [[file:recently-updated.org][Recently Updated]]
|
- [[file:recently-updated.org][Recently Updated]]
|
||||||
- tags
|
- tags
|
||||||
@@ -44,7 +42,6 @@
|
|||||||
- [[file:blogs/blogs-list.org][Blogs List]]
|
- [[file:blogs/blogs-list.org][Blogs List]]
|
||||||
- posts
|
- posts
|
||||||
- [[file:posts/posts-intro.org][Posts Introduction]]
|
- [[file:posts/posts-intro.org][Posts Introduction]]
|
||||||
- [[file:posts/posts-list.sync-conflict-20260509-150632-VT6366A.org][Posts List]]
|
|
||||||
- [[file:posts/posts-list.org][Posts List]]
|
- [[file:posts/posts-list.org][Posts List]]
|
||||||
- career
|
- career
|
||||||
- [[file:posts/career/solid-principles.org][SOLID Principles]]
|
- [[file:posts/career/solid-principles.org][SOLID Principles]]
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
#+TITLE: Sitemap
|
|
||||||
|
|
||||||
- [[file:index.org][Home]]
|
|
||||||
- [[file:wip.org][Work in progress]]
|
|
||||||
- [[file:recently-updated.org][Recently Updated]]
|
|
||||||
- home
|
|
||||||
- [[file:home/countdown.org][Countdown]]
|
|
||||||
- [[file:home/backlog.org][Backlog]]
|
|
||||||
- [[file:home/status.org][Competency Status Board]]
|
|
||||||
- [[file:home/services.org][Service]]
|
|
||||||
- [[file:home/wird-tracker.org][Wird Tracker]]
|
|
||||||
- [[file:home/contact.org][Contact]]
|
|
||||||
- [[file:home/notes.org][Notes]]
|
|
||||||
- [[file:home/categories.org][Categories]]
|
|
||||||
- guide
|
|
||||||
- [[file:home/guide/setup.org][Setup]]
|
|
||||||
- [[file:home/guide/wird-tracker-guide.org][Wird Tracker — Technical Guide]]
|
|
||||||
- books
|
|
||||||
- [[file:books/books-list.org][Books List]]
|
|
||||||
- clean-code
|
|
||||||
- [[file:books/clean-code/clean-code-notes.org][Clean Code Notes]]
|
|
||||||
- blogs
|
|
||||||
- [[file:blogs/blogs-intro.org][Blogs Introduction]]
|
|
||||||
- [[file:blogs/publish-pages.org][How to publish pages using Org Publish]]
|
|
||||||
- [[file:blogs/blogs-list.org][Blogs List]]
|
|
||||||
- lima
|
|
||||||
- [[file:lima/lima-list.org][Lima]]
|
|
||||||
- tags
|
|
||||||
- [[file:tags/life.sync-conflict-20260417-233423-VT6366A.org][Tag: life]]
|
|
||||||
- [[file:tags/review.sync-conflict-20260328-203248-VT6366A.org][Tag: review]]
|
|
||||||
- [[file:tags/introduction.org][Tag: introduction]]
|
|
||||||
- [[file:tags/learning.org][Tag: learning]]
|
|
||||||
- [[file:tags/notes.org][Tag: notes]]
|
|
||||||
- [[file:tags/review.org][Tag: review]]
|
|
||||||
- [[file:tags/website.org][Tag: website]]
|
|
||||||
- [[file:tags/life.org][Tag: life]]
|
|
||||||
- [[file:tags/update.org][Tag: update]]
|
|
||||||
- [[file:tags/insights.org][Tag: insights]]
|
|
||||||
- [[file:tags/emacs.org][Tag: emacs]]
|
|
||||||
- [[file:tags/education.org][Tag: education]]
|
|
||||||
- [[file:tags/reading.org][Tag: reading]]
|
|
||||||
- [[file:tags/maths.org][Tag: maths]]
|
|
||||||
- posts
|
|
||||||
- [[file:posts/posts-intro.org][Posts Introduction]]
|
|
||||||
- [[file:posts/posts-list.org][Posts List]]
|
|
||||||
- career
|
|
||||||
- [[file:posts/career/solid-principles.org][SOLID Principles]]
|
|
||||||
- [[file:posts/career/owasp.org][OWASP Top Ten]]
|
|
||||||
- [[file:posts/career/lean.org][Lean]]
|
|
||||||
- [[file:posts/career/retrospectives.org][Retrospectives]]
|
|
||||||
- [[file:posts/career/invest-principles.org][Invest Principles]]
|
|
||||||
- [[file:posts/career/career-intro.org][Career Introduction]]
|
|
||||||
- [[file:posts/career/wireframe-designs.org][Wireframe Designs]]
|
|
||||||
- [[file:posts/career/management-of-self.org][Management of self training]]
|
|
||||||
- [[file:posts/career/requirements-features.org][Requirements, features, user stories, tasks, walking skeletons]]
|
|
||||||
- [[file:posts/career/normalisation.org][Benefits of Normalisation]]
|
|
||||||
- [[file:posts/career/airflow.org][Datamarts, Airflow and DAG's]]
|
|
||||||
- [[file:posts/career/probation-objectives.org][Probation Objectives:]]
|
|
||||||
- [[file:posts/career/monitoring-and-logging.org][Monitoring and Logging]]
|
|
||||||
- [[file:posts/career/pipelines.org][Pipelines and how they work (as well as CI/CD)]]
|
|
||||||
- [[file:posts/career/database-permissions.org][Database Permissions, Roles, and Accounts]]
|
|
||||||
- [[file:posts/career/restful-api.org][Restful API]]
|
|
||||||
- [[file:posts/career/javascript.org][Understands the Javascript language]]
|
|
||||||
- [[file:posts/career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]]
|
|
||||||
- [[file:posts/career/career-list.org][Career List]]
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#+TITLE: Sitemap
|
|
||||||
|
|
||||||
- [[file:index.org][Home]]
|
|
||||||
- [[file:sitemap.sync-conflict-20260509-150611-VT6366A.org][Sitemap]]
|
|
||||||
- [[file:wip.org][Work in progress]]
|
|
||||||
- [[file:recently-updated.org][Recently Updated]]
|
|
||||||
- home
|
|
||||||
- [[file:home/countdown.org][Countdown]]
|
|
||||||
- [[file:home/backlog.org][Backlog]]
|
|
||||||
- [[file:home/status.org][Competency Status Board]]
|
|
||||||
- [[file:home/services.org][Service]]
|
|
||||||
- [[file:home/wird-tracker.org][Wird Tracker]]
|
|
||||||
- [[file:home/contact.org][Contact]]
|
|
||||||
- [[file:home/notes.org][Notes]]
|
|
||||||
- [[file:home/categories.org][Categories]]
|
|
||||||
- guide
|
|
||||||
- [[file:home/guide/setup.org][Setup]]
|
|
||||||
- [[file:home/guide/wird-tracker-guide.org][Wird Tracker — Technical Guide]]
|
|
||||||
- books
|
|
||||||
- [[file:books/books-list.org][Books List]]
|
|
||||||
- clean-code
|
|
||||||
- [[file:books/clean-code/clean-code-notes.org][Clean Code Notes]]
|
|
||||||
- blogs
|
|
||||||
- [[file:blogs/blogs-intro.org][Blogs Introduction]]
|
|
||||||
- [[file:blogs/publish-pages.org][How to publish pages using Org Publish]]
|
|
||||||
- [[file:blogs/blogs-list.org][Blogs List]]
|
|
||||||
- lima
|
|
||||||
- [[file:lima/lima-list.org][Lima]]
|
|
||||||
- tags
|
|
||||||
- [[file:tags/life.sync-conflict-20260417-233423-VT6366A.org][Tag: life]]
|
|
||||||
- [[file:tags/review.sync-conflict-20260328-203248-VT6366A.org][Tag: review]]
|
|
||||||
- [[file:tags/learning.org][Tag: learning]]
|
|
||||||
- [[file:tags/introduction.org][Tag: introduction]]
|
|
||||||
- [[file:tags/notes.org][Tag: notes]]
|
|
||||||
- [[file:tags/website.org][Tag: website]]
|
|
||||||
- [[file:tags/review.org][Tag: review]]
|
|
||||||
- [[file:tags/life.org][Tag: life]]
|
|
||||||
- [[file:tags/emacs.org][Tag: emacs]]
|
|
||||||
- [[file:tags/education.org][Tag: education]]
|
|
||||||
- [[file:tags/update.org][Tag: update]]
|
|
||||||
- [[file:tags/reading.org][Tag: reading]]
|
|
||||||
- [[file:tags/insights.org][Tag: insights]]
|
|
||||||
- [[file:tags/maths.org][Tag: maths]]
|
|
||||||
- posts
|
|
||||||
- [[file:posts/posts-intro.org][Posts Introduction]]
|
|
||||||
- [[file:posts/posts-list.org][Posts List]]
|
|
||||||
- career
|
|
||||||
- [[file:posts/career/solid-principles.org][SOLID Principles]]
|
|
||||||
- [[file:posts/career/owasp.org][OWASP Top Ten]]
|
|
||||||
- [[file:posts/career/lean.org][Lean]]
|
|
||||||
- [[file:posts/career/retrospectives.org][Retrospectives]]
|
|
||||||
- [[file:posts/career/invest-principles.org][Invest Principles]]
|
|
||||||
- [[file:posts/career/career-intro.org][Career Introduction]]
|
|
||||||
- [[file:posts/career/wireframe-designs.org][Wireframe Designs]]
|
|
||||||
- [[file:posts/career/management-of-self.org][Management of self training]]
|
|
||||||
- [[file:posts/career/requirements-features.org][Requirements, features, user stories, tasks, walking skeletons]]
|
|
||||||
- [[file:posts/career/normalisation.org][Benefits of Normalisation]]
|
|
||||||
- [[file:posts/career/airflow.org][Datamarts, Airflow and DAG's]]
|
|
||||||
- [[file:posts/career/probation-objectives.org][Probation Objectives:]]
|
|
||||||
- [[file:posts/career/monitoring-and-logging.org][Monitoring and Logging]]
|
|
||||||
- [[file:posts/career/pipelines.org][Pipelines and how they work (as well as CI/CD)]]
|
|
||||||
- [[file:posts/career/database-permissions.org][Database Permissions, Roles, and Accounts]]
|
|
||||||
- [[file:posts/career/restful-api.org][Restful API]]
|
|
||||||
- [[file:posts/career/javascript.org][Understands the Javascript language]]
|
|
||||||
- [[file:posts/career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]]
|
|
||||||
- [[file:posts/career/career-list.org][Career List]]
|
|
||||||
@@ -103,6 +103,24 @@ class UtilityTests(AuthoringServerTestCase):
|
|||||||
self.assertEqual(server.image_dimensions(gif, ".gif"), (320, 200))
|
self.assertEqual(server.image_dimensions(gif, ".gif"), (320, 200))
|
||||||
self.assertIsNone(server.image_dimensions(b"not an image", ".png"))
|
self.assertIsNone(server.image_dimensions(b"not an image", ".png"))
|
||||||
|
|
||||||
|
def test_parse_upload_form_reads_attachment_and_page_path(self):
|
||||||
|
boundary = "----authoring-test"
|
||||||
|
content_type = f"multipart/form-data; boundary={boundary}"
|
||||||
|
body = (
|
||||||
|
f"--{boundary}\r\n"
|
||||||
|
'Content-Disposition: form-data; name="pagePath"\r\n\r\n'
|
||||||
|
"lima/index.md\r\n"
|
||||||
|
f"--{boundary}\r\n"
|
||||||
|
'Content-Disposition: form-data; name="attachment"; filename="photo.png"\r\n'
|
||||||
|
"Content-Type: image/png\r\n\r\n"
|
||||||
|
).encode("utf-8") + b"image bytes\r\n" + f"--{boundary}--\r\n".encode("utf-8")
|
||||||
|
|
||||||
|
filename, payload, page_path = server.parse_upload_form(content_type, body)
|
||||||
|
|
||||||
|
self.assertEqual(filename, "photo.png")
|
||||||
|
self.assertEqual(payload, b"image bytes")
|
||||||
|
self.assertEqual(page_path, "lima/index.md")
|
||||||
|
|
||||||
|
|
||||||
class PageRenderingTests(AuthoringServerTestCase):
|
class PageRenderingTests(AuthoringServerTestCase):
|
||||||
def test_render_org_writes_metadata_and_body(self):
|
def test_render_org_writes_metadata_and_body(self):
|
||||||
@@ -244,6 +262,22 @@ class PageRenderingTests(AuthoringServerTestCase):
|
|||||||
self.assertEqual(saved["path"], "assets/images/blogs/2026-05-07-lunch.jpg")
|
self.assertEqual(saved["path"], "assets/images/blogs/2026-05-07-lunch.jpg")
|
||||||
self.assertEqual(saved["insertText"], "[[../../../assets/images/blogs/2026-05-07-lunch.jpg]]")
|
self.assertEqual(saved["insertText"], "[[../../../assets/images/blogs/2026-05-07-lunch.jpg]]")
|
||||||
|
|
||||||
|
def test_save_upload_inserts_absolute_public_url_for_markdown(self):
|
||||||
|
with mock.patch.object(server, "datetime") as datetime_mock:
|
||||||
|
datetime_mock.now.return_value = datetime(2026, 5, 9, 9, 30)
|
||||||
|
saved = server.save_upload(
|
||||||
|
"Screen Shot.png",
|
||||||
|
b"image bytes",
|
||||||
|
"lima/index.md",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(saved["path"], "assets/images/hzone/2026-05-09-screen-shot.png")
|
||||||
|
self.assertEqual(saved["relativeUrl"], "../assets/images/hzone/2026-05-09-screen-shot.png")
|
||||||
|
self.assertEqual(
|
||||||
|
saved["insertText"],
|
||||||
|
"",
|
||||||
|
)
|
||||||
|
|
||||||
def test_save_upload_rejects_disallowed_extensions(self):
|
def test_save_upload_rejects_disallowed_extensions(self):
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
server.save_upload("shell.php", b"<?php")
|
server.save_upload("shell.php", b"<?php")
|
||||||
@@ -279,6 +313,43 @@ class BuildQueueTests(unittest.TestCase):
|
|||||||
self.assertEqual(queued["status"], "queued")
|
self.assertEqual(queued["status"], "queued")
|
||||||
self.assertEqual(queued["path"], "blogs/post.org")
|
self.assertEqual(queued["path"], "blogs/post.org")
|
||||||
|
|
||||||
|
def test_run_build_commands_streams_output_to_callback(self):
|
||||||
|
root = Path(tempfile.mkdtemp())
|
||||||
|
try:
|
||||||
|
venv_python = root / ".venv" / "bin" / "python"
|
||||||
|
venv_python.parent.mkdir(parents=True)
|
||||||
|
venv_python.write_text("", encoding="utf-8")
|
||||||
|
seen = []
|
||||||
|
|
||||||
|
class FakeProcess:
|
||||||
|
def __init__(self, lines, return_code=0):
|
||||||
|
self.stdout = iter(lines)
|
||||||
|
self.return_code = return_code
|
||||||
|
|
||||||
|
def wait(self):
|
||||||
|
return self.return_code
|
||||||
|
|
||||||
|
processes = [
|
||||||
|
FakeProcess(["emacs line 1\n", "emacs line 2\n"]),
|
||||||
|
FakeProcess(["index line\n"]),
|
||||||
|
]
|
||||||
|
|
||||||
|
with mock.patch.object(server, "ROOT", root), mock.patch.object(server.subprocess, "Popen", side_effect=processes):
|
||||||
|
ok, message, log = server.run_build_commands(seen.append)
|
||||||
|
|
||||||
|
self.assertTrue(ok)
|
||||||
|
self.assertIn("Build complete", message)
|
||||||
|
self.assertIn("emacs line 1\n", seen)
|
||||||
|
self.assertIn("index line\n", seen)
|
||||||
|
self.assertEqual(log, "".join(seen))
|
||||||
|
finally:
|
||||||
|
for path in sorted(root.rglob("*"), reverse=True):
|
||||||
|
if path.is_file():
|
||||||
|
path.unlink()
|
||||||
|
else:
|
||||||
|
path.rmdir()
|
||||||
|
root.rmdir()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user