docs: tighten README quick start and stale comments
- Lead with purpose and exact local/CI commands. - Remove local absolute paths, stale auth notes and unverified claims. - Keep comments to the reason or invariant they protect.
This commit is contained in:
1 parent
dbb7a009a7
commit
66b80a62fb
14 files changed
+82
-84
No files matched your search
+5
-10
@@ -1,6 +1,5 @@
|
||||
// Server-side Go API client. Every Nitro route uses this module so the browser
|
||||
// only ever talks to the Nuxt origin: the Go base URL and the control
|
||||
// credentials stay in the Node process.
|
||||
// Server-side Go API client. Nitro routes use it so the browser only talks to
|
||||
// this origin and control credentials stay in the Node process.
|
||||
|
||||
interface ApiErrorEnvelope {
|
||||
error?: { code?: string; message?: string }
|
||||
@@ -39,7 +38,7 @@ export function apiBaseUrl(): string {
|
||||
).replace(/\/+$/, '')
|
||||
}
|
||||
|
||||
/** True only when NUXT_USE_MOCK=1 / NUXT_PUBLIC_USE_MOCK=1 is set. */
|
||||
/** Mock mode is opt-in via NUXT_USE_MOCK or NUXT_PUBLIC_USE_MOCK (1/true). */
|
||||
export function isMockMode(): boolean {
|
||||
const config = useRuntimeConfig()
|
||||
const raw =
|
||||
@@ -54,8 +53,7 @@ function controlAuthorization(): string | undefined {
|
||||
if (user && pass) return `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`
|
||||
|
||||
const token = envValue('CONTROL_TOKEN', 'NUXT_CONTROL_TOKEN') || String(config.controlToken ?? '')
|
||||
// Go currently validates Basic auth; Bearer is accepted here for the future
|
||||
// token-based control surface without exposing the token to the browser.
|
||||
// Go requires Basic today; Bearer is a fallback for a future token-based API.
|
||||
if (token) return `Bearer ${token}`
|
||||
return undefined
|
||||
}
|
||||
@@ -121,10 +119,7 @@ export async function apiRequest<T>(path: string, options: ApiRequestOptions = {
|
||||
return response._data as T
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward a request body (training upload) and preserve Go's status code and
|
||||
* JSON body, including 202/400/409/502 responses that are part of the flow.
|
||||
*/
|
||||
/** Forward a training upload and keep Go's status code for 202/4xx/5xx. */
|
||||
export async function apiForward<T>(
|
||||
event: import('h3').H3Event,
|
||||
path: string,
|
||||
|
||||
Reference in new issue
Block a user