11import React , { useEffect , useState , useRef } from 'react' ;
22import * as Styled from './Loader.styles' ;
33
4+ const BOOT_SEQUENCE = [
5+ '[0.000000] Linux version 6.8.11-amd64' ,
6+ '[0.018392] Command line: BOOT_IMAGE=/boot/vmlinuz root=/dev/sda1 quiet' ,
7+ '[ OK ] Started Load Kernel Modules.' ,
8+ '[ OK ] Mounted /home.' ,
9+ '[ OK ] Started udev Kernel Device Manager.' ,
10+ '[ OK ] Started Network Manager.' ,
11+ '[ OK ] Started Accounts Service.' ,
12+ '[ OK ] Started D-Bus System Message Bus.' ,
13+ '[ OK ] Started Light Display Manager.' ,
14+ '[ OK ] Reached target Graphical Interface.' ,
15+ 'Starting Kali GNU/Linux...' ,
16+ 'Initializing xfce4-session...' ,
17+ 'Loading profile: zis3c' ,
18+ 'Starting display manager...' ,
19+ ] ;
20+
421export interface Props {
522 isOnScreen : boolean ;
623 loadingDuration : number ;
@@ -19,24 +36,6 @@ const Loader = ({
1936 const [ bootLines , setBootLines ] = useState < string [ ] > ( [ ] ) ;
2037 const bootRef = useRef < HTMLDivElement > ( null ) ;
2138
22- // eslint-disable-next-line react-hooks/exhaustive-deps
23- const bootSequence = [
24- '[0.000000] Linux version 6.8.11-amd64' ,
25- '[0.018392] Command line: BOOT_IMAGE=/boot/vmlinuz root=/dev/sda1 quiet' ,
26- '[ OK ] Started Load Kernel Modules.' ,
27- '[ OK ] Mounted /home.' ,
28- '[ OK ] Started udev Kernel Device Manager.' ,
29- '[ OK ] Started Network Manager.' ,
30- '[ OK ] Started Accounts Service.' ,
31- '[ OK ] Started D-Bus System Message Bus.' ,
32- '[ OK ] Started Light Display Manager.' ,
33- '[ OK ] Reached target Graphical Interface.' ,
34- 'Starting Kali GNU/Linux...' ,
35- 'Initializing xfce4-session...' ,
36- 'Loading profile: zis3c' ,
37- 'Starting display manager...'
38- ] ;
39-
4039 useEffect ( ( ) => {
4140 if ( ! isOnScreen ) return ;
4241
@@ -47,10 +46,10 @@ const Loader = ({
4746 window . addEventListener ( 'keydown' , handleSkip ) ;
4847 window . addEventListener ( 'click' , handleSkip ) ;
4948
50- const lineDelay = ( loadingDuration - 400 ) / bootSequence . length ;
49+ const lineDelay = ( loadingDuration - 400 ) / BOOT_SEQUENCE . length ;
5150 const timeouts : NodeJS . Timeout [ ] = [ ] ;
5251
53- bootSequence . forEach ( ( line , index ) => {
52+ BOOT_SEQUENCE . forEach ( ( line , index ) => {
5453 const t = setTimeout ( ( ) => {
5554 setBootLines ( ( prev ) => [ ...prev , line ] ) ;
5655 if ( bootRef . current ) {
@@ -70,8 +69,7 @@ const Loader = ({
7069 window . removeEventListener ( 'click' , handleSkip ) ;
7170 timeouts . forEach ( clearTimeout ) ;
7271 } ;
73- // eslint-disable-next-line react-hooks/exhaustive-deps
74- } , [ isOnScreen ] ) ;
72+ } , [ isOnScreen , loadingDuration , onBootComplete ] ) ;
7573
7674 if ( ! isOnScreen ) return < > </ > ;
7775
@@ -83,7 +81,7 @@ const Loader = ({
8381 const rest = line . slice ( 8 ) ;
8482 return (
8583 < Styled . BootLine key = { index } >
86- [ < Styled . OkToken > OK</ Styled . OkToken > ]{ rest }
84+ [ < Styled . OkToken > OK</ Styled . OkToken > ]{ rest }
8785 </ Styled . BootLine >
8886 ) ;
8987 }
0 commit comments