From 41f8d3025f041aaab98fcc3511cb6ec2198f76a7 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Sun, 14 Jun 2026 01:49:48 +0300 Subject: init: vibed --- web/LICENSE | 21 + web/README.md | 46 ++ web/scripts/gen_tool.py | 1388 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1455 insertions(+) create mode 100644 web/LICENSE create mode 100644 web/README.md create mode 100644 web/scripts/gen_tool.py (limited to 'web') diff --git a/web/LICENSE b/web/LICENSE new file mode 100644 index 0000000..dd35f66 --- /dev/null +++ b/web/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Ahmed Mohamed Alaa + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000..50e8cef --- /dev/null +++ b/web/README.md @@ -0,0 +1,46 @@ +# ugi.gumx.cc + +Web-based UGI (Unified Geek Identifier) encoder, decoder, and format converter. + +## What is this? + +A self-contained HTML tool for working with UGI strings — the modernized Geek Code. It provides three functions: + +- **Encoder** — form-based interface to build a UGI string by selecting fields, sub-IDs, and ratings +- **Decoder** — paste a UGI string (URI or block format) and see a human-readable breakdown +- **Converter** — convert between URI format (`ugi:0@handle:...`) and block format + +The tool is a single HTML file with no external dependencies. The full UGI registry is embedded inline. + +## Usage + +Open `index.html` in any browser. No server required. + +Supports `prefers-color-scheme` for automatic dark mode. + +## Regenerating + +The generator script takes the registry JSON path and output file path as arguments: + +```bash +python scripts/gen_tool.py /path/to/ugi_registry_v0.json index.html +``` + +### Requirements + +- Python 3.8+ +- No external dependencies + +## Project structure + +``` +ugi.gumx.cc/ +├── index.html # generated tool (deploy this) +├── scripts/ +│ └── gen_tool.py # HTML tool generator +└── README.md +``` + +## License + +MIT diff --git a/web/scripts/gen_tool.py b/web/scripts/gen_tool.py new file mode 100644 index 0000000..232a7eb --- /dev/null +++ b/web/scripts/gen_tool.py @@ -0,0 +1,1388 @@ +#!/usr/bin/env python3 +"""Generate UGI_TOOL_v0.html from ugi_registry_v0.json.""" + +import json +import os +import sys +import html + + +def load_registry(path): + with open(path, "r") as f: + return json.load(f) + + +def generate_html(reg): + reg_json = json.dumps(reg, ensure_ascii=False) + + return f""" + + + + +UGI Tool v{reg['spec']['version']} — Encoder / Decoder / Converter + + + + +

UGI Tool v{reg['spec']['version']}

+

{html.escape(reg['spec']['description'])}

+
+ +
+ + + + +
+ +
+

Encode your UGI

+ + + + + +
+ +
+ +
+ +
+

URI output:

+
+ + +

Block output:

+

+  
+
+ +
+

Decode a UGI string

+ + +
+
+ +
+

Convert between formats

+ + +

Converted output:

+

+  
+
+ +
+
+
+ +
+
+ Quick Reference +

+
+ + + + +""" + + +def main(): + if len(sys.argv) != 3: + print(f"Usage: {sys.argv[0]} ", file=sys.stderr) + sys.exit(1) + + registry_path, output_path = sys.argv[1], sys.argv[2] + reg = load_registry(registry_path) + html_content = generate_html(reg) + + os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True) + with open(output_path, "w") as f: + f.write(html_content) + + print(f"Generated {output_path}") + + +if __name__ == "__main__": + main() -- cgit v1.2.3