File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Logs
21logs
32* .log
43npm-debug.log *
@@ -12,15 +11,15 @@ lerna-debug.log*
1211! .env.vite.production
1312! .env.vite.canary
1413! .env.vite.development
15- scripts
14+ /scripts /*
15+ ! /scripts /verify-node-modules.mjs
1616node_modules
1717dist
1818dist-ssr
1919* .local
2020
2121.vite
2222
23- # Editor directories and files
2423.vscode /*
2524! .vscode /extensions.json
2625.idea
Original file line number Diff line number Diff line change 1+ import { existsSync , readFileSync } from 'node:fs'
2+ import { fileURLToPath } from 'node:url'
3+ import { dirname , join } from 'node:path'
4+
5+ const root = join ( dirname ( fileURLToPath ( import . meta. url ) ) , '..' )
6+ const nm = join ( root , 'node_modules' )
7+
8+ if ( ! existsSync ( nm ) ) {
9+ console . error ( 'verify-node-modules: node_modules directory not found.' )
10+ process . exit ( 1 )
11+ }
12+
13+ const pkg = JSON . parse ( readFileSync ( join ( root , 'package.json' ) , 'utf8' ) )
14+ const deps = {
15+ ...pkg . dependencies ,
16+ ...pkg . devDependencies ,
17+ ...( pkg . optionalDependencies ?? { } ) ,
18+ }
19+
20+ for ( const name of Object . keys ( deps ) ) {
21+ const segments = name . split ( '/' )
22+ const pkgDir =
23+ name . startsWith ( '@' ) && segments . length >= 2
24+ ? join ( nm , segments [ 0 ] , segments [ 1 ] )
25+ : join ( nm , name )
26+ if ( ! existsSync ( pkgDir ) ) {
27+ console . error (
28+ `verify-node-modules: missing installed package "${ name } " (expected ${ pkgDir } )` ,
29+ )
30+ process . exit ( 1 )
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ export default function Submit() {
9999 if (
100100 success &&
101101 submittedFlight &&
102+ user &&
102103 session ?. isPFATC &&
103104 ( settings ?. acars ?. autoRedirectToAcars ?? true )
104105 ) {
@@ -109,6 +110,7 @@ export default function Submit() {
109110 } , [
110111 success ,
111112 submittedFlight ,
113+ user ,
112114 session ?. isPFATC ,
113115 settings ?. acars ?. autoRedirectToAcars ,
114116 sessionId ,
@@ -540,13 +542,18 @@ export default function Submit() {
540542 < Button
541543 onClick = { ( ) => {
542544 setShowRating ( false ) ;
543- navigate (
544- `/acars/${ sessionId } /${ submittedFlight . id } ?acars_token=${ submittedFlight . acars_token } `
545- ) ;
545+ const acarsPath = `/acars/${ sessionId } /${ submittedFlight . id } ?acars_token=${ submittedFlight . acars_token } ` ;
546+ if ( user ) {
547+ navigate ( acarsPath ) ;
548+ } else {
549+ window . location . href = getDiscordLoginUrl ( acarsPath ) ;
550+ }
546551 } }
547552 >
548553 < TowerControl className = "h-5 w-5 mr-2" />
549- Go to ACARS
554+ { user
555+ ? 'Go to ACARS'
556+ : 'Log in to access ACARS and PDCs' }
550557 </ Button >
551558 ) }
552559 < Button onClick = { handleCreateAnother } variant = "outline" >
You can’t perform that action at this time.
0 commit comments