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
36 changes: 36 additions & 0 deletions .github/workflows/hash_blocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Generate Block Box

on:
push:
paths:
- '**.html'
- '**.js'
- '**.css'
- '**.json'
- '**.py'
- '**.c'
- '**.roff'
- '**.yml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Run hash_blocks.py
run: python3 scripts/hash_blocks.py

- name: Commit block-box.json
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add shared-data/block-box.json
git commit -m "Update block-box.json"
git push
13 changes: 9 additions & 4 deletions scripts/hash_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@
import json
from datetime import datetime

# 🔐 Hash-Funktion für einzelne Datei
def hash_file(path):
with open(path, "rb") as f:
return hashlib.sha256(f.read()).hexdigest()

def collect_blocks(root=".", extensions=(".html", ".css", ".js", ".json", ".roff")):
# 📦 Sammle alle Blöcke aus dem Projektverzeichnis
def collect_blocks(root=".", extensions=(".html", ".css", ".js", ".json", ".py", ".c", ".roff", ".yml")):
blocks = []
for dirpath, _, filenames in os.walk(root):
for filename in filenames:
if filename.endswith(extensions):
full_path = os.path.join(dirpath, filename)
rel_path = os.path.relpath(full_path, root)
rel_path = os.path.relpath(full_path, root).replace("\\", "/")
blocks.append({
"path": rel_path.replace("\\", "/"),
"path": rel_path,
"hash": hash_file(full_path),
"timestamp": datetime.utcnow().isoformat() + "Z",
"type": os.path.splitext(filename)[1][1:]
})
return blocks

# 🧠 Hauptfunktion
if __name__ == "__main__":
data = {"blocks": collect_blocks()}
data = {
"blocks": collect_blocks()
}
with open("shared-data/block-box.json", "w") as f:
json.dump(data, f, indent=2)
42 changes: 42 additions & 0 deletions shared-data/block-box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"blocks": [
{ "path": "index.html", "hash": "HASH_INDEX", "timestamp": "2025-11-08T21:18:00Z", "type": "html" },

{ "path": "THPTx/index.html", "hash": "HASH_THPTX", "timestamp": "2025-11-08T21:18:01Z", "type": "html" },
{ "path": "THPTx/subsite-1/index.html", "hash": "HASH_THPTX_1", "timestamp": "2025-11-08T21:18:02Z", "type": "html" },
{ "path": "THPTx/subsite-2/index.html", "hash": "HASH_THPTX_2", "timestamp": "2025-11-08T21:18:03Z", "type": "html" },
{ "path": "THPTx/subsite-3/index.html", "hash": "HASH_THPTX_3", "timestamp": "2025-11-08T21:18:04Z", "type": "html" },
{ "path": "THPTx/subsite-4/index.html", "hash": "HASH_THPTX_4", "timestamp": "2025-11-08T21:18:05Z", "type": "html" },
{ "path": "THPTx/subsite-5/index.html", "hash": "HASH_THPTX_5", "timestamp": "2025-11-08T21:18:06Z", "type": "html" },
{ "path": "THPTx/subsite-6/index.html", "hash": "HASH_THPTX_6", "timestamp": "2025-11-08T21:18:07Z", "type": "html" },
{ "path": "THPTx/subsite-7/index.html", "hash": "HASH_THPTX_7", "timestamp": "2025-11-08T21:18:08Z", "type": "html" },
{ "path": "THPTx/subsite-8/index.html", "hash": "HASH_THPTX_8", "timestamp": "2025-11-08T21:18:09Z", "type": "html" },
{ "path": "THPTx/subsite-9/index.html", "hash": "HASH_THPTX_9", "timestamp": "2025-11-08T21:18:10Z", "type": "html" },

{ "path": "EBSI-THPT-Project/index.html", "hash": "HASH_EBSI", "timestamp": "2025-11-08T21:18:11Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-1/index.html", "hash": "HASH_EBSI_1", "timestamp": "2025-11-08T21:18:12Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-2/index.html", "hash": "HASH_EBSI_2", "timestamp": "2025-11-08T21:18:13Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-3/index.html", "hash": "HASH_EBSI_3", "timestamp": "2025-11-08T21:18:14Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-4/index.html", "hash": "HASH_EBSI_4", "timestamp": "2025-11-08T21:18:15Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-5/index.html", "hash": "HASH_EBSI_5", "timestamp": "2025-11-08T21:18:16Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-6/index.html", "hash": "HASH_EBSI_6", "timestamp": "2025-11-08T21:18:17Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-7/index.html", "hash": "HASH_EBSI_7", "timestamp": "2025-11-08T21:18:18Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-8/index.html", "hash": "HASH_EBSI_8", "timestamp": "2025-11-08T21:18:19Z", "type": "html" },
{ "path": "EBSI-THPT-Project/subsite-9/index.html", "hash": "HASH_EBSI_9", "timestamp": "2025-11-08T21:18:20Z", "type": "html" },

{ "path": "THPT-BOxExplorer/index.html", "hash": "HASH_EXPLORER", "timestamp": "2025-11-08T21:18:21Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-1/index.html", "hash": "HASH_EXPLORER_1", "timestamp": "2025-11-08T21:18:22Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-2/index.html", "hash": "HASH_EXPLORER_2", "timestamp": "2025-11-08T21:18:23Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-3/index.html", "hash": "HASH_EXPLORER_3", "timestamp": "2025-11-08T21:18:24Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-4/index.html", "hash": "HASH_EXPLORER_4", "timestamp": "2025-11-08T21:18:25Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-5/index.html", "hash": "HASH_EXPLORER_5", "timestamp": "2025-11-08T21:18:26Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-6/index.html", "hash": "HASH_EXPLORER_6", "timestamp": "2025-11-08T21:18:27Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-7/index.html", "hash": "HASH_EXPLORER_7", "timestamp": "2025-11-08T21:18:28Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-8/index.html", "hash": "HASH_EXPLORER_8", "timestamp": "2025-11-08T21:18:29Z", "type": "html" },
{ "path": "THPT-BOxExplorer/subsite-9/index.html", "hash": "HASH_EXPLORER_9", "timestamp": "2025-11-08T21:18:30Z", "type": "html" },

{ "path": "shared-scripts/link-map.js", "hash": "HASH_LINKMAP", "timestamp": "2025-11-08T21:18:31Z", "type": "js" },
{ "path": "shared-data/navigation.json", "hash": "HASH_NAVIGATION", "timestamp": "2025-11-08T21:18:32Z", "type": "json" },
{ "path": "scripts/hash_blocks.py", "hash": "HASH_SCRIPT", "timestamp": "2025-11-08T21:18:33Z", "type": "py" }
]
}
64 changes: 64 additions & 0 deletions shared-data/navigation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"projects": [
{
"name": "THPT",
"index": "index.html",
"subsites": [
{ "name": "Subsite 1", "path": "subsite-1/index.html" },
{ "name": "Subsite 2", "path": "subsite-2/index.html" },
{ "name": "Subsite 3", "path": "subsite-3/index.html" },
{ "name": "Subsite 4", "path": "subsite-4/index.html" },
{ "name": "Subsite 5", "path": "subsite-5/index.html" },
{ "name": "Subsite 6", "path": "subsite-6/index.html" },
{ "name": "Subsite 7", "path": "subsite-7/index.html" },
{ "name": "Subsite 8", "path": "subsite-8/index.html" },
{ "name": "Subsite 9", "path": "subsite-9/index.html" }
]
},
{
"name": "THPTx",
"index": "THPTx/index.html",
"subsites": [
{ "name": "Subsite 1", "path": "THPTx/subsite-1/index.html" },
{ "name": "Subsite 2", "path": "THPTx/subsite-2/index.html" },
{ "name": "Subsite 3", "path": "THPTx/subsite-3/index.html" },
{ "name": "Subsite 4", "path": "THPTx/subsite-4/index.html" },
{ "name": "Subsite 5", "path": "THPTx/subsite-5/index.html" },
{ "name": "Subsite 6", "path": "THPTx/subsite-6/index.html" },
{ "name": "Subsite 7", "path": "THPTx/subsite-7/index.html" },
{ "name": "Subsite 8", "path": "THPTx/subsite-8/index.html" },
{ "name": "Subsite 9", "path": "THPTx/subsite-9/index.html" }
]
},
{
"name": "EBSI-THPT-Project",
"index": "EBSI-THPT-Project/index.html",
"subsites": [
{ "name": "Subsite 1", "path": "EBSI-THPT-Project/subsite-1/index.html" },
{ "name": "Subsite 2", "path": "EBSI-THPT-Project/subsite-2/index.html" },
{ "name": "Subsite 3", "path": "EBSI-THPT-Project/subsite-3/index.html" },
{ "name": "Subsite 4", "path": "EBSI-THPT-Project/subsite-4/index.html" },
{ "name": "Subsite 5", "path": "EBSI-THPT-Project/subsite-5/index.html" },
{ "name": "Subsite 6", "path": "EBSI-THPT-Project/subsite-6/index.html" },
{ "name": "Subsite 7", "path": "EBSI-THPT-Project/subsite-7/index.html" },
{ "name": "Subsite 8", "path": "EBSI-THPT-Project/subsite-8/index.html" },
{ "name": "Subsite 9", "path": "EBSI-THPT-Project/subsite-9/index.html" }
]
},
{
"name": "THPT-BOxExplorer",
"index": "THPT-BOxExplorer/index.html",
"subsites": [
{ "name": "Subsite 1", "path": "THPT-BOxExplorer/subsite-1/index.html" },
{ "name": "Subsite 2", "path": "THPT-BOxExplorer/subsite-2/index.html" },
{ "name": "Subsite 3", "path": "THPT-BOxExplorer/subsite-3/index.html" },
{ "name": "Subsite 4", "path": "THPT-BOxExplorer/subsite-4/index.html" },
{ "name": "Subsite 5", "path": "THPT-BOxExplorer/subsite-5/index.html" },
{ "name": "Subsite 6", "path": "THPT-BOxExplorer/subsite-6/index.html" },
{ "name": "Subsite 7", "path": "THPT-BOxExplorer/subsite-7/index.html" },
{ "name": "Subsite 8", "path": "THPT-BOxExplorer/subsite-8/index.html" },
{ "name": "Subsite 9", "path": "THPT-BOxExplorer/subsite-9/index.html" }
]
}
]
}
Loading