mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-01 06:06:05 +08:00
dont log users id on transmission
This commit is contained in:
@@ -126,7 +126,7 @@ export default defineEventHandler(async (event) => {
|
||||
sessionId?: string;
|
||||
}>(event);
|
||||
|
||||
const user = await requireUserSession(event);
|
||||
// const user = await requireUserSession(event);
|
||||
|
||||
const rawSessionId = typeof body?.sessionId === "string"
|
||||
? body.sessionId.trim()
|
||||
@@ -222,11 +222,9 @@ export default defineEventHandler(async (event) => {
|
||||
ttsProvider
|
||||
};
|
||||
|
||||
// await writeFile(fileJson, JSON.stringify(meta, null, 2), "utf-8");
|
||||
|
||||
try {
|
||||
await TransmissionLog.create({
|
||||
user: user._id,
|
||||
// user: user._id,
|
||||
role: "atc",
|
||||
channel: "say",
|
||||
direction: "outgoing",
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
import { defineEventHandler, getRequestURL } from 'h3'
|
||||
import { requireUserSession } from '../utils/auth'
|
||||
import {defineEventHandler, getRequestURL} from 'h3'
|
||||
import {requireUserSession} from '../utils/auth'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const url = getRequestURL(event)
|
||||
if (!url.pathname.startsWith('/api/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname.startsWith('/api/service/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname.startsWith('/api/bridge/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname === '/api/decision-flows/runtime') {
|
||||
return
|
||||
}
|
||||
if (event.node.req.method === 'OPTIONS') {
|
||||
return
|
||||
}
|
||||
await requireUserSession(event)
|
||||
const url = getRequestURL(event)
|
||||
if (!url.pathname.startsWith('/api/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname.startsWith('/api/atc/say')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname.startsWith('/api/service/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname.startsWith('/api/bridge/')) {
|
||||
return
|
||||
}
|
||||
if (url.pathname === '/api/decision-flows/runtime') {
|
||||
return
|
||||
}
|
||||
if (event.node.req.method === 'OPTIONS') {
|
||||
return
|
||||
}
|
||||
await requireUserSession(event)
|
||||
})
|
||||
|
||||
|
||||
@@ -16,6 +16,40 @@ export interface FlightLabButton {
|
||||
instructorAlert?: string
|
||||
}
|
||||
|
||||
// --- MSFS SimConnect Telemetry ---
|
||||
|
||||
/** MSFS2020 SimConnect variable state — keys match SimConnect naming */
|
||||
export interface FlightLabTelemetryState {
|
||||
AIRSPEED_INDICATED: number // knots
|
||||
GROUND_VELOCITY: number // knots
|
||||
VERTICAL_SPEED: number // feet per minute
|
||||
PLANE_ALTITUDE: number // feet MSL
|
||||
PLANE_PITCH_DEGREES: number // degrees
|
||||
TURB_ENG_N1_1: number // percent (0-100), engine 1
|
||||
TURB_ENG_N1_2: number // percent (0-100), engine 2
|
||||
SIM_ON_GROUND: boolean
|
||||
GEAR_HANDLE_POSITION: boolean // true = down, false = up
|
||||
FLAPS_HANDLE_INDEX: number // 0-4 for A320
|
||||
BRAKE_PARKING_POSITION: boolean // true = set, false = released
|
||||
AUTOPILOT_MASTER: boolean
|
||||
timestamp?: number
|
||||
}
|
||||
|
||||
export type SimConditionOperator = '>' | '<' | '>=' | '<=' | '==' | '!='
|
||||
|
||||
export interface SimCondition {
|
||||
variable: keyof FlightLabTelemetryState
|
||||
operator: SimConditionOperator
|
||||
value: number | boolean
|
||||
}
|
||||
|
||||
export interface SimConditionGroup {
|
||||
conditions: SimCondition[]
|
||||
logic: 'AND' | 'OR'
|
||||
}
|
||||
|
||||
// --- Phase ---
|
||||
|
||||
export interface FlightLabPhase {
|
||||
id: string
|
||||
atcMessage: string
|
||||
@@ -24,8 +58,18 @@ export interface FlightLabPhase {
|
||||
sounds?: FlightLabSound[]
|
||||
instructorNote?: string
|
||||
autoAdvanceAfterTTS?: boolean
|
||||
/** SimConnect conditions for auto-advance (when sim data available) */
|
||||
simConditions?: SimConditionGroup
|
||||
/** How long to wait (ms) before showing help if conditions not met. Default 20000 */
|
||||
simConditionTimeoutMs?: number
|
||||
/** Help message spoken via TTS when timeout reached */
|
||||
simConditionHelpMessage?: string
|
||||
/** Phase to advance to when conditions are met */
|
||||
simConditionNextPhase?: string
|
||||
}
|
||||
|
||||
// --- Scenario ---
|
||||
|
||||
export interface FlightLabScenario {
|
||||
id: string
|
||||
title: string
|
||||
@@ -38,6 +82,8 @@ export interface FlightLabScenario {
|
||||
phases: FlightLabPhase[]
|
||||
}
|
||||
|
||||
// --- Session / WebSocket ---
|
||||
|
||||
export type FlightLabRole = 'instructor' | 'participant'
|
||||
|
||||
export interface FlightLabSessionState {
|
||||
|
||||
Reference in New Issue
Block a user