fix(boot/user): Use common encoding utils
This logic is used through out the app and should be centralized
This commit is contained in:
committed by
mrugesh mohapatra
parent
953208244c
commit
f6e4bf74cb
@ -27,6 +27,7 @@ import {
|
||||
calcLongestStreak
|
||||
} from '../utils/user-stats';
|
||||
import supportedLanguages from '../../common/utils/supported-languages';
|
||||
import { encodeFcc } from '../../common/utils/encode-decode.js';
|
||||
import { getChallengeInfo, cachedMap } from '../utils/map';
|
||||
|
||||
const debug = debugFactory('fcc:boot:user');
|
||||
@ -71,22 +72,6 @@ const certText = {
|
||||
|
||||
const dateFormat = 'MMM DD, YYYY';
|
||||
|
||||
function replaceScriptTags(value) {
|
||||
return value
|
||||
.replace(/<script>/gi, 'fccss')
|
||||
.replace(/<\/script>/gi, 'fcces');
|
||||
}
|
||||
|
||||
function replaceFormAction(value) {
|
||||
return value.replace(/<form[^>]*>/, function(val) {
|
||||
return val.replace(/action(\s*?)=/, 'fccfaa$1=');
|
||||
});
|
||||
}
|
||||
|
||||
function encodeFcc(value = '') {
|
||||
return replaceScriptTags(replaceFormAction(value));
|
||||
}
|
||||
|
||||
function isAlgorithm(challenge) {
|
||||
// test if name starts with hike/waypoint/basejump/zipline
|
||||
// fix for bug that saved different challenges with incorrect
|
||||
|
Reference in New Issue
Block a user