Document codebase: comments, per-area READMEs, deployment guide
Readability pass across all four areas of the stack. Comments explain why rather than what, concentrated at the points where behaviour is non-obvious: concurrency, caching, auth, scraping and nginx templating. Backend: doc comments on every exported declaration across handlers, services, models and resolvers. Resolver commentary lives inside function bodies so gqlgen does not strip it on regeneration; schema files use # comments rather than description blocks so introspection output is unchanged. Extracted the duplicated auth-cookie blocks into helpers. Frontend: header comments on every component, store and view, including STATUS: notes marking which of the parallel/legacy views are still live. Documented the non-reactive animation-state pattern, the homeData hub and the WebSocket stale-socket guard. Removed a few dead imports and named the reconnect-backoff and poll-interval constants. Python: module and function docstrings covering the Travelodge scraping contract, the deadline threading, the two-executor concurrency and the NDJSON streaming protocol. Infra: header blocks on every compose file, nginx template, Dockerfile and entrypoint, covering the config selection, envsubst allow-lists, rate-limit semantics and volume persistence. Hoisted the duplicated envsubst variable list in nginx/entrypoint.sh. New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example, backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which stated a 24h access token where main.go sets 7 days. No behaviour change. go build/vet, vite build, py_compile and docker compose config all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/admin` (guarded by `meta.requiresAdmin`) — a tab strip over every
|
||||
* create/manage form. Each entry in `sections` maps a tab id to a component
|
||||
* rendered by <component :is>. Unlike the home widgets these are eagerly
|
||||
* imported, since reaching this page means you want them.
|
||||
*/
|
||||
import { ref, computed } from "vue";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import Button from "@/components/input/Button.vue";
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: log a consumed book/film/game. Emits "done"/"cancel".
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
|
||||
import { ref } from "vue";
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: create a categorised bookmark. Emits "done"/"cancel".
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: create a favourite. Emits "done"/"cancel" (see CreatePost.vue).
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
|
||||
import { ref } from "vue";
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: create a place / thing to do. Goes through stores/places.js rather
|
||||
* than gql() directly, so the new row appears in the Places table immediately.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { usePlacesStore } from "@/stores/places";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: create a blog post. Emits "done" on success and "cancel" when
|
||||
* dismissed, so the host (the Feed widget's modal, or Admin.vue) decides what to
|
||||
* close or refresh.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: upload photos of an erg monitor. The Go backend OCRs each image and
|
||||
* returns the parsed session, so this posts multipart/form-data to /api/rowing
|
||||
* rather than using GraphQL. Uploads run in parallel and each file's row reports
|
||||
* its own outcome.
|
||||
*
|
||||
* The returned Time is a Go duration in nanoseconds, hence the /1e9 before
|
||||
* splitting into minutes and seconds.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import axios from "axios";
|
||||
@@ -28,6 +37,7 @@ async function submit() {
|
||||
const res = await axios.post("/api/rowing", formData, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
// Time comes back as a Go time.Duration, i.e. nanoseconds.
|
||||
const mins = Math.floor(res.data.Time / 1e9 / 60);
|
||||
const secs = String(Math.floor((res.data.Time / 1e9) % 60)).padStart(
|
||||
2,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin form: create an account. Reports success or failure inline.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/admin/login`. On success redirects to `?redirect=` (set by the router
|
||||
* guard when it bounced you here) or to /admin.
|
||||
*
|
||||
* auth.logIn() never throws — it swallows the error — so success is detected by
|
||||
* re-reading `auth.loggedIn` afterwards rather than by a try/catch.
|
||||
*/
|
||||
import { ref } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
@@ -18,6 +25,8 @@ async function handleLogin() {
|
||||
submitting.value = true;
|
||||
errorMsg.value = "";
|
||||
try {
|
||||
// logIn() swallows its error, so success is detected by re-reading
|
||||
// `loggedIn` rather than by catching.
|
||||
await auth.logIn(username.value, password.value);
|
||||
if (auth.loggedIn) {
|
||||
const dest = route.query.redirect || "/admin";
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin panel: list and upload tracks for the Icecast radio. REST
|
||||
* (multipart/form-data) rather than GraphQL because it moves files.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin panel: list users and toggle their admin flag. Mutates the local `user`
|
||||
* object in place from the mutation's response, so the row updates without a
|
||||
* refetch.
|
||||
*/
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
|
||||
Reference in New Issue
Block a user