]> OzVa Git service - delta-velorum/commitdiff
Initial
authorMax Value <greenwoodw50@gmail.com>
Sun, 29 Mar 2026 11:41:58 +0000 (12:41 +0100)
committerMax Value <greenwoodw50@gmail.com>
Sun, 29 Mar 2026 11:41:58 +0000 (12:41 +0100)
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
director/__init__.py [new file with mode: 0644]
director/src/title.ts [new file with mode: 0644]
director/src/update.ts [new file with mode: 0644]
director/templates/index.html [new file with mode: 0644]
docs.html [new file with mode: 0644]
requirements.txt [new file with mode: 0644]
tsconfig.json [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..3d43339
--- /dev/null
@@ -0,0 +1,2 @@
+build/
+__pycache__/
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..0709a5c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+main : .venv/touchfile
+       npx tsc
+       .venv/bin/flask --app director run --debug
+
+.venv/touchfile : requirements.txt
+       python3 -m venv .venv
+       .venv/bin/python -m pip install -r requirements.txt
+       touch .venv/touchfile
diff --git a/director/__init__.py b/director/__init__.py
new file mode 100644 (file)
index 0000000..dd366a6
--- /dev/null
@@ -0,0 +1,15 @@
+from flask import Flask, render_template, send_from_directory
+import os
+
+app = Flask(__name__, instance_relative_config=False)
+app.config.from_mapping(
+       DATABASE=os.path.join(app.root_path, 'flaskr.sqlite')
+)
+
+@app.route("/", methods=['get'])
+def index():
+       return render_template("index.html")
+
+@app.route("/script/<path:filename>", methods=["get"])
+def script(filename):
+       return send_from_directory(os.path.join(app.root_path, "build"), filename)
diff --git a/director/src/title.ts b/director/src/title.ts
new file mode 100644 (file)
index 0000000..123811b
--- /dev/null
@@ -0,0 +1,7 @@
+export default function renderTitle(): void {
+       const el: HTMLCollectionOf<Element> = document.getElementsByClassName("title");
+
+       for (let e of el) {
+               console.log(e);
+       }
+}
diff --git a/director/src/update.ts b/director/src/update.ts
new file mode 100644 (file)
index 0000000..fa3dfc5
--- /dev/null
@@ -0,0 +1,8 @@
+import renderTitle from "./title.js";
+export {};
+
+function update(): void {
+       renderTitle();
+}
+
+update();
diff --git a/director/templates/index.html b/director/templates/index.html
new file mode 100644 (file)
index 0000000..f1e0771
--- /dev/null
@@ -0,0 +1,9 @@
+<!doctype html>
+<html>
+       <head>
+               <script type="text/javascript" type="module" src="/script/update.js" defer></script>
+       </head>
+       <body>
+               <span class="update root__product__current-price"></span>
+       </body>
+</html>
diff --git a/docs.html b/docs.html
new file mode 100644 (file)
index 0000000..c0a5e59
--- /dev/null
+++ b/docs.html
@@ -0,0 +1,35 @@
+<html>
+       <head>
+               <title>Documentation</title>
+       </head>
+       <body>
+               <h1>Docs</h1>
+
+               <h2>Classes</h2>
+
+               <h3><code>update</code></h3>
+               <p>
+                       generates the javascript to update the blocks <code>data-raw</code> attribute with the latest data from the websocket
+               </p>
+
+               <h3><code>root__[key]</code></h3>
+               <p>
+                       e.g. <code>root__product__price</code><br>
+                       generates the javascript to update the blocks <code>data-raw</code> attribute with the latest data from the websocket. when a block updates, all keys in that block (incl. other blocks) are all updated
+               </p>
+
+               <h3><code>timer</code></h3>
+               <p>
+                       when postprocessing <code>data-raw</code>, it is interpreted as a unix timecode and is displayed as time till that unix timecode
+               </p>
+
+               <h3><code>title</code></h3>
+               <p>
+                       when postprocessing <code>data-raw</code>, it is interpreted as text and put in title case
+               </p>
+
+               <h3><code></code></h3>
+               <p>
+               </p>
+       </body>
+</html>
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..7e10602
--- /dev/null
@@ -0,0 +1 @@
+flask
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644 (file)
index 0000000..e0bf5b8
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  // Visit https://aka.ms/tsconfig to read more about this file
+  "include": ["./director/src"],
+  "compilerOptions": {
+    // File Layout
+    "rootDir": "./director/src",
+    "outDir": "./director/build",
+
+    // Environment Settings
+    // See also https://aka.ms/tsconfig/module
+    "module": "nodenext",
+    "target": "esnext",
+    "types": [],
+    // For nodejs:
+    // "lib": ["esnext"],
+    // "types": ["node"],
+    // and npm install -D @types/node
+
+    // Other Outputs
+    "sourceMap": true,
+    "declaration": true,
+    "declarationMap": true,
+
+    // Stricter Typechecking Options
+    "noUncheckedIndexedAccess": true,
+    "exactOptionalPropertyTypes": true,
+
+    // Style Options
+    // "noImplicitReturns": true,
+    // "noImplicitOverride": true,
+    // "noUnusedLocals": true,
+    // "noUnusedParameters": true,
+    // "noFallthroughCasesInSwitch": true,
+    // "noPropertyAccessFromIndexSignature": true,
+
+    // Recommended Options
+    "strict": true,
+    "jsx": "react-jsx",
+    "verbatimModuleSyntax": false,
+    "isolatedModules": true,
+    "noUncheckedSideEffectImports": true,
+    "moduleDetection": "force",
+    "skipLibCheck": true,
+  }
+}