Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Generate Docs

on:
push:
branches: [main]
paths:
- 'site/**'
- '.github/workflows/generate-docs.yml'
workflow_dispatch:
Comment on lines +6 to +9

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
name: Build landing page
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Stage static site
run: |
set -euo pipefail
mkdir -p _site
cp -r site/. _site/
# disable Jekyll processing so files are served verbatim
touch _site/.nojekyll
# record build metadata (no personal data)
date -u +"%Y-%m-%dT%H:%M:%SZ" > _site/build.txt

- name: Validate (no external resources)
run: |
set -euo pipefail
python - <<'PY'
from html.parser import HTMLParser
from pathlib import Path

RESOURCE_ATTRIBUTES = {
("script", "src"),
("img", "src"),
("img", "srcset"),
("iframe", "src"),
("audio", "src"),
("video", "src"),
("track", "src"),
("source", "src"),
("source", "srcset"),
("embed", "src"),
("object", "data"),
}

LINK_RESOURCE_RELS = {
"stylesheet",
"icon",
"apple-touch-icon",
"manifest",
"preload",
"modulepreload",
"prefetch",
"dns-prefetch",
"preconnect",
"mask-icon",
"shortcut icon",
}

def external_values(raw_value: str):
for candidate in raw_value.split(","):
value = candidate.strip().split(" ", 1)[0]
if value.startswith(("http://", "https://", "//")):
yield value

class ResourceParser(HTMLParser):
def __init__(self, path: Path):
super().__init__()
self.path = path
self.violations = []

def handle_starttag(self, tag, attrs):
attr_map = dict(attrs)
rel_tokens = set(attr_map.get("rel", "").lower().split())

for name, value in attrs:
if not value:
continue

if (tag, name) in RESOURCE_ATTRIBUTES:
for external in external_values(value):
self.violations.append((tag, name, external))

if tag == "link" and name == "href":
rel_value = attr_map.get("rel", "").lower().strip()
if rel_tokens & LINK_RESOURCE_RELS or rel_value in LINK_RESOURCE_RELS:
for external in external_values(value):
self.violations.append((tag, name, external))

violations = []
for path in Path("_site").rglob("*.html"):
parser = ResourceParser(path)
parser.feed(path.read_text(encoding="utf-8"))
violations.extend((path, *violation) for violation in parser.violations)

if violations:
for path, tag, attr, value in violations:
print(f"{path}: external resource via <{tag} {attr}=\"{value}\">", flush=True)
raise SystemExit("ERROR: external resource reference found — landing page must be self-contained.")
PY

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site

deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![WebExpress-Framework](https://raw.githubusercontent.com/webexpress-framework/.github/main/docs/assets/img/banner.png)

# WebExpress
WebExpress is a lightweight web server optimized for use in low-performance environments (e.g. Rasperry PI). By providing a powerful plugin system and a comprehensive API, web applications can be easily and quickly integrated into a .net language (e.g. C#). Some advantages of WebExpress are:
WebExpress is a lightweight web server optimized for use in low-performance environments (e.g., Raspberry Pi). By providing a powerful plugin system and a comprehensive API, web applications can be easily and quickly integrated into a .NET language (e.g., C#). Some advantages of WebExpress are:

- It is easy to use.
- It offers a variety of features and tools that can help you build and manage your website.
Expand Down Expand Up @@ -44,4 +44,4 @@ Begin with our basic tutorial:
- [WebIndex](https://github.com/webexpress-framework/WebExpress.Tutorial.WebIndex#readme)

# Tags
#WebExpress #WebServer
#WebExpress #WebServer
2 changes: 1 addition & 1 deletion WebExpress.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<id>WebExpress</id>
<version>0.0.10-alpha</version>
<version>0.0.11-alpha</version>
<title>WebExpress</title>
<authors>webexpress-framework@outlook.com</authors>
<license>MIT</license>
Expand Down
Loading