90 lines
1.9 KiB
Python
90 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Set up Wiki.js sidebar navigation tree."""
|
|
import json, sys
|
|
|
|
JWT = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
|
|
# Build the full navigation tree matching our approved structure
|
|
tree_items = [
|
|
{
|
|
"label": "🏠 Home",
|
|
"kind": "link",
|
|
"target": "/",
|
|
"targetType": "page",
|
|
"icon": "mdi-home"
|
|
},
|
|
{
|
|
"label": "🖥 Machines & OS",
|
|
"kind": "link",
|
|
"target": "/machines",
|
|
"targetType": "page",
|
|
"icon": "mdi-desktop-tower"
|
|
},
|
|
{
|
|
"label": "🐳 Docker Ecosystem",
|
|
"kind": "link",
|
|
"target": "/docker",
|
|
"targetType": "page",
|
|
"icon": "mdi-docker"
|
|
},
|
|
{
|
|
"label": "⚡ Dev & AI",
|
|
"kind": "link",
|
|
"target": "/dev-ai",
|
|
"targetType": "page",
|
|
"icon": "mdi-code-tags"
|
|
},
|
|
{
|
|
"label": "📋 AI Resume System",
|
|
"kind": "link",
|
|
"target": "/ai-resume",
|
|
"targetType": "page",
|
|
"icon": "mdi-robot"
|
|
},
|
|
{
|
|
"label": "🏠 Home Assistant & IoT",
|
|
"kind": "link",
|
|
"target": "/home-iot",
|
|
"targetType": "page",
|
|
"icon": "mdi-home-automation"
|
|
},
|
|
{
|
|
"label": "🔊 Snapcast Audio",
|
|
"kind": "link",
|
|
"target": "/audio",
|
|
"targetType": "page",
|
|
"icon": "mdi-speaker"
|
|
},
|
|
{
|
|
"label": "🌐 Network",
|
|
"kind": "link",
|
|
"target": "/network",
|
|
"targetType": "page",
|
|
"icon": "mdi-lan"
|
|
}
|
|
]
|
|
|
|
nav_tree = [{
|
|
"locale": "en",
|
|
"items": tree_items
|
|
}]
|
|
|
|
# Build mutation
|
|
tree_json = json.dumps(nav_tree)
|
|
# Escape for GraphQL
|
|
tree_escaped = tree_json.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n')
|
|
|
|
mutation = f'''mutation {{
|
|
navigation {{
|
|
updateTree(tree: "{tree_escaped}") {{
|
|
responseResult {{
|
|
succeeded
|
|
message
|
|
}}
|
|
}}
|
|
}}
|
|
}}'''
|
|
|
|
payload = {"query": mutation}
|
|
print(json.dumps(payload))
|
|
PYEOF |