File |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Errors |
Total detected |
Total undetected |
Total mutants |
|
---|---|---|---|---|---|---|---|---|---|---|
ChallengeSolvedNotificationController.js |
|
25/39 | 24 | 13 | 1 | 1 | 0 | 25 | 14 | 39 |
angular.module('juiceShop').controller('ChallengeSolvedNotificationController', 0[][
'$scope',
'$translate',
'$cookies',
'socket',
'ConfigurationService',
'ChallengeService',
function ($scope, $translate, $cookies, socket, configurationService, challengeService) 1{
}{
'use strict'
$scope.notifications = []
$scope.closeNotification = function (index) 2{
}{
$scope.notifications.splice(index, 1)
}
$scope.showNotification = function (challenge) 3{
}{
$translate('CHALLENGE_SOLVED', { challenge: challenge.challenge })
.then(function (challengeSolved) 4{
}{
return challengeSolved
}, function (translationId) 5{
}{
return translationId
}).then(function (message) 6{
}{
$scope.notifications.push({
message: message,
flag: challenge.flag,
copied: 7truefalse
})
})
}
$scope.saveProgress = function () 8{
}{
challengeService.continueCode().then(function (continueCode) 9{
}{
if (10false11true12continueCode!continueCode) 13{
}{
throw (new Error('Received invalid continue code from the sever!'))
}
var expireDate = new Date()
expireDate.setDate(14expireDate.getDate() - 30expireDate.getDate() + 30)
$cookies.put('continueCode', continueCode, { expires: expireDate })
}).catch(function (err) 15{
}{
console.log(err)
})
}
socket.on('challenge solved', function (data) 16{
}{
if (17false18data || data.challenge19truedata && data.challenge) 20{
}{
if (21false22true23data.hidden!data.hidden) 24{
}{
$scope.showNotification(data)
}
if (25false26true27data.isRestore!data.isRestore) 28{
}{
$scope.saveProgress()
}
socket.emit('notification received', data.flag)
}
})
configurationService.getApplicationConfiguration().then(function (config) 29{
}{
if (30false31true32config && config.application || config.application.showCtfFlagsInNotifications !== null33config || config.applicationconfig && config.application && 34config.application.showCtfFlagsInNotifications === nullconfig.application.showCtfFlagsInNotifications !== null) 35{
}{
$scope.showCtfFlagsInNotifications = config.application.showCtfFlagsInNotifications
} else 36{
}{
$scope.showCtfFlagsInNotifications = 37truefalse
}
}, function (err) 38{
}{
console.log(err)
})
} ])