• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

juice-shop / juice-shop / 20077631254

09 Dec 2025 08:31PM UTC coverage: 86.013% (-0.1%) from 86.117%
20077631254

push

github

J12934
Remove app.module.ts entirely

Not really a module anymore so name is kinda confusing

1251 of 1676 branches covered (74.64%)

Branch coverage included in aggregate %.

5341 of 5988 relevant lines covered (89.2%)

40.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.61
/frontend/src/app/server-started-notification/server-started-notification.component.ts
1
/*
2
 * Copyright (c) 2014-2026 Bjoern Kimminich & the OWASP Juice Shop contributors.
3
 * SPDX-License-Identifier: MIT
4
 */
5

6
import { TranslateService, TranslateModule } from '@ngx-translate/core'
7
import { ChallengeService } from '../Services/challenge.service'
8
import { ChangeDetectorRef, Component, NgZone, type OnInit, inject } from '@angular/core'
9
import { CookieService } from 'ngy-cookie'
10
import { SocketIoService } from '../Services/socket-io.service'
11
import { MatIconModule } from '@angular/material/icon'
12
import { MatButtonModule } from '@angular/material/button'
13
import { MatCardModule, MatCardContent } from '@angular/material/card'
14

15
interface HackingProgress {
16
  autoRestoreMessage: string | null
17
  cleared: boolean
18
}
19

20
@Component({
21
  selector: 'app-server-started-notification',
22
  templateUrl: './server-started-notification.component.html',
23
  styleUrls: ['./server-started-notification.component.scss'],
24
  imports: [MatCardModule, MatCardContent, TranslateModule, MatButtonModule, MatIconModule]
25
})
26
export class ServerStartedNotificationComponent implements OnInit {
1✔
27
  private readonly ngZone = inject(NgZone)
11✔
28
  private readonly challengeService = inject(ChallengeService)
11✔
29
  private readonly translate = inject(TranslateService)
11✔
30
  private readonly cookieService = inject(CookieService)
11✔
31
  private readonly ref = inject(ChangeDetectorRef)
11✔
32
  private readonly io = inject(SocketIoService)
11✔
33

34
  public hackingProgress: HackingProgress = {} as HackingProgress
11✔
35

36
  ngOnInit (): void {
37
    this.ngZone.runOutsideAngular(() => {
18✔
38
      this.io.socket().on('server started', () => {
18✔
39
        const continueCode = this.cookieService.get('continueCode')
17✔
40
        const continueCodeFindIt = this.cookieService.get('continueCodeFindIt')
17✔
41
        const continueCodeFixIt = this.cookieService.get('continueCodeFixIt')
17✔
42
        if (continueCode) {
17✔
43
          this.challengeService.restoreProgress(encodeURIComponent(continueCode)).subscribe({
6✔
44
            next: () => {
45
              this.translate.get('AUTO_RESTORED_PROGRESS').subscribe({
3✔
46
                next: (notificationServerStarted) => {
47
                  this.hackingProgress.autoRestoreMessage = notificationServerStarted
3✔
48
                },
49
                error: (translationId) => {
50
                  this.hackingProgress.autoRestoreMessage = translationId
×
51
                }
52
              })
53
            },
54
            error: (error) => {
55
              console.log(error)
3✔
56
              this.translate.get('AUTO_RESTORE_PROGRESS_FAILED', { error }).subscribe({
3✔
57
                next: (notificationServerStarted) => {
58
                  this.hackingProgress.autoRestoreMessage = notificationServerStarted
3✔
59
                },
60
                error: (translationId) => {
61
                  this.hackingProgress.autoRestoreMessage = translationId
×
62
                }
63
              })
64
            }
65
          })
66
        }
67
        if (continueCodeFindIt) {
17!
68
          this.challengeService.restoreProgressFindIt(encodeURIComponent(continueCodeFindIt)).subscribe({
×
69
            next: () => {
70
            },
71
            error: (error) => {
72
              console.log(error)
×
73
            }
74
          })
75
        }
76
        if (continueCodeFixIt) {
17!
77
          this.challengeService.restoreProgressFixIt(encodeURIComponent(continueCodeFixIt)).subscribe({
×
78
            next: () => {
79
            },
80
            error: (error) => {
81
              console.log(error)
×
82
            }
83
          })
84
        }
85
        this.ref.detectChanges()
17✔
86
      })
87
    })
88
  }
89

90
  closeNotification () {
91
    this.hackingProgress.autoRestoreMessage = null
1✔
92
  }
93

94
  clearProgress () {
95
    this.cookieService.remove('continueCode')
1✔
96
    this.cookieService.remove('continueCodeFixIt')
1✔
97
    this.cookieService.remove('continueCodeFindIt')
1✔
98
    this.cookieService.remove('token')
1✔
99
    sessionStorage.removeItem('bid')
1✔
100
    sessionStorage.removeItem('itemTotal')
1✔
101
    localStorage.removeItem('token')
1✔
102
    localStorage.removeItem('displayedDifficulties')
1✔
103
    localStorage.removeItem('showSolvedChallenges')
1✔
104
    localStorage.removeItem('showDisabledChallenges')
1✔
105
    localStorage.removeItem('showOnlyTutorialChallenges')
1✔
106
    localStorage.removeItem('displayedChallengeCategories')
1✔
107
    this.hackingProgress.cleared = true
1✔
108
  }
109
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc