Add github_code/freeCodeCamp__freeCodeCamp from GitHub (part 2)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/redirection.ts +174 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/sentry.test.ts +843 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/sentry.ts +343 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/tokens.test.ts +79 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/tokens.ts +68 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validate-donation.test.ts +30 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validate-donation.ts +10 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validation.test.ts +17 -0
- github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validation.ts +64 -0
- github_code/freeCodeCamp__freeCodeCamp/api/tools/exam-environment/seed/index.ts +32 -0
- github_code/freeCodeCamp__freeCodeCamp/api/tools/exam-environment/test/index.ts +42 -0
- github_code/freeCodeCamp__freeCodeCamp/api/tsconfig.build.json +11 -0
- github_code/freeCodeCamp__freeCodeCamp/api/tsconfig.json +14 -0
- github_code/freeCodeCamp__freeCodeCamp/api/turbo.json +102 -0
- github_code/freeCodeCamp__freeCodeCamp/api/vitest.utils.test.ts +105 -0
- github_code/freeCodeCamp__freeCodeCamp/api/vitest.utils.ts +327 -0
- github_code/freeCodeCamp__freeCodeCamp/client/.babelrc.js +71 -0
- github_code/freeCodeCamp__freeCodeCamp/client/.gitignore +31 -0
- github_code/freeCodeCamp__freeCodeCamp/client/.lintstagedrc.mjs +4 -0
- github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/gatsby.ts +33 -0
- github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/react-i18next.js +67 -0
- github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/react-spinkit.tsx +4 -0
- github_code/freeCodeCamp__freeCodeCamp/client/config/analytics-settings.ts +2 -0
- github_code/freeCodeCamp__freeCodeCamp/client/config/cert-and-project-map.test.ts +77 -0
- github_code/freeCodeCamp__freeCodeCamp/client/config/cert-and-project-map.ts +1031 -0
- github_code/freeCodeCamp__freeCodeCamp/client/config/growthbook-features-default.json +151 -0
- github_code/freeCodeCamp__freeCodeCamp/client/config/misc.ts +4 -0
- github_code/freeCodeCamp__freeCodeCamp/client/eslint.config.mjs +78 -0
- github_code/freeCodeCamp__freeCodeCamp/client/gatsby-browser.tsx +50 -0
- github_code/freeCodeCamp__freeCodeCamp/client/gatsby-config.ts +70 -0
- github_code/freeCodeCamp__freeCodeCamp/client/gatsby-node.ts +137 -0
- github_code/freeCodeCamp__freeCodeCamp/client/gatsby-ssr.tsx +66 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/config-for-tests.ts +22 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/config.js +91 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales.test.ts +120 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/arabic/links.json +43 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/chinese-traditional/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/chinese/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/intro.json +0 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/links.json +43 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/meta-tags.json +32 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/motivation.json +891 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/translations.json +0 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/espanol/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/german/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/italian/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/japanese/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/korean/links.json +43 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/portuguese/links.json +41 -0
- github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/swahili/links.json +41 -0
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/redirection.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import jwt from 'jsonwebtoken';
|
| 2 |
+
|
| 3 |
+
import { availableLangs } from '@freecodecamp/shared/config/i18n';
|
| 4 |
+
import { allowedOrigins } from './allowed-origins.js';
|
| 5 |
+
|
| 6 |
+
// process.env.HOME_LOCATION is being used as a fallback here. If the one
|
| 7 |
+
// provided by the client is invalid we default to this.
|
| 8 |
+
import { HOME_LOCATION } from './env.js';
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Get the returnTo value.
|
| 12 |
+
*
|
| 13 |
+
* @param encryptedParams - The encrypted parameters.
|
| 14 |
+
* @param secret - The secret key.
|
| 15 |
+
* @param _homeLocation - The home location.
|
| 16 |
+
* @returns The returnTo value.
|
| 17 |
+
*/
|
| 18 |
+
export function getReturnTo(
|
| 19 |
+
encryptedParams: string,
|
| 20 |
+
secret: jwt.Secret,
|
| 21 |
+
_homeLocation = process.env.HOME_LOCATION
|
| 22 |
+
) {
|
| 23 |
+
let params;
|
| 24 |
+
try {
|
| 25 |
+
params = jwt.verify(encryptedParams, secret);
|
| 26 |
+
} catch {
|
| 27 |
+
// something went wrong, use default params
|
| 28 |
+
params = {
|
| 29 |
+
returnTo: `${_homeLocation}/learn`,
|
| 30 |
+
origin: _homeLocation,
|
| 31 |
+
pathPrefix: ''
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
// @ts-expect-error - I'm working on it...
|
| 36 |
+
return normalizeParams(params, _homeLocation);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
type RedirectParams = {
|
| 40 |
+
returnTo: string;
|
| 41 |
+
origin: string;
|
| 42 |
+
pathPrefix: string;
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Normalize the parameters, making they're valid.
|
| 47 |
+
*
|
| 48 |
+
* @param arg - The parameters to normalize.
|
| 49 |
+
* @param arg.returnTo - The returnTo value.
|
| 50 |
+
* @param arg.origin - The origin value.
|
| 51 |
+
* @param arg.pathPrefix - The pathPrefix value.
|
| 52 |
+
* @param _homeLocation - The home location.
|
| 53 |
+
* @returns The normalized parameters.
|
| 54 |
+
*/
|
| 55 |
+
export function normalizeParams(
|
| 56 |
+
{ returnTo, origin, pathPrefix }: Partial<RedirectParams>,
|
| 57 |
+
_homeLocation = HOME_LOCATION
|
| 58 |
+
): RedirectParams {
|
| 59 |
+
// coerce to strings, just in case something weird and nefarious is happening
|
| 60 |
+
// TODO: validate, don't coerce
|
| 61 |
+
returnTo = '' + returnTo;
|
| 62 |
+
origin = '' + origin;
|
| 63 |
+
pathPrefix = '' + pathPrefix;
|
| 64 |
+
// TODO(Post-MVP): consider adding HOME_LOCATION in allowedOrigins to allow
|
| 65 |
+
// redirection to work in development.
|
| 66 |
+
// we add the '/' to prevent returns to
|
| 67 |
+
// www.freecodecamp.org.somewhere.else.com
|
| 68 |
+
if (
|
| 69 |
+
!returnTo ||
|
| 70 |
+
!allowedOrigins.some(allowed => returnTo?.startsWith(allowed + '/'))
|
| 71 |
+
) {
|
| 72 |
+
returnTo = `${_homeLocation}/learn`;
|
| 73 |
+
origin = _homeLocation;
|
| 74 |
+
pathPrefix = '';
|
| 75 |
+
}
|
| 76 |
+
if (!origin || !allowedOrigins.includes(origin)) {
|
| 77 |
+
returnTo = `${_homeLocation}/learn`;
|
| 78 |
+
origin = _homeLocation;
|
| 79 |
+
pathPrefix = '';
|
| 80 |
+
}
|
| 81 |
+
pathPrefix = availableLangs.client.includes(pathPrefix) ? pathPrefix : '';
|
| 82 |
+
return { returnTo, origin, pathPrefix };
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Get the prefixed landing path.
|
| 87 |
+
*
|
| 88 |
+
* @param origin - The origin value.
|
| 89 |
+
* @param pathPrefix - The pathPrefix value.
|
| 90 |
+
* @returns The prefixed landing path.
|
| 91 |
+
*/
|
| 92 |
+
export function getPrefixedLandingPath(origin: string, pathPrefix?: string) {
|
| 93 |
+
const redirectPathSegment = pathPrefix ? `/${pathPrefix}` : '';
|
| 94 |
+
return `${origin}${redirectPathSegment}`;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
function getParamsFromUrl(
|
| 98 |
+
url: string | undefined | null,
|
| 99 |
+
normalize: typeof normalizeParams
|
| 100 |
+
) {
|
| 101 |
+
// since we do not always redirect the user back to the page they were on
|
| 102 |
+
// we need client locale and origin to construct the redirect url.
|
| 103 |
+
let returnUrl;
|
| 104 |
+
try {
|
| 105 |
+
returnUrl = new URL(url ? url : HOME_LOCATION);
|
| 106 |
+
} catch (_e) {
|
| 107 |
+
returnUrl = new URL(HOME_LOCATION);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
const origin = returnUrl.origin;
|
| 111 |
+
// if this is not one of the client languages, validation will convert
|
| 112 |
+
// this to '' before it is used.
|
| 113 |
+
const pathPrefix = returnUrl.pathname.split('/')[1] ?? '';
|
| 114 |
+
return normalize({
|
| 115 |
+
// strip off any query parameters
|
| 116 |
+
returnTo: returnUrl.origin + returnUrl.pathname,
|
| 117 |
+
origin,
|
| 118 |
+
pathPrefix
|
| 119 |
+
});
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Get the redirect parameters.
|
| 124 |
+
*
|
| 125 |
+
* @param req - A fastify Request.
|
| 126 |
+
* @param req.headers - The request headers.
|
| 127 |
+
* @param req.headers.referer - The referer header.
|
| 128 |
+
* @param _normalizeParams - The function to normalize the parameters.
|
| 129 |
+
* @returns The redirect parameters.
|
| 130 |
+
*/
|
| 131 |
+
export function getRedirectParams(
|
| 132 |
+
req: { headers: { referer?: string } },
|
| 133 |
+
_normalizeParams = normalizeParams
|
| 134 |
+
): RedirectParams {
|
| 135 |
+
const url = req.headers['referer'];
|
| 136 |
+
return getParamsFromUrl(url, _normalizeParams);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Get the redirect parameters after sign in flow.
|
| 141 |
+
*
|
| 142 |
+
* @param req - A fastify Request.
|
| 143 |
+
* @param req.cookies - The request cookies.
|
| 144 |
+
* @param req.unsignCookie - The function to unsign the cookie.
|
| 145 |
+
* @param _normalizeParams - The function to normalize the parameters.
|
| 146 |
+
* @returns The redirect parameters.
|
| 147 |
+
*/
|
| 148 |
+
export function getLoginRedirectParams(
|
| 149 |
+
req: {
|
| 150 |
+
cookies: Record<string, string | undefined>;
|
| 151 |
+
unsignCookie: (rawValue: string) => { value: string | null };
|
| 152 |
+
},
|
| 153 |
+
_normalizeParams = normalizeParams
|
| 154 |
+
): RedirectParams {
|
| 155 |
+
const signedUrl = req.cookies['login-returnto'];
|
| 156 |
+
const url = signedUrl ? req.unsignCookie(signedUrl).value : null;
|
| 157 |
+
return getParamsFromUrl(url, _normalizeParams);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* Check if the redirect base and return URL have the same path.
|
| 162 |
+
*
|
| 163 |
+
* @param redirectBase - The redirect base URL.
|
| 164 |
+
* @param returnUrl - The return URL.
|
| 165 |
+
* @returns A boolean indicating whether the paths are the same.
|
| 166 |
+
*/
|
| 167 |
+
export function haveSamePath(
|
| 168 |
+
redirectBase: string | URL,
|
| 169 |
+
returnUrl: string | URL
|
| 170 |
+
) {
|
| 171 |
+
const base = new URL(redirectBase);
|
| 172 |
+
const url = new URL(returnUrl);
|
| 173 |
+
return base.pathname === url.pathname;
|
| 174 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/sentry.test.ts
ADDED
|
@@ -0,0 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{ describe, expect, it, vi } from 'vitest';
|
| 3 |
+
|
| 4 |
+
import {
|
| 5 |
+
makeShouldSendLog,
|
| 6 |
+
makeTracesSampler,
|
| 7 |
+
scrubRedundantLogAttributes,
|
| 8 |
+
scrubRequestPii,
|
| 9 |
+
scrubSpanDescriptions
|
| 10 |
+
} from './sentry.js';
|
| 11 |
+
|
| 12 |
+
const makeLog = (overrides: Partial<Log> = {}): Log => ({
|
| 13 |
+
level: 'info',
|
| 14 |
+
message: 'something happened',
|
| 15 |
+
attributes: {},
|
| 16 |
+
...overrides
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
describe('shouldSendLog', () => {
|
| 20 |
+
const shouldSendLog = makeShouldSendLog(1);
|
| 21 |
+
|
| 22 |
+
it('drops the incoming request message regardless of level', () => {
|
| 23 |
+
expect(shouldSendLog(makeLog({ message: 'incoming request' }))).toBe(false);
|
| 24 |
+
expect(
|
| 25 |
+
shouldSendLog(makeLog({ message: 'incoming request', level: 'error' }))
|
| 26 |
+
).toBe(false);
|
| 27 |
+
});
|
| 28 |
+
|
| 29 |
+
it('drops the fastify per-interface boot line by message prefix', () => {
|
| 30 |
+
expect(
|
| 31 |
+
shouldSendLog(
|
| 32 |
+
makeLog({ message: 'Server listening at http://127.0.0.1:3000' })
|
| 33 |
+
)
|
| 34 |
+
).toBe(false);
|
| 35 |
+
expect(
|
| 36 |
+
shouldSendLog(
|
| 37 |
+
makeLog({ message: 'Server listening at http://[::1]:3000' })
|
| 38 |
+
)
|
| 39 |
+
).toBe(false);
|
| 40 |
+
});
|
| 41 |
+
|
| 42 |
+
it('keeps the custom "API server started" boot log', () => {
|
| 43 |
+
expect(
|
| 44 |
+
shouldSendLog(
|
| 45 |
+
makeLog({ message: 'API server started', attributes: { audit: true } })
|
| 46 |
+
)
|
| 47 |
+
).toBe(true);
|
| 48 |
+
});
|
| 49 |
+
|
| 50 |
+
it('drops debug logs from suppressed routes', () => {
|
| 51 |
+
expect(
|
| 52 |
+
shouldSendLog(
|
| 53 |
+
makeLog({ level: 'debug', attributes: { route: '/user/session-user' } })
|
| 54 |
+
)
|
| 55 |
+
).toBe(false);
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
it('keeps debug logs on other routes', () => {
|
| 59 |
+
expect(
|
| 60 |
+
shouldSendLog(
|
| 61 |
+
makeLog({ level: 'debug', attributes: { route: '/some/route' } })
|
| 62 |
+
)
|
| 63 |
+
).toBe(true);
|
| 64 |
+
});
|
| 65 |
+
|
| 66 |
+
it('keeps debug logs without a route', () => {
|
| 67 |
+
expect(shouldSendLog(makeLog({ level: 'debug' }))).toBe(true);
|
| 68 |
+
});
|
| 69 |
+
|
| 70 |
+
it('drops per-request framework lifecycle chatter regardless of route', () => {
|
| 71 |
+
for (const message of ['request completed', 'stream closed prematurely']) {
|
| 72 |
+
expect(shouldSendLog(makeLog({ message }))).toBe(false);
|
| 73 |
+
expect(
|
| 74 |
+
shouldSendLog(
|
| 75 |
+
makeLog({ message, attributes: { route: '/some/route' } })
|
| 76 |
+
)
|
| 77 |
+
).toBe(false);
|
| 78 |
+
}
|
| 79 |
+
});
|
| 80 |
+
|
| 81 |
+
it('keeps request errored so response failures still reach Sentry', () => {
|
| 82 |
+
expect(
|
| 83 |
+
shouldSendLog(makeLog({ message: 'request errored', level: 'error' }))
|
| 84 |
+
).toBe(true);
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
it('keeps non-info levels', () => {
|
| 88 |
+
for (const level of ['warn', 'error', 'fatal'] as const) {
|
| 89 |
+
expect(shouldSendLog(makeLog({ level }))).toBe(true);
|
| 90 |
+
}
|
| 91 |
+
});
|
| 92 |
+
|
| 93 |
+
it('keeps non-info levels even on a suppressed route', () => {
|
| 94 |
+
expect(
|
| 95 |
+
shouldSendLog(
|
| 96 |
+
makeLog({ level: 'error', attributes: { route: '/user/session-user' } })
|
| 97 |
+
)
|
| 98 |
+
).toBe(true);
|
| 99 |
+
});
|
| 100 |
+
|
| 101 |
+
it('drops info logs from suppressed routes', () => {
|
| 102 |
+
expect(
|
| 103 |
+
shouldSendLog(makeLog({ attributes: { route: '/user/session-user' } }))
|
| 104 |
+
).toBe(false);
|
| 105 |
+
});
|
| 106 |
+
|
| 107 |
+
it('keeps info logs on other routes', () => {
|
| 108 |
+
expect(
|
| 109 |
+
shouldSendLog(makeLog({ attributes: { route: '/some/route' } }))
|
| 110 |
+
).toBe(true);
|
| 111 |
+
});
|
| 112 |
+
|
| 113 |
+
it('keeps info logs without a route', () => {
|
| 114 |
+
expect(shouldSendLog(makeLog())).toBe(true);
|
| 115 |
+
});
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
+
describe('makeShouldSendLog — debug sampling', () => {
|
| 119 |
+
const debugLog = (overrides: Partial<Log> = {}): Log =>
|
| 120 |
+
makeLog({ level: 'debug', ...overrides });
|
| 121 |
+
|
| 122 |
+
it('drops debug from suppressed routes even when the trace is sampled', () => {
|
| 123 |
+
expect(
|
| 124 |
+
makeShouldSendLog(1)(
|
| 125 |
+
debugLog({
|
| 126 |
+
attributes: { route: '/status/ping', traceSampled: true }
|
| 127 |
+
})
|
| 128 |
+
)
|
| 129 |
+
).toBe(false);
|
| 130 |
+
});
|
| 131 |
+
|
| 132 |
+
it('keeps debug whose trace is sampled regardless of rate', () => {
|
| 133 |
+
expect(
|
| 134 |
+
makeShouldSendLog(0)(
|
| 135 |
+
debugLog({ attributes: { traceId: 'abc', traceSampled: true } })
|
| 136 |
+
)
|
| 137 |
+
).toBe(true);
|
| 138 |
+
});
|
| 139 |
+
|
| 140 |
+
it('drops ambient (unsampled-trace) debug at rate 0', () => {
|
| 141 |
+
expect(
|
| 142 |
+
makeShouldSendLog(0)(debugLog({ attributes: { traceId: 'abc' } }))
|
| 143 |
+
).toBe(false);
|
| 144 |
+
expect(makeShouldSendLog(0)(debugLog())).toBe(false);
|
| 145 |
+
});
|
| 146 |
+
|
| 147 |
+
it('keeps ambient debug at rate 1', () => {
|
| 148 |
+
expect(
|
| 149 |
+
makeShouldSendLog(1)(debugLog({ attributes: { traceId: 'abc' } }))
|
| 150 |
+
).toBe(true);
|
| 151 |
+
});
|
| 152 |
+
|
| 153 |
+
it('samples debug deterministically by traceId', () => {
|
| 154 |
+
const log = debugLog({ attributes: { traceId: 'deadbeef' } });
|
| 155 |
+
const first = makeShouldSendLog(0.5)(log);
|
| 156 |
+
const second = makeShouldSendLog(0.5)(log);
|
| 157 |
+
expect(first).toBe(second);
|
| 158 |
+
});
|
| 159 |
+
|
| 160 |
+
it('keeps warn/error/fatal regardless of the debug rate', () => {
|
| 161 |
+
for (const level of ['warn', 'error', 'fatal'] as const) {
|
| 162 |
+
expect(makeShouldSendLog(0)(makeLog({ level }))).toBe(true);
|
| 163 |
+
}
|
| 164 |
+
});
|
| 165 |
+
});
|
| 166 |
+
|
| 167 |
+
describe('makeShouldSendLog — info sampling', () => {
|
| 168 |
+
it('always keeps audit info logs even at a zero sample rate', () => {
|
| 169 |
+
expect(
|
| 170 |
+
makeShouldSendLog(1, 0)(makeLog({ attributes: { audit: true } }))
|
| 171 |
+
).toBe(true);
|
| 172 |
+
});
|
| 173 |
+
|
| 174 |
+
it('always keeps audit info logs on an otherwise suppressed route', () => {
|
| 175 |
+
expect(
|
| 176 |
+
makeShouldSendLog(
|
| 177 |
+
1,
|
| 178 |
+
0
|
| 179 |
+
)(
|
| 180 |
+
makeLog({
|
| 181 |
+
attributes: { audit: true, route: '/some/route' }
|
| 182 |
+
})
|
| 183 |
+
)
|
| 184 |
+
).toBe(true);
|
| 185 |
+
});
|
| 186 |
+
|
| 187 |
+
it('keeps audit info logs on a real suppressed route even at zero sample rates', () => {
|
| 188 |
+
expect(
|
| 189 |
+
makeShouldSendLog(
|
| 190 |
+
0,
|
| 191 |
+
0
|
| 192 |
+
)(
|
| 193 |
+
makeLog({
|
| 194 |
+
message: 'audit',
|
| 195 |
+
attributes: { audit: true, route: '/user/session-user' }
|
| 196 |
+
})
|
| 197 |
+
)
|
| 198 |
+
).toBe(true);
|
| 199 |
+
});
|
| 200 |
+
|
| 201 |
+
it('keeps audit logs regardless of level, including debug on a suppressed route', () => {
|
| 202 |
+
expect(
|
| 203 |
+
makeShouldSendLog(
|
| 204 |
+
0,
|
| 205 |
+
0
|
| 206 |
+
)(
|
| 207 |
+
makeLog({
|
| 208 |
+
level: 'debug',
|
| 209 |
+
message: 'audit',
|
| 210 |
+
attributes: { audit: true, route: '/user/session-user' }
|
| 211 |
+
})
|
| 212 |
+
)
|
| 213 |
+
).toBe(true);
|
| 214 |
+
});
|
| 215 |
+
|
| 216 |
+
it('drops non-audit info logs at a zero sample rate', () => {
|
| 217 |
+
expect(
|
| 218 |
+
makeShouldSendLog(1, 0)(makeLog({ attributes: { traceId: 'abc' } }))
|
| 219 |
+
).toBe(false);
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
it('keeps non-audit info logs at a sample rate of 1', () => {
|
| 223 |
+
expect(
|
| 224 |
+
makeShouldSendLog(1, 1)(makeLog({ attributes: { traceId: 'abc' } }))
|
| 225 |
+
).toBe(true);
|
| 226 |
+
});
|
| 227 |
+
|
| 228 |
+
it('keeps info whose trace is sampled regardless of the info rate', () => {
|
| 229 |
+
expect(
|
| 230 |
+
makeShouldSendLog(
|
| 231 |
+
1,
|
| 232 |
+
0
|
| 233 |
+
)(makeLog({ attributes: { traceId: 'abc', traceSampled: true } }))
|
| 234 |
+
).toBe(true);
|
| 235 |
+
});
|
| 236 |
+
|
| 237 |
+
it('samples non-audit info deterministically by traceId', () => {
|
| 238 |
+
const log = makeLog({ attributes: { traceId: 'deadbeef' } });
|
| 239 |
+
const first = makeShouldSendLog(1, 0.5)(log);
|
| 240 |
+
const second = makeShouldSendLog(1, 0.5)(log);
|
| 241 |
+
expect(first).toBe(second);
|
| 242 |
+
});
|
| 243 |
+
|
| 244 |
+
it('never touches warn/error/fatal regardless of the info rate', () => {
|
| 245 |
+
for (const level of ['warn', 'error', 'fatal'] as const) {
|
| 246 |
+
expect(makeShouldSendLog(1, 0)(makeLog({ level }))).toBe(true);
|
| 247 |
+
}
|
| 248 |
+
});
|
| 249 |
+
|
| 250 |
+
it('defaults to a sample rate of 1 when none is given', () => {
|
| 251 |
+
expect(
|
| 252 |
+
makeShouldSendLog(1)(makeLog({ attributes: { traceId: 'abc' } }))
|
| 253 |
+
).toBe(true);
|
| 254 |
+
});
|
| 255 |
+
});
|
| 256 |
+
|
| 257 |
+
describe('scrubRedundantLogAttributes', () => {
|
| 258 |
+
it('drops pino bindings duplicated by Sentry-native fields', () => {
|
| 259 |
+
const result = scrubRedundantLogAttributes(
|
| 260 |
+
makeLog({
|
| 261 |
+
attributes: {
|
| 262 |
+
msg: 'hello',
|
| 263 |
+
'pino.logger.level': 30,
|
| 264 |
+
message: 'hello',
|
| 265 |
+
trace_id: 'abc',
|
| 266 |
+
level: 'info',
|
| 267 |
+
severity_number: 9,
|
| 268 |
+
userId: 'user-42'
|
| 269 |
+
}
|
| 270 |
+
})
|
| 271 |
+
);
|
| 272 |
+
|
| 273 |
+
expect(result.attributes).toEqual({
|
| 274 |
+
message: 'hello',
|
| 275 |
+
trace_id: 'abc',
|
| 276 |
+
level: 'info',
|
| 277 |
+
severity_number: 9,
|
| 278 |
+
userId: 'user-42'
|
| 279 |
+
});
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
it('is a no-op when there are no attributes', () => {
|
| 283 |
+
expect(
|
| 284 |
+
scrubRedundantLogAttributes(makeLog({ attributes: undefined }))
|
| 285 |
+
).toEqual(makeLog({ attributes: undefined }));
|
| 286 |
+
});
|
| 287 |
+
|
| 288 |
+
it('redacts secret- and payment-credential-shaped attribute keys', () => {
|
| 289 |
+
const result = scrubRedundantLogAttributes(
|
| 290 |
+
makeLog({
|
| 291 |
+
attributes: {
|
| 292 |
+
audit: true,
|
| 293 |
+
userId: 'user-42',
|
| 294 |
+
email: 'a@b.com',
|
| 295 |
+
client_secret: 'pi_secret_LEAK',
|
| 296 |
+
authorization: 'Bearer sk_live_LEAK',
|
| 297 |
+
password: 'hunter2',
|
| 298 |
+
api_key: 'key_LEAK',
|
| 299 |
+
token: 'tok_LEAK',
|
| 300 |
+
'err.raw.client_secret': 'nested_LEAK'
|
| 301 |
+
}
|
| 302 |
+
})
|
| 303 |
+
);
|
| 304 |
+
|
| 305 |
+
expect(result.attributes).toEqual({
|
| 306 |
+
audit: true,
|
| 307 |
+
userId: 'user-42',
|
| 308 |
+
email: 'a@b.com',
|
| 309 |
+
client_secret: '[REDACTED]',
|
| 310 |
+
authorization: '[REDACTED]',
|
| 311 |
+
password: '[REDACTED]',
|
| 312 |
+
api_key: '[REDACTED]',
|
| 313 |
+
token: '[REDACTED]',
|
| 314 |
+
'err.raw.client_secret': '[REDACTED]'
|
| 315 |
+
});
|
| 316 |
+
});
|
| 317 |
+
|
| 318 |
+
it('redacts secrets nested inside object attribute values', () => {
|
| 319 |
+
const result = scrubRedundantLogAttributes(
|
| 320 |
+
makeLog({
|
| 321 |
+
attributes: {
|
| 322 |
+
err: { message: 'boom', raw: { client_secret: 'LEAK' } }
|
| 323 |
+
}
|
| 324 |
+
})
|
| 325 |
+
);
|
| 326 |
+
|
| 327 |
+
expect(JSON.stringify(result.attributes)).not.toContain('LEAK');
|
| 328 |
+
});
|
| 329 |
+
|
| 330 |
+
it('keeps intentional PII (email, ip, country) on an audit log', () => {
|
| 331 |
+
const result = scrubRedundantLogAttributes(
|
| 332 |
+
makeLog({
|
| 333 |
+
attributes: {
|
| 334 |
+
audit: true,
|
| 335 |
+
email: 'a@b.com',
|
| 336 |
+
ip: '1.2.3.4',
|
| 337 |
+
country: 'US'
|
| 338 |
+
}
|
| 339 |
+
})
|
| 340 |
+
);
|
| 341 |
+
|
| 342 |
+
expect(result.attributes).toEqual({
|
| 343 |
+
audit: true,
|
| 344 |
+
email: 'a@b.com',
|
| 345 |
+
ip: '1.2.3.4',
|
| 346 |
+
country: 'US'
|
| 347 |
+
});
|
| 348 |
+
});
|
| 349 |
+
|
| 350 |
+
it('redacts email but keeps ip/country on a non-audit log', () => {
|
| 351 |
+
const result = scrubRedundantLogAttributes(
|
| 352 |
+
makeLog({
|
| 353 |
+
attributes: { email: 'a@b.com', ip: '1.2.3.4', country: 'US' }
|
| 354 |
+
})
|
| 355 |
+
);
|
| 356 |
+
|
| 357 |
+
expect(result.attributes).toEqual({
|
| 358 |
+
email: '[REDACTED]',
|
| 359 |
+
ip: '1.2.3.4',
|
| 360 |
+
country: 'US'
|
| 361 |
+
});
|
| 362 |
+
});
|
| 363 |
+
|
| 364 |
+
it('redacts secret-token-shaped substrings found inside a string value', () => {
|
| 365 |
+
const result = scrubRedundantLogAttributes(
|
| 366 |
+
makeLog({
|
| 367 |
+
attributes: { note: 'leaked key sk_live_ABC123 in the log' }
|
| 368 |
+
})
|
| 369 |
+
);
|
| 370 |
+
|
| 371 |
+
expect(result.attributes?.note).toBe('leaked key [REDACTED] in the log');
|
| 372 |
+
});
|
| 373 |
+
|
| 374 |
+
it('redacts an email substring in a non-audit log string value', () => {
|
| 375 |
+
const result = scrubRedundantLogAttributes(
|
| 376 |
+
makeLog({ attributes: { note: 'contact a@b.com for help' } })
|
| 377 |
+
);
|
| 378 |
+
|
| 379 |
+
expect(result.attributes?.note).toBe('contact [REDACTED] for help');
|
| 380 |
+
});
|
| 381 |
+
|
| 382 |
+
it('keeps an email substring in an audit log string value', () => {
|
| 383 |
+
const result = scrubRedundantLogAttributes(
|
| 384 |
+
makeLog({ attributes: { audit: true, note: 'contact a@b.com for help' } })
|
| 385 |
+
);
|
| 386 |
+
|
| 387 |
+
expect(result.attributes?.note).toBe('contact a@b.com for help');
|
| 388 |
+
});
|
| 389 |
+
|
| 390 |
+
it('redacts a bare email attribute value on a non-audit log', () => {
|
| 391 |
+
const result = scrubRedundantLogAttributes(
|
| 392 |
+
makeLog({ attributes: { email: 'keep@me.com' } })
|
| 393 |
+
);
|
| 394 |
+
|
| 395 |
+
expect(result.attributes?.email).toBe('[REDACTED]');
|
| 396 |
+
});
|
| 397 |
+
|
| 398 |
+
it('redacts a bare JWT substring in a log string value', () => {
|
| 399 |
+
const result = scrubRedundantLogAttributes(
|
| 400 |
+
makeLog({
|
| 401 |
+
attributes: {
|
| 402 |
+
note: 'token eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.dozjgNryP4J3jVmNHl0w5 rest'
|
| 403 |
+
}
|
| 404 |
+
})
|
| 405 |
+
);
|
| 406 |
+
|
| 407 |
+
expect(result.attributes?.note).toBe('token [REDACTED] rest');
|
| 408 |
+
});
|
| 409 |
+
|
| 410 |
+
it('redacts a lowercase bearer token substring in a log string value', () => {
|
| 411 |
+
const result = scrubRedundantLogAttributes(
|
| 412 |
+
makeLog({
|
| 413 |
+
attributes: {
|
| 414 |
+
note: 'auth bearer abcdefghijklmnopqrstuvwxyz012345 done'
|
| 415 |
+
}
|
| 416 |
+
})
|
| 417 |
+
);
|
| 418 |
+
|
| 419 |
+
expect(result.attributes?.note).toBe('auth [REDACTED] done');
|
| 420 |
+
});
|
| 421 |
+
|
| 422 |
+
it('fail-safe redacts a Logs attribute value nested past the depth cap', () => {
|
| 423 |
+
const buildNested = (depth: number, leaf: unknown): unknown =>
|
| 424 |
+
depth <= 0 ? leaf : { nested: buildNested(depth - 1, leaf) };
|
| 425 |
+
|
| 426 |
+
const result = scrubRedundantLogAttributes(
|
| 427 |
+
makeLog({
|
| 428 |
+
attributes: buildNested(9, 'deep-plain-value') as Record<
|
| 429 |
+
string,
|
| 430 |
+
unknown
|
| 431 |
+
>
|
| 432 |
+
})
|
| 433 |
+
);
|
| 434 |
+
|
| 435 |
+
const serialized = JSON.stringify(result.attributes);
|
| 436 |
+
expect(serialized).toContain('[REDACTED]');
|
| 437 |
+
expect(serialized).not.toContain('deep-plain-value');
|
| 438 |
+
});
|
| 439 |
+
|
| 440 |
+
it('redacts a secret-shaped substring in the log message', () => {
|
| 441 |
+
const result = scrubRedundantLogAttributes(
|
| 442 |
+
makeLog({
|
| 443 |
+
message: 'auth bearer abcdefghijklmnopqrstuvwxyz012345 failed'
|
| 444 |
+
})
|
| 445 |
+
);
|
| 446 |
+
|
| 447 |
+
expect(result.message).toBe('auth [REDACTED] failed');
|
| 448 |
+
});
|
| 449 |
+
|
| 450 |
+
it('redacts an email in a non-audit log message', () => {
|
| 451 |
+
const result = scrubRedundantLogAttributes(
|
| 452 |
+
makeLog({ message: 'error for user@example.com occurred' })
|
| 453 |
+
);
|
| 454 |
+
|
| 455 |
+
expect(result.message).toBe('error for [REDACTED] occurred');
|
| 456 |
+
});
|
| 457 |
+
|
| 458 |
+
it('keeps an email in an audit log message', () => {
|
| 459 |
+
const result = scrubRedundantLogAttributes(
|
| 460 |
+
makeLog({
|
| 461 |
+
message: 'donation outreach to user@example.com queued',
|
| 462 |
+
attributes: { audit: true }
|
| 463 |
+
})
|
| 464 |
+
);
|
| 465 |
+
|
| 466 |
+
expect(result.message).toBe('donation outreach to user@example.com queued');
|
| 467 |
+
});
|
| 468 |
+
|
| 469 |
+
it('redacts a Stripe webhook secret in an attribute value', () => {
|
| 470 |
+
const result = scrubRedundantLogAttributes(
|
| 471 |
+
makeLog({ attributes: { note: 'sig whsec_abcdef0123456789 ok' } })
|
| 472 |
+
);
|
| 473 |
+
|
| 474 |
+
expect(result.attributes?.note).toBe('sig [REDACTED] ok');
|
| 475 |
+
});
|
| 476 |
+
|
| 477 |
+
it('redacts a Basic auth credential in an attribute value', () => {
|
| 478 |
+
const result = scrubRedundantLogAttributes(
|
| 479 |
+
makeLog({
|
| 480 |
+
attributes: { note: 'auth Basic dXNlcjpodW50ZXIyc2VjcmV0 end' }
|
| 481 |
+
})
|
| 482 |
+
);
|
| 483 |
+
|
| 484 |
+
expect(result.attributes?.note).toBe('auth [REDACTED] end');
|
| 485 |
+
});
|
| 486 |
+
|
| 487 |
+
it('scrubs a pathological JWT-prefix string without catastrophic backtracking', () => {
|
| 488 |
+
const attack = 'eyJ'.repeat(80000);
|
| 489 |
+
const result = scrubRedundantLogAttributes(
|
| 490 |
+
makeLog({ attributes: { note: attack } })
|
| 491 |
+
);
|
| 492 |
+
|
| 493 |
+
expect(typeof result.attributes?.note).toBe('string');
|
| 494 |
+
});
|
| 495 |
+
|
| 496 |
+
it('redacts a secret in a boxed-String (parameterized) message', () => {
|
| 497 |
+
const message = Object.assign(
|
| 498 |
+
new String('issued token sk_live_BOXEDLEAK now'),
|
| 499 |
+
{
|
| 500 |
+
__sentry_template_string__: 'issued token %s now',
|
| 501 |
+
__sentry_template_values__: ['sk_live_BOXEDLEAK']
|
| 502 |
+
}
|
| 503 |
+
) as unknown as Log['message'];
|
| 504 |
+
|
| 505 |
+
const result = scrubRedundantLogAttributes(makeLog({ message }));
|
| 506 |
+
|
| 507 |
+
expect(String(result.message)).toBe('issued token [REDACTED] now');
|
| 508 |
+
});
|
| 509 |
+
|
| 510 |
+
it('redacts secrets nested inside an array attribute value', () => {
|
| 511 |
+
const result = scrubRedundantLogAttributes(
|
| 512 |
+
makeLog({
|
| 513 |
+
attributes: { items: [{ list: [{ client_secret: 'ARRLEAK' }] }] }
|
| 514 |
+
})
|
| 515 |
+
);
|
| 516 |
+
|
| 517 |
+
expect(JSON.stringify(result.attributes)).not.toContain('ARRLEAK');
|
| 518 |
+
});
|
| 519 |
+
});
|
| 520 |
+
|
| 521 |
+
describe('scrubRequestPii', () => {
|
| 522 |
+
const eventWithRequest = (request: ErrorEvent['request']): ErrorEvent => ({
|
| 523 |
+
type: undefined,
|
| 524 |
+
request
|
| 525 |
+
});
|
| 526 |
+
|
| 527 |
+
it('is a no-op when the event has no request', () => {
|
| 528 |
+
const event = eventWithRequest(undefined);
|
| 529 |
+
expect(scrubRequestPii(event)).toEqual(event);
|
| 530 |
+
});
|
| 531 |
+
|
| 532 |
+
it('strips the query string entirely and the query portion of the url', () => {
|
| 533 |
+
const result = scrubRequestPii(
|
| 534 |
+
eventWithRequest({
|
| 535 |
+
url: 'https://api.freecodecamp.org/donate?code=abc123',
|
| 536 |
+
query_string: 'code=abc123'
|
| 537 |
+
})
|
| 538 |
+
);
|
| 539 |
+
|
| 540 |
+
expect(result.request?.query_string).toBeUndefined();
|
| 541 |
+
expect(result.request?.url).toBe('https://api.freecodecamp.org/donate');
|
| 542 |
+
});
|
| 543 |
+
|
| 544 |
+
it('redacts an email embedded in the url path', () => {
|
| 545 |
+
const result = scrubRequestPii(
|
| 546 |
+
eventWithRequest({ url: 'https://api.freecodecamp.org/u/foo@bar.com' })
|
| 547 |
+
);
|
| 548 |
+
|
| 549 |
+
expect(result.request?.url).toBe(
|
| 550 |
+
'https://api.freecodecamp.org/u/[REDACTED]'
|
| 551 |
+
);
|
| 552 |
+
});
|
| 553 |
+
|
| 554 |
+
it('redacts PII- and secret-shaped keys from the request body', () => {
|
| 555 |
+
const result = scrubRequestPii(
|
| 556 |
+
eventWithRequest({
|
| 557 |
+
data: {
|
| 558 |
+
paymentMethodId: 'pm_12345',
|
| 559 |
+
email: 'a@b.com',
|
| 560 |
+
name: 'Camper Bot',
|
| 561 |
+
code: 'oauth-code',
|
| 562 |
+
state: 'oauth-state',
|
| 563 |
+
amount: 500
|
| 564 |
+
}
|
| 565 |
+
})
|
| 566 |
+
);
|
| 567 |
+
|
| 568 |
+
expect(result.request?.data).toEqual({
|
| 569 |
+
paymentMethodId: '[REDACTED]',
|
| 570 |
+
email: '[REDACTED]',
|
| 571 |
+
name: '[REDACTED]',
|
| 572 |
+
code: '[REDACTED]',
|
| 573 |
+
state: '[REDACTED]',
|
| 574 |
+
amount: 500
|
| 575 |
+
});
|
| 576 |
+
});
|
| 577 |
+
|
| 578 |
+
it('redacts sensitive request headers', () => {
|
| 579 |
+
const result = scrubRequestPii(
|
| 580 |
+
eventWithRequest({
|
| 581 |
+
headers: { authorization: 'Bearer sk_live_LEAK', 'user-agent': 'x' }
|
| 582 |
+
})
|
| 583 |
+
);
|
| 584 |
+
|
| 585 |
+
expect(result.request?.headers).toEqual({
|
| 586 |
+
authorization: '[REDACTED]',
|
| 587 |
+
'user-agent': 'x'
|
| 588 |
+
});
|
| 589 |
+
});
|
| 590 |
+
|
| 591 |
+
it('redacts email and paymentMethodId when request data is a raw JSON string', () => {
|
| 592 |
+
const result = scrubRequestPii(
|
| 593 |
+
eventWithRequest({
|
| 594 |
+
data: JSON.stringify({
|
| 595 |
+
email: 'a@b.com',
|
| 596 |
+
paymentMethodId: 'pm_123',
|
| 597 |
+
amount: 5
|
| 598 |
+
})
|
| 599 |
+
})
|
| 600 |
+
);
|
| 601 |
+
|
| 602 |
+
const data = result.request?.data;
|
| 603 |
+
const parsed = typeof data === 'string' ? JSON.parse(data) : data;
|
| 604 |
+
|
| 605 |
+
expect(parsed).toEqual({
|
| 606 |
+
email: '[REDACTED]',
|
| 607 |
+
paymentMethodId: '[REDACTED]',
|
| 608 |
+
amount: 5
|
| 609 |
+
});
|
| 610 |
+
});
|
| 611 |
+
|
| 612 |
+
it('always strips cookies regardless of their content', () => {
|
| 613 |
+
const result = scrubRequestPii(
|
| 614 |
+
eventWithRequest({ cookies: { jwt_access_token: 'secret' } })
|
| 615 |
+
);
|
| 616 |
+
|
| 617 |
+
expect(result.request?.cookies).toBeUndefined();
|
| 618 |
+
});
|
| 619 |
+
|
| 620 |
+
it('redacts an email found inside a free-text data value', () => {
|
| 621 |
+
const result = scrubRequestPii(
|
| 622 |
+
eventWithRequest({ data: { about: 'reach me at me@example.com' } })
|
| 623 |
+
);
|
| 624 |
+
|
| 625 |
+
expect(result.request?.data).toEqual({
|
| 626 |
+
about: 'reach me at [REDACTED]'
|
| 627 |
+
});
|
| 628 |
+
});
|
| 629 |
+
|
| 630 |
+
it('redacts a secret-shaped value in a header whose key is not sensitive', () => {
|
| 631 |
+
const result = scrubRequestPii(
|
| 632 |
+
eventWithRequest({
|
| 633 |
+
headers: { 'x-custom': 'Bearer abcdefghijklmnopqrstuvwxyz012345' }
|
| 634 |
+
})
|
| 635 |
+
);
|
| 636 |
+
|
| 637 |
+
expect(result.request?.headers).toEqual({ 'x-custom': '[REDACTED]' });
|
| 638 |
+
});
|
| 639 |
+
|
| 640 |
+
it('fail-safe redacts a value nested past the depth cap', () => {
|
| 641 |
+
const buildNested = (depth: number, leaf: unknown): unknown =>
|
| 642 |
+
depth <= 0 ? leaf : { nested: buildNested(depth - 1, leaf) };
|
| 643 |
+
|
| 644 |
+
const result = scrubRequestPii(
|
| 645 |
+
eventWithRequest({ data: buildNested(9, 'just-a-plain-value') })
|
| 646 |
+
);
|
| 647 |
+
|
| 648 |
+
const serialized = JSON.stringify(result.request?.data);
|
| 649 |
+
expect(serialized).toContain('[REDACTED]');
|
| 650 |
+
expect(serialized).not.toContain('just-a-plain-value');
|
| 651 |
+
});
|
| 652 |
+
|
| 653 |
+
it('redacts an email in the exception message and in extra', () => {
|
| 654 |
+
const event: ErrorEvent = {
|
| 655 |
+
type: undefined,
|
| 656 |
+
exception: { values: [{ value: 'failed for user x@y.com' }] },
|
| 657 |
+
extra: { email: 'z@z.com' }
|
| 658 |
+
};
|
| 659 |
+
|
| 660 |
+
const result = scrubRequestPii(event);
|
| 661 |
+
|
| 662 |
+
expect(result.exception?.values?.[0]?.value).toBe(
|
| 663 |
+
'failed for user [REDACTED]'
|
| 664 |
+
);
|
| 665 |
+
expect(result.extra?.email).toBe('[REDACTED]');
|
| 666 |
+
});
|
| 667 |
+
|
| 668 |
+
it('redacts secret-shaped local variables captured in stack frames', () => {
|
| 669 |
+
const event: ErrorEvent = {
|
| 670 |
+
type: undefined,
|
| 671 |
+
exception: {
|
| 672 |
+
values: [
|
| 673 |
+
{
|
| 674 |
+
value: 'boom',
|
| 675 |
+
stacktrace: {
|
| 676 |
+
frames: [
|
| 677 |
+
{
|
| 678 |
+
function: 'doThing',
|
| 679 |
+
vars: {
|
| 680 |
+
jwt_access_token: 'signed-cookie-value',
|
| 681 |
+
note: 'holding sk_live_FRAMELEAK here',
|
| 682 |
+
userId: 'u1'
|
| 683 |
+
}
|
| 684 |
+
}
|
| 685 |
+
]
|
| 686 |
+
}
|
| 687 |
+
}
|
| 688 |
+
]
|
| 689 |
+
}
|
| 690 |
+
};
|
| 691 |
+
|
| 692 |
+
const result = scrubRequestPii(event);
|
| 693 |
+
const vars = result.exception?.values?.[0]?.stacktrace?.frames?.[0]?.vars;
|
| 694 |
+
|
| 695 |
+
expect(vars?.jwt_access_token).toBe('[REDACTED]');
|
| 696 |
+
expect(vars?.note).toBe('holding [REDACTED] here');
|
| 697 |
+
expect(vars?.userId).toBe('u1');
|
| 698 |
+
});
|
| 699 |
+
|
| 700 |
+
it('redacts secret-shaped fields on event.user but keeps id and email', () => {
|
| 701 |
+
const event: ErrorEvent = {
|
| 702 |
+
type: undefined,
|
| 703 |
+
user: { id: 'u1', email: 'donor@example.com', apiKey: 'sk_live_USERLEAK' }
|
| 704 |
+
};
|
| 705 |
+
|
| 706 |
+
const result = scrubRequestPii(event);
|
| 707 |
+
|
| 708 |
+
expect(result.user?.id).toBe('u1');
|
| 709 |
+
expect(result.user?.email).toBe('donor@example.com');
|
| 710 |
+
expect((result.user as Record<string, unknown>).apiKey).toBe('[REDACTED]');
|
| 711 |
+
});
|
| 712 |
+
|
| 713 |
+
it('strips request.env entirely', () => {
|
| 714 |
+
const result = scrubRequestPii(
|
| 715 |
+
eventWithRequest({
|
| 716 |
+
env: { REMOTE_USER: 'a@b.com', SERVER_SECRET: 'sk_live_ENVLEAK' }
|
| 717 |
+
})
|
| 718 |
+
);
|
| 719 |
+
|
| 720 |
+
expect(result.request?.env).toBeUndefined();
|
| 721 |
+
});
|
| 722 |
+
|
| 723 |
+
it('redacts secret-shaped data in breadcrumbs', () => {
|
| 724 |
+
const event: ErrorEvent = {
|
| 725 |
+
type: undefined,
|
| 726 |
+
breadcrumbs: [
|
| 727 |
+
{
|
| 728 |
+
category: 'http',
|
| 729 |
+
data: {
|
| 730 |
+
url: 'https://api.stripe.com?key=sk_live_BCLEAK',
|
| 731 |
+
token: 'ghp_BCLEAK'
|
| 732 |
+
}
|
| 733 |
+
}
|
| 734 |
+
]
|
| 735 |
+
};
|
| 736 |
+
|
| 737 |
+
const result = scrubRequestPii(event);
|
| 738 |
+
const data = result.breadcrumbs?.[0]?.data;
|
| 739 |
+
|
| 740 |
+
expect(data?.token).toBe('[REDACTED]');
|
| 741 |
+
expect(data?.url).toBe('https://api.stripe.com?key=[REDACTED]');
|
| 742 |
+
});
|
| 743 |
+
|
| 744 |
+
it('scrubs a 1MB JWT-prefix body within the ReDoS budget', () => {
|
| 745 |
+
const result = scrubRequestPii(
|
| 746 |
+
eventWithRequest({ data: 'eyJ'.repeat(333333) })
|
| 747 |
+
);
|
| 748 |
+
|
| 749 |
+
expect(typeof result.request?.data).toBe('string');
|
| 750 |
+
});
|
| 751 |
+
});
|
| 752 |
+
|
| 753 |
+
describe('makeTracesSampler', () => {
|
| 754 |
+
const context = (name: string) => ({
|
| 755 |
+
name,
|
| 756 |
+
inheritOrSampleWith: vi.fn((fallback: number) => fallback)
|
| 757 |
+
});
|
| 758 |
+
|
| 759 |
+
it('drops health check transactions', () => {
|
| 760 |
+
expect(makeTracesSampler(0.1)(context('GET /status/ping'))).toBe(0);
|
| 761 |
+
expect(makeTracesSampler(0.1)(context('GET /status/ready'))).toBe(0);
|
| 762 |
+
});
|
| 763 |
+
|
| 764 |
+
it('samples other transactions with the configured rate', () => {
|
| 765 |
+
const ctx = context('GET /user/session-user');
|
| 766 |
+
expect(makeTracesSampler(0.1)(ctx)).toBe(0.1);
|
| 767 |
+
expect(ctx.inheritOrSampleWith).toHaveBeenCalledWith(0.1);
|
| 768 |
+
});
|
| 769 |
+
});
|
| 770 |
+
|
| 771 |
+
describe('scrubSpanDescriptions', () => {
|
| 772 |
+
const makeTxn = (
|
| 773 |
+
spans: Array<{ description?: string; data?: Record<string, unknown> }>
|
| 774 |
+
): Event =>
|
| 775 |
+
({
|
| 776 |
+
type: 'transaction',
|
| 777 |
+
spans: spans.map(({ description, data }) => ({
|
| 778 |
+
span_id: 'a',
|
| 779 |
+
trace_id: 'b',
|
| 780 |
+
start_timestamp: 0,
|
| 781 |
+
description,
|
| 782 |
+
data: data ?? {}
|
| 783 |
+
}))
|
| 784 |
+
}) as unknown as Event;
|
| 785 |
+
|
| 786 |
+
it('replaces a Mongo ObjectId literal in a span description with a placeholder', () => {
|
| 787 |
+
const [span] =
|
| 788 |
+
scrubSpanDescriptions(
|
| 789 |
+
makeTxn([
|
| 790 |
+
{
|
| 791 |
+
description:
|
| 792 |
+
'aggregate [{"$match":{"_id":ObjectId("58dfb02b565f48223c4da7b5")}}]'
|
| 793 |
+
}
|
| 794 |
+
])
|
| 795 |
+
).spans ?? [];
|
| 796 |
+
expect(span?.description).toBe(
|
| 797 |
+
'aggregate [{"$match":{"_id":ObjectId("?")}}]'
|
| 798 |
+
);
|
| 799 |
+
});
|
| 800 |
+
|
| 801 |
+
it('produces identical descriptions for spans differing only by ObjectId', () => {
|
| 802 |
+
const scrub = (id: string): string | undefined =>
|
| 803 |
+
scrubSpanDescriptions(
|
| 804 |
+
makeTxn([{ description: `find ObjectId("${id}")` }])
|
| 805 |
+
).spans?.[0]?.description;
|
| 806 |
+
expect(scrub('58dfb02b565f48223c4da7b5')).toBe(
|
| 807 |
+
scrub('58f2a1dc23aadf34519c26ba')
|
| 808 |
+
);
|
| 809 |
+
});
|
| 810 |
+
|
| 811 |
+
it('scrubs the db.query.text span attribute', () => {
|
| 812 |
+
const [span] =
|
| 813 |
+
scrubSpanDescriptions(
|
| 814 |
+
makeTxn([
|
| 815 |
+
{
|
| 816 |
+
description: 'q',
|
| 817 |
+
data: { 'db.query.text': 'ObjectId("58dfb02b565f48223c4da7b5")' }
|
| 818 |
+
}
|
| 819 |
+
])
|
| 820 |
+
).spans ?? [];
|
| 821 |
+
expect(span?.data['db.query.text']).toBe('ObjectId("?")');
|
| 822 |
+
});
|
| 823 |
+
|
| 824 |
+
it('replaces an ISODate literal', () => {
|
| 825 |
+
const [span] =
|
| 826 |
+
scrubSpanDescriptions(
|
| 827 |
+
makeTxn([{ description: 'ISODate("2026-07-13T00:00:00.000Z")' }])
|
| 828 |
+
).spans ?? [];
|
| 829 |
+
expect(span?.description).toBe('ISODate("?")');
|
| 830 |
+
});
|
| 831 |
+
|
| 832 |
+
it('leaves a non-Mongo span description untouched', () => {
|
| 833 |
+
const [span] =
|
| 834 |
+
scrubSpanDescriptions(makeTxn([{ description: 'GET /learn' }])).spans ??
|
| 835 |
+
[];
|
| 836 |
+
expect(span?.description).toBe('GET /learn');
|
| 837 |
+
});
|
| 838 |
+
|
| 839 |
+
it('is a no-op when the event has no spans', () => {
|
| 840 |
+
const event = { type: 'transaction' } as unknown as Event;
|
| 841 |
+
expect(scrubSpanDescriptions(event).spans).toBeUndefined();
|
| 842 |
+
});
|
| 843 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/sentry.ts
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ErrorEvent, Event, Log, RequestEventData } from '@sentry/node';
|
| 2 |
+
|
| 3 |
+
const DROPPED_LOG_MESSAGES = new Set([
|
| 4 |
+
'incoming request',
|
| 5 |
+
'request completed',
|
| 6 |
+
'stream closed prematurely'
|
| 7 |
+
]);
|
| 8 |
+
|
| 9 |
+
const DROPPED_LOG_MESSAGE_PREFIXES = ['Server listening at'];
|
| 10 |
+
|
| 11 |
+
const isDroppedLogMessage = (message: Log['message']): boolean =>
|
| 12 |
+
typeof message === 'string' &&
|
| 13 |
+
(DROPPED_LOG_MESSAGES.has(message) ||
|
| 14 |
+
DROPPED_LOG_MESSAGE_PREFIXES.some(prefix => message.startsWith(prefix)));
|
| 15 |
+
|
| 16 |
+
// Hot / health routes whose routine info+debug chatter is filtered out of
|
| 17 |
+
// Sentry entirely (replaces the old per-route sample rates). warn/error/fatal
|
| 18 |
+
// on these routes is still forwarded.
|
| 19 |
+
const DROPPED_LOG_ROUTES = new Set([
|
| 20 |
+
'/user/session-user',
|
| 21 |
+
'/status/ping',
|
| 22 |
+
'/status/ready'
|
| 23 |
+
]);
|
| 24 |
+
|
| 25 |
+
const routeOf = (log: Log): string | undefined =>
|
| 26 |
+
typeof log.attributes?.route === 'string' ? log.attributes.route : undefined;
|
| 27 |
+
|
| 28 |
+
const traceIdOf = (log: Log): string | undefined =>
|
| 29 |
+
typeof log.attributes?.traceId === 'string'
|
| 30 |
+
? log.attributes.traceId
|
| 31 |
+
: undefined;
|
| 32 |
+
|
| 33 |
+
const traceIsSampled = (log: Log): boolean =>
|
| 34 |
+
log.attributes?.traceSampled === true;
|
| 35 |
+
|
| 36 |
+
const isAuditLog = (log: Log): boolean => log.attributes?.audit === true;
|
| 37 |
+
|
| 38 |
+
const hashUnit = (value: string): number => {
|
| 39 |
+
let hash = 2166136261;
|
| 40 |
+
for (let i = 0; i < value.length; i++) {
|
| 41 |
+
hash ^= value.charCodeAt(i);
|
| 42 |
+
hash = Math.imul(hash, 16777619);
|
| 43 |
+
}
|
| 44 |
+
return (hash >>> 0) / 2 ** 32;
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
const shouldSendDebug = (log: Log, debugRate: number): boolean => {
|
| 48 |
+
const route = routeOf(log);
|
| 49 |
+
if (route !== undefined && DROPPED_LOG_ROUTES.has(route)) return false;
|
| 50 |
+
if (traceIsSampled(log)) return true;
|
| 51 |
+
const traceId = traceIdOf(log);
|
| 52 |
+
const roll = traceId !== undefined ? hashUnit(traceId) : Math.random();
|
| 53 |
+
return roll < debugRate;
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
const shouldSendInfo = (log: Log, infoRate: number): boolean => {
|
| 57 |
+
if (traceIsSampled(log)) return true;
|
| 58 |
+
const traceId = traceIdOf(log);
|
| 59 |
+
const roll = traceId !== undefined ? hashUnit(traceId) : Math.random();
|
| 60 |
+
return roll < infoRate;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Build the beforeSendLog filter. Warn, error and fatal always pass. Info
|
| 65 |
+
* passes unless it is on a hot or health route, and is otherwise sampled at
|
| 66 |
+
* the given info rate — unless it carries `audit: true`, which always
|
| 67 |
+
* passes. Debug is trace-aware: it is kept in full for a sampled trace,
|
| 68 |
+
* otherwise sampled deterministically by trace id at the given debug rate.
|
| 69 |
+
*
|
| 70 |
+
* @param debugRate The sample rate for debug logs not on a sampled trace.
|
| 71 |
+
* @param infoRate The sample rate for non-audit info logs not on a sampled
|
| 72 |
+
* trace. Defaults to 1 (send all), matching the pre-sampling behavior.
|
| 73 |
+
* @returns A predicate deciding whether a log is forwarded to Sentry.
|
| 74 |
+
*/
|
| 75 |
+
export const makeShouldSendLog =
|
| 76 |
+
(debugRate: number, infoRate = 1) =>
|
| 77 |
+
(log: Log): boolean => {
|
| 78 |
+
if (isDroppedLogMessage(log.message)) return false;
|
| 79 |
+
if (isAuditLog(log)) return true;
|
| 80 |
+
if (log.level === 'debug') return shouldSendDebug(log, debugRate);
|
| 81 |
+
if (log.level !== 'info') return true;
|
| 82 |
+
const route = routeOf(log);
|
| 83 |
+
if (route !== undefined && DROPPED_LOG_ROUTES.has(route)) return false;
|
| 84 |
+
return shouldSendInfo(log, infoRate);
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
const REDUNDANT_LOG_ATTRIBUTES = ['msg', 'pino.logger.level'] as const;
|
| 88 |
+
|
| 89 |
+
const SECRET_KEY_PATTERN =
|
| 90 |
+
/(client_?secret|secret|passwd|password|authorization|cookie|api[-_]?key|access[-_]?token|refresh[-_]?token|id[-_]?token|\bjwt\b|session[-_]?id|card[-_]?number|\bcvc\b|\bcvv\b|\btoken\b)/i;
|
| 91 |
+
|
| 92 |
+
const ISSUE_REQUEST_KEY_PATTERN =
|
| 93 |
+
/(client_?secret|secret|passwd|password|authorization|cookie|api[-_]?key|access[-_]?token|refresh[-_]?token|id[-_]?token|\bjwt\b|session[-_]?id|card[-_]?number|\bcvc\b|\bcvv\b|\btoken\b|email|name|payment_?method_?id|\bcode\b|\bstate\b)/i;
|
| 94 |
+
|
| 95 |
+
const VALUE_SECRET_PATTERN =
|
| 96 |
+
/\bsk_(?:live|test)_[A-Za-z0-9]+\b|\bwhsec_[A-Za-z0-9]+\b|\bghp_[A-Za-z0-9]+\b|\bgithub_pat_[A-Za-z0-9_]+\b|\bxox[baprs]-[A-Za-z0-9-]+\b|\beyJ[A-Za-z0-9_-]{1,1024}\.[A-Za-z0-9_-]{1,8192}\.[A-Za-z0-9_-]{1,1024}|[Bb](?:earer|asic) [A-Za-z0-9._~+/=-]{16,4096}/g;
|
| 97 |
+
|
| 98 |
+
const EMAIL_PATTERN =
|
| 99 |
+
/\b[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g;
|
| 100 |
+
|
| 101 |
+
const MAX_SCRUB_LENGTH = 200_000;
|
| 102 |
+
|
| 103 |
+
const redactSecretSubstrings = (value: string): string =>
|
| 104 |
+
value.length > MAX_SCRUB_LENGTH
|
| 105 |
+
? value
|
| 106 |
+
: value.replace(VALUE_SECRET_PATTERN, '[REDACTED]');
|
| 107 |
+
|
| 108 |
+
const redactIssueSubstrings = (value: string): string =>
|
| 109 |
+
value.length > MAX_SCRUB_LENGTH
|
| 110 |
+
? value
|
| 111 |
+
: value
|
| 112 |
+
.replace(VALUE_SECRET_PATTERN, '[REDACTED]')
|
| 113 |
+
.replace(EMAIL_PATTERN, '[REDACTED]');
|
| 114 |
+
|
| 115 |
+
const redactDeep = (
|
| 116 |
+
value: unknown,
|
| 117 |
+
keyPattern: RegExp,
|
| 118 |
+
scrubValue: (v: string) => string,
|
| 119 |
+
depth = 0,
|
| 120 |
+
redactOnDepthCap = false
|
| 121 |
+
): unknown => {
|
| 122 |
+
if (value === null) return value;
|
| 123 |
+
if (depth > 6) return redactOnDepthCap ? '[REDACTED]' : value;
|
| 124 |
+
if (typeof value === 'string') return scrubValue(value);
|
| 125 |
+
if (typeof value !== 'object') return value;
|
| 126 |
+
if (Array.isArray(value))
|
| 127 |
+
return value.map(entry =>
|
| 128 |
+
redactDeep(entry, keyPattern, scrubValue, depth + 1, redactOnDepthCap)
|
| 129 |
+
);
|
| 130 |
+
const out: Record<string, unknown> = {};
|
| 131 |
+
for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {
|
| 132 |
+
out[key] = keyPattern.test(key)
|
| 133 |
+
? '[REDACTED]'
|
| 134 |
+
: redactDeep(entry, keyPattern, scrubValue, depth + 1, redactOnDepthCap);
|
| 135 |
+
}
|
| 136 |
+
return out;
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Remove pino bindings that Sentry already records as native log fields, then
|
| 141 |
+
* redact secret- or payment-credential-shaped values. Email addresses are also
|
| 142 |
+
* redacted unless the log carries `audit: true`, the marker for the sanctioned
|
| 143 |
+
* identifier buckets (donation outreach, duplicate-account) where support needs
|
| 144 |
+
* the email to resolve the case.
|
| 145 |
+
*
|
| 146 |
+
* @param log The log entry from the SDK.
|
| 147 |
+
* @returns The same log with redundant attributes removed and secrets redacted.
|
| 148 |
+
*/
|
| 149 |
+
export const scrubRedundantLogAttributes = (log: Log): Log => {
|
| 150 |
+
const scrubValue =
|
| 151 |
+
log.attributes?.audit === true
|
| 152 |
+
? redactSecretSubstrings
|
| 153 |
+
: redactIssueSubstrings;
|
| 154 |
+
if (log.message != null) {
|
| 155 |
+
log.message = scrubValue(String(log.message));
|
| 156 |
+
}
|
| 157 |
+
if (log.attributes == null) return log;
|
| 158 |
+
for (const key of REDUNDANT_LOG_ATTRIBUTES) {
|
| 159 |
+
delete log.attributes[key];
|
| 160 |
+
}
|
| 161 |
+
log.attributes = redactDeep(
|
| 162 |
+
log.attributes,
|
| 163 |
+
SECRET_KEY_PATTERN,
|
| 164 |
+
scrubValue,
|
| 165 |
+
0,
|
| 166 |
+
true
|
| 167 |
+
) as typeof log.attributes;
|
| 168 |
+
return log;
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
const stripQueryFromUrl = (url: string): string => url.split('?', 1)[0] ?? url;
|
| 172 |
+
|
| 173 |
+
const redactHeaders = (
|
| 174 |
+
headers: Record<string, string>
|
| 175 |
+
): Record<string, string> => {
|
| 176 |
+
const out: Record<string, string> = {};
|
| 177 |
+
for (const [key, value] of Object.entries(headers)) {
|
| 178 |
+
out[key] = ISSUE_REQUEST_KEY_PATTERN.test(key)
|
| 179 |
+
? '[REDACTED]'
|
| 180 |
+
: redactIssueSubstrings(value);
|
| 181 |
+
}
|
| 182 |
+
return out;
|
| 183 |
+
};
|
| 184 |
+
|
| 185 |
+
const scrubIssueBody = (data: unknown): unknown => {
|
| 186 |
+
if (typeof data === 'string') {
|
| 187 |
+
try {
|
| 188 |
+
const parsed: unknown = JSON.parse(data);
|
| 189 |
+
return JSON.stringify(
|
| 190 |
+
redactDeep(
|
| 191 |
+
parsed,
|
| 192 |
+
ISSUE_REQUEST_KEY_PATTERN,
|
| 193 |
+
redactIssueSubstrings,
|
| 194 |
+
0,
|
| 195 |
+
true
|
| 196 |
+
)
|
| 197 |
+
);
|
| 198 |
+
} catch {
|
| 199 |
+
return redactIssueSubstrings(data);
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
return redactDeep(
|
| 203 |
+
data,
|
| 204 |
+
ISSUE_REQUEST_KEY_PATTERN,
|
| 205 |
+
redactIssueSubstrings,
|
| 206 |
+
0,
|
| 207 |
+
true
|
| 208 |
+
);
|
| 209 |
+
};
|
| 210 |
+
|
| 211 |
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
| 212 |
+
export const scrubRequestPii = (event: ErrorEvent): ErrorEvent => {
|
| 213 |
+
const out: ErrorEvent = { ...event };
|
| 214 |
+
const { request } = event;
|
| 215 |
+
|
| 216 |
+
if (request != null) {
|
| 217 |
+
const scrubbed: RequestEventData = { ...request };
|
| 218 |
+
delete scrubbed.query_string;
|
| 219 |
+
delete scrubbed.cookies;
|
| 220 |
+
delete scrubbed.env;
|
| 221 |
+
if (scrubbed.url != null) {
|
| 222 |
+
scrubbed.url = redactIssueSubstrings(stripQueryFromUrl(scrubbed.url));
|
| 223 |
+
}
|
| 224 |
+
if (scrubbed.data != null) {
|
| 225 |
+
scrubbed.data = scrubIssueBody(scrubbed.data);
|
| 226 |
+
}
|
| 227 |
+
if (scrubbed.headers != null) {
|
| 228 |
+
scrubbed.headers = redactHeaders(scrubbed.headers);
|
| 229 |
+
}
|
| 230 |
+
out.request = scrubbed;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
if (out.exception?.values) {
|
| 234 |
+
out.exception = {
|
| 235 |
+
...out.exception,
|
| 236 |
+
values: out.exception.values.map(value => {
|
| 237 |
+
const next = { ...value };
|
| 238 |
+
if (typeof next.value === 'string') {
|
| 239 |
+
next.value = redactIssueSubstrings(next.value);
|
| 240 |
+
}
|
| 241 |
+
if (next.stacktrace?.frames) {
|
| 242 |
+
next.stacktrace = {
|
| 243 |
+
...next.stacktrace,
|
| 244 |
+
frames: next.stacktrace.frames.map(frame =>
|
| 245 |
+
frame.vars == null
|
| 246 |
+
? frame
|
| 247 |
+
: {
|
| 248 |
+
...frame,
|
| 249 |
+
vars: redactDeep(
|
| 250 |
+
frame.vars,
|
| 251 |
+
ISSUE_REQUEST_KEY_PATTERN,
|
| 252 |
+
redactIssueSubstrings,
|
| 253 |
+
0,
|
| 254 |
+
true
|
| 255 |
+
) as typeof frame.vars
|
| 256 |
+
}
|
| 257 |
+
)
|
| 258 |
+
};
|
| 259 |
+
}
|
| 260 |
+
return next;
|
| 261 |
+
})
|
| 262 |
+
};
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
if (out.extra !== undefined) {
|
| 266 |
+
out.extra = redactDeep(
|
| 267 |
+
out.extra,
|
| 268 |
+
ISSUE_REQUEST_KEY_PATTERN,
|
| 269 |
+
redactIssueSubstrings,
|
| 270 |
+
0,
|
| 271 |
+
true
|
| 272 |
+
) as ErrorEvent['extra'];
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
if (out.user != null) {
|
| 276 |
+
out.user = redactDeep(
|
| 277 |
+
out.user,
|
| 278 |
+
SECRET_KEY_PATTERN,
|
| 279 |
+
redactSecretSubstrings,
|
| 280 |
+
0,
|
| 281 |
+
true
|
| 282 |
+
) as ErrorEvent['user'];
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
if (out.breadcrumbs) {
|
| 286 |
+
out.breadcrumbs = out.breadcrumbs.map(breadcrumb =>
|
| 287 |
+
breadcrumb.data == null
|
| 288 |
+
? breadcrumb
|
| 289 |
+
: {
|
| 290 |
+
...breadcrumb,
|
| 291 |
+
data: redactDeep(
|
| 292 |
+
breadcrumb.data,
|
| 293 |
+
ISSUE_REQUEST_KEY_PATTERN,
|
| 294 |
+
redactIssueSubstrings,
|
| 295 |
+
0,
|
| 296 |
+
true
|
| 297 |
+
) as typeof breadcrumb.data
|
| 298 |
+
}
|
| 299 |
+
);
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
return out;
|
| 303 |
+
};
|
| 304 |
+
|
| 305 |
+
const MONGO_OBJECT_ID_PATTERN = /ObjectId\("[0-9a-f]{24}"\)/g;
|
| 306 |
+
const MONGO_ISO_DATE_PATTERN = /ISODate\("[^"]+"\)/g;
|
| 307 |
+
|
| 308 |
+
const scrubMongoLiterals = (text: string): string =>
|
| 309 |
+
text
|
| 310 |
+
.replace(MONGO_OBJECT_ID_PATTERN, 'ObjectId("?")')
|
| 311 |
+
.replace(MONGO_ISO_DATE_PATTERN, 'ISODate("?")');
|
| 312 |
+
|
| 313 |
+
// workaround: getsentry/sentry#40650 — prismaIntegration sets the DB span description to raw query text, so a literal ObjectId splits the N+1 fingerprint into one issue group per user
|
| 314 |
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
| 315 |
+
export const scrubSpanDescriptions = <E extends Event>(event: E): E => {
|
| 316 |
+
for (const span of event.spans ?? []) {
|
| 317 |
+
if (typeof span.description === 'string') {
|
| 318 |
+
span.description = scrubMongoLiterals(span.description);
|
| 319 |
+
}
|
| 320 |
+
const dbQueryText = span.data['db.query.text'];
|
| 321 |
+
if (typeof dbQueryText === 'string') {
|
| 322 |
+
span.data['db.query.text'] = scrubMongoLiterals(dbQueryText);
|
| 323 |
+
}
|
| 324 |
+
}
|
| 325 |
+
return event;
|
| 326 |
+
};
|
| 327 |
+
|
| 328 |
+
/**
|
| 329 |
+
* Build a traces sampler that drops health check transactions.
|
| 330 |
+
*
|
| 331 |
+
* @param rate The sample rate for all other transactions.
|
| 332 |
+
* @returns The sampler for Sentry.init.
|
| 333 |
+
*/
|
| 334 |
+
export const makeTracesSampler =
|
| 335 |
+
(rate: number) =>
|
| 336 |
+
(context: {
|
| 337 |
+
name: string;
|
| 338 |
+
inheritOrSampleWith: (fallbackSampleRate: number) => number;
|
| 339 |
+
}): number =>
|
| 340 |
+
context.name.includes('/status/ping') ||
|
| 341 |
+
context.name.includes('/status/ready')
|
| 342 |
+
? 0
|
| 343 |
+
: context.inheritOrSampleWith(rate);
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/tokens.test.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, test, expect, vi } from 'vitest';
|
| 2 |
+
|
| 3 |
+
vi.useFakeTimers();
|
| 4 |
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
| 5 |
+
import { createAccessToken, createAuthToken, isExpired } from './tokens.js';
|
| 6 |
+
|
| 7 |
+
describe('createAccessToken', () => {
|
| 8 |
+
test('creates an object with id, ttl, created and userId', () => {
|
| 9 |
+
const userId = 'abc';
|
| 10 |
+
|
| 11 |
+
const actual = createAccessToken(userId);
|
| 12 |
+
|
| 13 |
+
expect(actual).toStrictEqual({
|
| 14 |
+
id: expect.stringMatching(/[a-zA-Z0-9]{64}/),
|
| 15 |
+
ttl: 77760000000,
|
| 16 |
+
created: expect.stringMatching(
|
| 17 |
+
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/
|
| 18 |
+
),
|
| 19 |
+
userId
|
| 20 |
+
});
|
| 21 |
+
});
|
| 22 |
+
|
| 23 |
+
test('sets the ttl, defaulting to 77760000000 ms', () => {
|
| 24 |
+
const userId = 'abc';
|
| 25 |
+
const ttl = 123;
|
| 26 |
+
const actual = createAccessToken(userId, ttl);
|
| 27 |
+
|
| 28 |
+
expect(actual.ttl).toBe(ttl);
|
| 29 |
+
expect(createAccessToken(userId).ttl).toBe(77760000000);
|
| 30 |
+
});
|
| 31 |
+
});
|
| 32 |
+
|
| 33 |
+
describe('createAuthToken', () => {
|
| 34 |
+
test('creates an object with id, ttl, created and userId', () => {
|
| 35 |
+
const userId = 'abc';
|
| 36 |
+
|
| 37 |
+
const actual = createAuthToken(userId);
|
| 38 |
+
|
| 39 |
+
expect(actual).toStrictEqual({
|
| 40 |
+
id: expect.stringMatching(/[a-zA-Z0-9]{64}/),
|
| 41 |
+
ttl: 900000,
|
| 42 |
+
created: expect.stringMatching(
|
| 43 |
+
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/
|
| 44 |
+
),
|
| 45 |
+
userId
|
| 46 |
+
});
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
test('sets the ttl, defaulting to 900000 ms', () => {
|
| 50 |
+
const userId = 'abc';
|
| 51 |
+
const ttl = 123;
|
| 52 |
+
const actual = createAuthToken(userId, ttl);
|
| 53 |
+
|
| 54 |
+
expect(actual.ttl).toBe(ttl);
|
| 55 |
+
expect(createAuthToken(userId).ttl).toBe(900000);
|
| 56 |
+
});
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
describe('isExpired', () => {
|
| 60 |
+
test('returns true if the token expiry date is in the past', () => {
|
| 61 |
+
const token = createAccessToken('abc', 1000);
|
| 62 |
+
expect(isExpired(token)).toBe(false);
|
| 63 |
+
vi.advanceTimersByTime(500);
|
| 64 |
+
expect(isExpired(token)).toBe(false);
|
| 65 |
+
vi.advanceTimersByTime(500);
|
| 66 |
+
expect(isExpired(token)).toBe(false);
|
| 67 |
+
vi.advanceTimersByTime(1);
|
| 68 |
+
expect(isExpired(token)).toBe(true);
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
test('handles tokens with Date values for created', () => {
|
| 72 |
+
const token = { ...createAccessToken('abc', 2000), created: new Date() };
|
| 73 |
+
expect(isExpired(token)).toBe(false);
|
| 74 |
+
vi.advanceTimersByTime(2000);
|
| 75 |
+
expect(isExpired(token)).toBe(false);
|
| 76 |
+
vi.advanceTimersByTime(1);
|
| 77 |
+
expect(isExpired(token)).toBe(true);
|
| 78 |
+
});
|
| 79 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/tokens.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import jwt from 'jsonwebtoken';
|
| 2 |
+
import { customNanoid } from './ids.js';
|
| 3 |
+
|
| 4 |
+
import { JWT_SECRET } from './env.js';
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Encode an id into a JWT (the naming suggests it's a user token, but it's the
|
| 8 |
+
* id of the UserToken document).
|
| 9 |
+
* @param userToken A token id to encode.
|
| 10 |
+
* @returns An encoded object with the userToken property.
|
| 11 |
+
*/
|
| 12 |
+
export function encodeUserToken(userToken: string): string {
|
| 13 |
+
return jwt.sign({ userToken }, JWT_SECRET);
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export type Token = {
|
| 17 |
+
userId: string;
|
| 18 |
+
id: string;
|
| 19 |
+
ttl: number;
|
| 20 |
+
created: string;
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
type DbToken = {
|
| 24 |
+
userId: string;
|
| 25 |
+
id: string;
|
| 26 |
+
ttl: number;
|
| 27 |
+
created: Date;
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Creates an access token.
|
| 32 |
+
* @param userId The user ID as a string (yes, it's an ObjectID, but it will be serialized to a string anyway).
|
| 33 |
+
* @param ttl The time to live for the token in milliseconds (default: 77760000000).
|
| 34 |
+
* @returns The access token.
|
| 35 |
+
*/
|
| 36 |
+
export const createAccessToken = (userId: string, ttl?: number): Token => {
|
| 37 |
+
return {
|
| 38 |
+
userId,
|
| 39 |
+
id: customNanoid(),
|
| 40 |
+
ttl: ttl ?? 77760000000,
|
| 41 |
+
created: new Date().toISOString()
|
| 42 |
+
};
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Creates an auth token.
|
| 47 |
+
* @param userId The user ID as a string (yes, it's an ObjectID, but it will be serialized to a string anyway).
|
| 48 |
+
* @param ttl The time to live for the token in milliseconds (default: 900000 aka 15 minutes).
|
| 49 |
+
* @returns The access token.
|
| 50 |
+
*/
|
| 51 |
+
export const createAuthToken = (userId: string, ttl?: number): Token => {
|
| 52 |
+
return {
|
| 53 |
+
userId,
|
| 54 |
+
id: customNanoid(),
|
| 55 |
+
ttl: ttl ?? 900000,
|
| 56 |
+
created: new Date().toISOString()
|
| 57 |
+
};
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Check if an access token has expired.
|
| 62 |
+
* @param token The access token to check.
|
| 63 |
+
* @returns True if the token has expired, false otherwise.
|
| 64 |
+
*/
|
| 65 |
+
export const isExpired = (token: Token | DbToken): boolean => {
|
| 66 |
+
const created = new Date(token.created);
|
| 67 |
+
return Date.now() > created.getTime() + token.ttl;
|
| 68 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validate-donation.test.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
|
| 2 |
+
import { inLastFiveMinutes } from './validate-donation.js';
|
| 3 |
+
|
| 4 |
+
describe('inLastFiveMinutes', () => {
|
| 5 |
+
beforeAll(() => {
|
| 6 |
+
vi.useFakeTimers();
|
| 7 |
+
});
|
| 8 |
+
|
| 9 |
+
afterAll(() => {
|
| 10 |
+
vi.useRealTimers();
|
| 11 |
+
});
|
| 12 |
+
|
| 13 |
+
it('should return true if the timestamp is within the last five minutes', () => {
|
| 14 |
+
const currentTimestamp = Math.floor(Date.now() / 1000);
|
| 15 |
+
const recentTimestamp = currentTimestamp - 100;
|
| 16 |
+
expect(inLastFiveMinutes(recentTimestamp)).toBe(true);
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
it('should return false if the timestamp is more than five minutes ago', () => {
|
| 20 |
+
const currentTimestamp = Math.floor(Date.now() / 1000);
|
| 21 |
+
const oldTimestamp = currentTimestamp - 400;
|
| 22 |
+
expect(inLastFiveMinutes(oldTimestamp)).toBe(false);
|
| 23 |
+
});
|
| 24 |
+
|
| 25 |
+
it('should return true if the timestamp is exactly five minutes ago', () => {
|
| 26 |
+
const currentTimestamp = Math.floor(Date.now() / 1000);
|
| 27 |
+
const exactTimestamp = currentTimestamp - 300;
|
| 28 |
+
expect(inLastFiveMinutes(exactTimestamp)).toBe(true);
|
| 29 |
+
});
|
| 30 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validate-donation.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Checks if a timestamp was created within five minutes.
|
| 3 |
+
* @param unixTimestamp - A unix timestamp .
|
| 4 |
+
* @returns - The generated email template.
|
| 5 |
+
*/
|
| 6 |
+
export const inLastFiveMinutes = (unixTimestamp: number) => {
|
| 7 |
+
const currentTimestamp = Math.floor(Date.now() / 1000);
|
| 8 |
+
const timeDifference = currentTimestamp - unixTimestamp;
|
| 9 |
+
return timeDifference <= 300; // 300 seconds is 5 minutes
|
| 10 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validation.test.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, it, expect } from 'vitest';
|
| 2 |
+
import { isObjectID } from './validation.js';
|
| 3 |
+
|
| 4 |
+
describe('Validation', () => {
|
| 5 |
+
describe('isObjectID', () => {
|
| 6 |
+
it('returns true for valid ObjectIDs', () => {
|
| 7 |
+
expect(isObjectID('5f1e0f3b5d2c12b0b8f7a6b9')).toBe(true);
|
| 8 |
+
});
|
| 9 |
+
|
| 10 |
+
it('returns false for invalid ObjectIDs', () => {
|
| 11 |
+
expect(isObjectID('5f1e0f3b5d2c12b0b8f7a6b')).toBe(false);
|
| 12 |
+
expect(isObjectID('5f1e0f3b5d2c12b0b8f7a6b99')).toBe(false);
|
| 13 |
+
expect(isObjectID('5f1e0f3b5d2c12b0b8f7a6b-')).toBe(false);
|
| 14 |
+
expect(isObjectID(undefined)).toBe(false);
|
| 15 |
+
});
|
| 16 |
+
});
|
| 17 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/api/src/utils/validation.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ObjectId } from 'bson';
|
| 2 |
+
import assert from 'node:assert';
|
| 3 |
+
|
| 4 |
+
// This is trivial, but makes it simple to refactor if we swap monogodb for
|
| 5 |
+
// bson, say.
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Checks if a string is a valid MongoDB ObjectID.
|
| 9 |
+
* @param id A string to check.
|
| 10 |
+
* @returns A boolean indicating if the string is a valid MongoDB ObjectID.
|
| 11 |
+
*/
|
| 12 |
+
export const isObjectID = (id?: string): boolean =>
|
| 13 |
+
id ? ObjectId.isValid(id) : false;
|
| 14 |
+
|
| 15 |
+
// Refer : http://stackoverflow.com/a/430240/1932901
|
| 16 |
+
/**
|
| 17 |
+
* Sanitizes a input by removing HTML tags.
|
| 18 |
+
* @deprecated
|
| 19 |
+
* @param value A string to sanitize.
|
| 20 |
+
* @returns A string with HTML tags removed.
|
| 21 |
+
*/
|
| 22 |
+
export const trimTags = (value: string): string => {
|
| 23 |
+
const tagBody = '(?:[^"\'>]|"[^"]*"|\'[^\']*\')*';
|
| 24 |
+
const tagOrComment = new RegExp(
|
| 25 |
+
'<(?:' +
|
| 26 |
+
// Comment body.
|
| 27 |
+
'!--(?:(?:-*[^->])*--+|-?)' +
|
| 28 |
+
// Special "raw text" elements whose content should be elided.
|
| 29 |
+
'|script\\b' +
|
| 30 |
+
tagBody +
|
| 31 |
+
'>[\\s\\S]*?</script\\s*' +
|
| 32 |
+
'|style\\b' +
|
| 33 |
+
tagBody +
|
| 34 |
+
'>[\\s\\S]*?</style\\s*' +
|
| 35 |
+
// Regular name
|
| 36 |
+
'|/?[a-z]' +
|
| 37 |
+
tagBody +
|
| 38 |
+
')>',
|
| 39 |
+
'gi'
|
| 40 |
+
);
|
| 41 |
+
let rawValue;
|
| 42 |
+
do {
|
| 43 |
+
rawValue = value;
|
| 44 |
+
value = value.replace(tagOrComment, '');
|
| 45 |
+
} while (value !== rawValue);
|
| 46 |
+
|
| 47 |
+
return value.replace(/</g, '<');
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Parses and asserts input string to integer.
|
| 52 |
+
*/
|
| 53 |
+
export function parseInt(str: string): number {
|
| 54 |
+
const n = Number(str);
|
| 55 |
+
assert.ok(Number.isInteger(n), `expected '${str}' to be an integer`);
|
| 56 |
+
return n;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Parses input string into boolean. `true` if `"true"`, otherwise `false`.
|
| 61 |
+
*/
|
| 62 |
+
export function parseBool(str: string): boolean {
|
| 63 |
+
return str === 'true';
|
| 64 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/api/tools/exam-environment/seed/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PrismaClient } from '@prisma/client';
|
| 2 |
+
import * as mocks from '../../../__fixtures__/exam-environment-exam.js';
|
| 3 |
+
import { MONGOHQ_URL } from '../../../src/utils/env.js';
|
| 4 |
+
|
| 5 |
+
const prisma = new PrismaClient({
|
| 6 |
+
datasources: {
|
| 7 |
+
db: {
|
| 8 |
+
url: MONGOHQ_URL
|
| 9 |
+
}
|
| 10 |
+
}
|
| 11 |
+
});
|
| 12 |
+
|
| 13 |
+
async function main() {
|
| 14 |
+
await prisma.$connect();
|
| 15 |
+
|
| 16 |
+
await prisma.examEnvironmentExamAttempt.deleteMany({});
|
| 17 |
+
await prisma.examEnvironmentGeneratedExam.deleteMany({});
|
| 18 |
+
await prisma.examEnvironmentExam.deleteMany({});
|
| 19 |
+
await prisma.examEnvironmentChallenge.deleteMany({});
|
| 20 |
+
|
| 21 |
+
await prisma.examEnvironmentExam.create({ data: mocks.exam });
|
| 22 |
+
await prisma.examEnvironmentGeneratedExam.create({
|
| 23 |
+
data: mocks.generatedExam
|
| 24 |
+
});
|
| 25 |
+
await prisma.examEnvironmentExamAttempt.create({ data: mocks.examAttempt });
|
| 26 |
+
|
| 27 |
+
await prisma.examEnvironmentChallenge.create({
|
| 28 |
+
data: mocks.examEnvironmentChallenge
|
| 29 |
+
});
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
void main();
|
github_code/freeCodeCamp__freeCodeCamp/api/tools/exam-environment/test/index.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Check the records on the database matches the Prisma schema
|
| 2 |
+
//!
|
| 3 |
+
//! This script should be run, before any deployments with Exam schema changes.
|
| 4 |
+
//! WARNING: This script queries every single record in the `Env<>` collections.
|
| 5 |
+
import { PrismaClient } from '@prisma/client';
|
| 6 |
+
import { PrismaClientKnownRequestError } from '@prisma/client/runtime/library.js';
|
| 7 |
+
import { MONGOHQ_URL } from '../../../src/utils/env.js';
|
| 8 |
+
|
| 9 |
+
const prisma = new PrismaClient({
|
| 10 |
+
datasources: {
|
| 11 |
+
db: {
|
| 12 |
+
url: MONGOHQ_URL
|
| 13 |
+
}
|
| 14 |
+
}
|
| 15 |
+
});
|
| 16 |
+
|
| 17 |
+
async function main() {
|
| 18 |
+
await prisma.$connect();
|
| 19 |
+
try {
|
| 20 |
+
const examEnvironmentExam = await prisma.examEnvironmentExam.findMany();
|
| 21 |
+
const examEnvironmentGeneratedExam =
|
| 22 |
+
await prisma.examEnvironmentGeneratedExam.findMany();
|
| 23 |
+
const examEnvironmentExamAttempt =
|
| 24 |
+
await prisma.examEnvironmentExamAttempt.findMany();
|
| 25 |
+
|
| 26 |
+
console.log('Number of exams:', examEnvironmentExam.length);
|
| 27 |
+
console.log(
|
| 28 |
+
'Number of generated exams:',
|
| 29 |
+
examEnvironmentGeneratedExam.length
|
| 30 |
+
);
|
| 31 |
+
console.log('Number of exam attempts:', examEnvironmentExamAttempt.length);
|
| 32 |
+
// NOTE: This is not strictly true. E.g. If a `Boolean` becomes an `Int`, Prisma converts it instead of throwing.
|
| 33 |
+
console.log('\nSUCCESS! The database schema matches the Prisma schema.');
|
| 34 |
+
} catch (error) {
|
| 35 |
+
if (error instanceof PrismaClientKnownRequestError) {
|
| 36 |
+
console.log(error.message);
|
| 37 |
+
console.info('\nCHECK DATABASE SCHEMA!');
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
void main();
|
github_code/freeCodeCamp__freeCodeCamp/api/tsconfig.build.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extends": "./tsconfig",
|
| 3 |
+
"compilerOptions": {
|
| 4 |
+
"outDir": "dist",
|
| 5 |
+
"rootDir": "../",
|
| 6 |
+
"noEmit": false,
|
| 7 |
+
"sourceMap": true
|
| 8 |
+
},
|
| 9 |
+
"include": ["src"],
|
| 10 |
+
"exclude": ["**/*.test.*"]
|
| 11 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/api/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"include": ["**/*.ts"],
|
| 3 |
+
"compilerOptions": {
|
| 4 |
+
"target": "es2022",
|
| 5 |
+
"module": "nodenext",
|
| 6 |
+
"allowJs": true,
|
| 7 |
+
"strict": true,
|
| 8 |
+
"forceConsistentCasingInFileNames": true,
|
| 9 |
+
"esModuleInterop": true,
|
| 10 |
+
"resolveJsonModule": true,
|
| 11 |
+
"noEmit": true,
|
| 12 |
+
"noUncheckedIndexedAccess": true
|
| 13 |
+
}
|
| 14 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/api/turbo.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://v2-10-0.turborepo.dev/schema.json",
|
| 3 |
+
"extends": ["//"],
|
| 4 |
+
"tasks": {
|
| 5 |
+
"build": {
|
| 6 |
+
"env": [
|
| 7 |
+
"API_LOCATION",
|
| 8 |
+
"AUTH0_CLIENT_ID",
|
| 9 |
+
"AUTH0_CLIENT_SECRET",
|
| 10 |
+
"AUTH0_DOMAIN",
|
| 11 |
+
"COOKIE_DOMAIN",
|
| 12 |
+
"COOKIE_SECRET",
|
| 13 |
+
"DEPLOYMENT_ENV",
|
| 14 |
+
"DEPLOYMENT_VERSION",
|
| 15 |
+
"EMAIL_PROVIDER",
|
| 16 |
+
"FCC_API_LOG_LEVEL",
|
| 17 |
+
"FCC_API_LOG_TRANSPORT",
|
| 18 |
+
"FCC_ENABLE_CLASSROOM",
|
| 19 |
+
"FCC_ENABLE_DEV_LOGIN_MODE",
|
| 20 |
+
"FCC_ENABLE_SENTRY_ROUTES",
|
| 21 |
+
"FCC_ENABLE_SWAGGER_UI",
|
| 22 |
+
"FCC_ENABLE_TEST_LOGGING",
|
| 23 |
+
"FCC_DRAIN_TIMEOUT_MS",
|
| 24 |
+
"FREECODECAMP_NODE_ENV",
|
| 25 |
+
"GROWTHBOOK_FASTIFY_API_HOST",
|
| 26 |
+
"GROWTHBOOK_FASTIFY_CLIENT_KEY",
|
| 27 |
+
"HOME_LOCATION",
|
| 28 |
+
"HOST",
|
| 29 |
+
"JWT_SECRET",
|
| 30 |
+
"MAILPIT_HOST",
|
| 31 |
+
"NODE_ENV",
|
| 32 |
+
"PORT",
|
| 33 |
+
"SENTRY_DSN",
|
| 34 |
+
"SENTRY_ENVIRONMENT",
|
| 35 |
+
"SENTRY_LOGS_DEBUG_SAMPLE_RATE",
|
| 36 |
+
"SENTRY_LOGS_INFO_SAMPLE_RATE",
|
| 37 |
+
"SENTRY_PROFILE_SESSION_SAMPLE_RATE",
|
| 38 |
+
"SENTRY_SERVER_NAME",
|
| 39 |
+
"SENTRY_TRACES_SAMPLE_RATE",
|
| 40 |
+
"SES_ID",
|
| 41 |
+
"SES_REGION",
|
| 42 |
+
"SES_SECRET",
|
| 43 |
+
"SES_SMTP_HOST",
|
| 44 |
+
"SES_SMTP_PASSWORD",
|
| 45 |
+
"SES_SMTP_USERNAME",
|
| 46 |
+
"SHOW_UPCOMING_CHANGES",
|
| 47 |
+
"SOCRATES_API_KEY",
|
| 48 |
+
"SOCRATES_ENDPOINT",
|
| 49 |
+
"STRIPE_SECRET_KEY",
|
| 50 |
+
"TPA_API_BEARER_TOKEN"
|
| 51 |
+
]
|
| 52 |
+
},
|
| 53 |
+
"test": {
|
| 54 |
+
"passThroughEnv": ["VITEST_WORKER_ID"],
|
| 55 |
+
"env": [
|
| 56 |
+
"API_LOCATION",
|
| 57 |
+
"AUTH0_CLIENT_ID",
|
| 58 |
+
"AUTH0_CLIENT_SECRET",
|
| 59 |
+
"AUTH0_DOMAIN",
|
| 60 |
+
"COOKIE_DOMAIN",
|
| 61 |
+
"COOKIE_SECRET",
|
| 62 |
+
"DEPLOYMENT_ENV",
|
| 63 |
+
"DEPLOYMENT_VERSION",
|
| 64 |
+
"EMAIL_PROVIDER",
|
| 65 |
+
"FCC_API_LOG_LEVEL",
|
| 66 |
+
"FCC_API_LOG_TRANSPORT",
|
| 67 |
+
"FCC_ENABLE_CLASSROOM",
|
| 68 |
+
"FCC_ENABLE_DEV_LOGIN_MODE",
|
| 69 |
+
"FCC_ENABLE_SENTRY_ROUTES",
|
| 70 |
+
"FCC_ENABLE_SWAGGER_UI",
|
| 71 |
+
"FCC_ENABLE_TEST_LOGGING",
|
| 72 |
+
"FREECODECAMP_NODE_ENV",
|
| 73 |
+
"GROWTHBOOK_FASTIFY_API_HOST",
|
| 74 |
+
"GROWTHBOOK_FASTIFY_CLIENT_KEY",
|
| 75 |
+
"HOME_LOCATION",
|
| 76 |
+
"HOST",
|
| 77 |
+
"JWT_SECRET",
|
| 78 |
+
"MAILPIT_HOST",
|
| 79 |
+
"NODE_ENV",
|
| 80 |
+
"PORT",
|
| 81 |
+
"SENTRY_DSN",
|
| 82 |
+
"SENTRY_ENVIRONMENT",
|
| 83 |
+
"SENTRY_LOGS_DEBUG_SAMPLE_RATE",
|
| 84 |
+
"SENTRY_LOGS_INFO_SAMPLE_RATE",
|
| 85 |
+
"SENTRY_PROFILE_SESSION_SAMPLE_RATE",
|
| 86 |
+
"SENTRY_SERVER_NAME",
|
| 87 |
+
"SENTRY_TRACES_SAMPLE_RATE",
|
| 88 |
+
"SES_ID",
|
| 89 |
+
"SES_REGION",
|
| 90 |
+
"SES_SECRET",
|
| 91 |
+
"SES_SMTP_HOST",
|
| 92 |
+
"SES_SMTP_PASSWORD",
|
| 93 |
+
"SES_SMTP_USERNAME",
|
| 94 |
+
"SHOW_UPCOMING_CHANGES",
|
| 95 |
+
"SOCRATES_API_KEY",
|
| 96 |
+
"SOCRATES_ENDPOINT",
|
| 97 |
+
"STRIPE_SECRET_KEY",
|
| 98 |
+
"TPA_API_BEARER_TOKEN"
|
| 99 |
+
]
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/api/vitest.utils.test.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, test, expect } from 'vitest';
|
| 2 |
+
import { getCsrfToken, getCookies, serializeDates } from './vitest.utils.js';
|
| 3 |
+
|
| 4 |
+
const fakeCookies = [
|
| 5 |
+
'_csrf=123; Path=/; HttpOnly; SameSite=Strict',
|
| 6 |
+
'csrf_token=abc-123; Path=/',
|
| 7 |
+
'sessionId=CV-abc.123; Path=/; Expires=Wed, 03 May 2023 16:29:53 GMT; HttpOnly'
|
| 8 |
+
];
|
| 9 |
+
|
| 10 |
+
describe('getCsrfToken', () => {
|
| 11 |
+
test('returns csrf token if there is one', () => {
|
| 12 |
+
expect(getCsrfToken(fakeCookies)).toEqual('abc-123');
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
+
test('returns undefined if there is no csrf token', () => {
|
| 16 |
+
expect(
|
| 17 |
+
getCsrfToken(['_csrf=123; Path=/; HttpOnly; SameSite=Strict'])
|
| 18 |
+
).toBeUndefined();
|
| 19 |
+
});
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
describe('setCookiesToCookies', () => {
|
| 23 |
+
test('returns a string of cookies', () => {
|
| 24 |
+
expect(getCookies(fakeCookies)).toEqual(
|
| 25 |
+
'_csrf=123; csrf_token=abc-123; sessionId=CV-abc.123'
|
| 26 |
+
);
|
| 27 |
+
});
|
| 28 |
+
test('handles bare cookies', () => {
|
| 29 |
+
expect(getCookies(['_csrf=123'])).toEqual('_csrf=123');
|
| 30 |
+
});
|
| 31 |
+
|
| 32 |
+
test('throws an error if the cookies are malformed', () => {
|
| 33 |
+
expect(() => getCookies(['_csrf'])).toThrow();
|
| 34 |
+
});
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
describe('serializeDates', () => {
|
| 38 |
+
function isAsymmetricMatcher(x: unknown): x is typeof expect.any {
|
| 39 |
+
return (
|
| 40 |
+
typeof x === 'object' &&
|
| 41 |
+
x !== null &&
|
| 42 |
+
typeof (x as { asymmetricMatch?: unknown }).asymmetricMatch === 'function'
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
test('returns primitives unchanged', () => {
|
| 47 |
+
expect(serializeDates(42)).toBe(42);
|
| 48 |
+
expect(serializeDates('hello')).toBe('hello');
|
| 49 |
+
expect(serializeDates(true)).toBe(true);
|
| 50 |
+
});
|
| 51 |
+
|
| 52 |
+
test('converts Date to ISO string', () => {
|
| 53 |
+
const d = new Date('2020-01-01T00:00:00.000Z');
|
| 54 |
+
expect(serializeDates(d)).toBe(d.toISOString());
|
| 55 |
+
});
|
| 56 |
+
|
| 57 |
+
test('recursively converts nested objects with Date', () => {
|
| 58 |
+
const input = {
|
| 59 |
+
a: new Date('2021-05-05T05:05:05.000Z'),
|
| 60 |
+
b: { c: new Date('2022-06-06T06:06:06.000Z') }
|
| 61 |
+
};
|
| 62 |
+
const output = serializeDates(input);
|
| 63 |
+
expect(output).toEqual({
|
| 64 |
+
a: input.a.toISOString(),
|
| 65 |
+
b: { c: input.b.c.toISOString() }
|
| 66 |
+
});
|
| 67 |
+
});
|
| 68 |
+
|
| 69 |
+
test('recursively converts arrays with Date and nested structures', () => {
|
| 70 |
+
const d1 = new Date('2020-02-02T02:02:02.000Z');
|
| 71 |
+
const d2 = new Date('2023-03-03T03:03:03.000Z');
|
| 72 |
+
const d3 = new Date('2024-04-04T04:04:04.000Z');
|
| 73 |
+
const arr: [Date, { x: Date; y: Date[] }] = [d1, { x: d2, y: [d3] }];
|
| 74 |
+
const out = serializeDates(arr);
|
| 75 |
+
expect(out).toEqual([
|
| 76 |
+
d1.toISOString(),
|
| 77 |
+
{ x: d2.toISOString(), y: [d3.toISOString()] }
|
| 78 |
+
]);
|
| 79 |
+
});
|
| 80 |
+
|
| 81 |
+
test('handles null and undefined', () => {
|
| 82 |
+
expect(serializeDates(null)).toBeNull();
|
| 83 |
+
expect(serializeDates(undefined)).toBeUndefined();
|
| 84 |
+
});
|
| 85 |
+
|
| 86 |
+
test('preserves asymmetric matchers', () => {
|
| 87 |
+
type MatchersShape = { id: unknown; meta: { when: unknown } };
|
| 88 |
+
const withMatchers: MatchersShape = {
|
| 89 |
+
id: expect.any(String) as unknown,
|
| 90 |
+
meta: { when: expect.stringMatching(/Z$/) as unknown }
|
| 91 |
+
};
|
| 92 |
+
const serialized = serializeDates(withMatchers);
|
| 93 |
+
expect(isAsymmetricMatcher(serialized.id)).toBe(true);
|
| 94 |
+
expect(isAsymmetricMatcher(serialized.meta.when)).toBe(true);
|
| 95 |
+
|
| 96 |
+
// Serializing `Date`s yield strings that match the same patterns
|
| 97 |
+
const body = {
|
| 98 |
+
id: 'abc',
|
| 99 |
+
meta: { when: new Date('2025-01-01T00:00:00.000Z') }
|
| 100 |
+
};
|
| 101 |
+
const wrapped = serializeDates(body);
|
| 102 |
+
expect(typeof wrapped.id).toBe('string');
|
| 103 |
+
expect(wrapped.meta.when).toMatch(/Z$/);
|
| 104 |
+
});
|
| 105 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/api/vitest.utils.ts
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable jsdoc/require-jsdoc */
|
| 2 |
+
import { beforeAll, afterAll, expect, vi } from 'vitest';
|
| 3 |
+
import request from 'supertest';
|
| 4 |
+
|
| 5 |
+
import { build, buildOptions } from './src/app.js';
|
| 6 |
+
import { createUserInput } from './src/utils/create-user.js';
|
| 7 |
+
import { examJson } from './__fixtures__/exam.js';
|
| 8 |
+
import { CSRF_COOKIE, CSRF_HEADER } from './src/plugins/csrf.js';
|
| 9 |
+
|
| 10 |
+
type FastifyTestInstance = Awaited<ReturnType<typeof build>>;
|
| 11 |
+
|
| 12 |
+
declare global {
|
| 13 |
+
var fastifyTestInstance: FastifyTestInstance;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
type Options = {
|
| 17 |
+
sendCSRFToken?: boolean;
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
const requests = {
|
| 21 |
+
GET: (resource: string) => request(fastifyTestInstance?.server).get(resource),
|
| 22 |
+
POST: (resource: string) =>
|
| 23 |
+
request(fastifyTestInstance?.server).post(resource),
|
| 24 |
+
PUT: (resource: string) => request(fastifyTestInstance?.server).put(resource),
|
| 25 |
+
DELETE: (resource: string) =>
|
| 26 |
+
request(fastifyTestInstance?.server).delete(resource)
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
export const getCsrfToken = (setCookies: string[]): string | undefined => {
|
| 30 |
+
const csrfSetCookie = setCookies.find(str => str.includes(CSRF_COOKIE));
|
| 31 |
+
const [csrfCookie] = csrfSetCookie?.split(';') ?? [];
|
| 32 |
+
const [_key, csrfToken] = csrfCookie?.split('=') ?? [];
|
| 33 |
+
|
| 34 |
+
return csrfToken;
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
const ORIGIN = 'https://www.freecodecamp.org';
|
| 38 |
+
|
| 39 |
+
export const getCookies = (setCookies: string[]): string => {
|
| 40 |
+
for (const cookie of setCookies) {
|
| 41 |
+
expect(cookie).toMatch(/.*=.*/);
|
| 42 |
+
}
|
| 43 |
+
return setCookies.map(cookie => cookie.split(';')[0]).join('; ');
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* A wrapper around supertest that handles common setup for requests. Namely
|
| 48 |
+
* setting the Origin header, cookies and CSRF token.
|
| 49 |
+
*
|
| 50 |
+
* @param resource - The URL of the resource to be requested.
|
| 51 |
+
* @param config - The configuration for the request.
|
| 52 |
+
* @param config.method - The HTTP method to be used.
|
| 53 |
+
* @param config.setCookies - The cookies to be set in the request.
|
| 54 |
+
* @param options - Additional options for the request.
|
| 55 |
+
* @param options.sendCSRFToken - Whether to send the CSRF token in the request (default: true).
|
| 56 |
+
* @returns The request object.
|
| 57 |
+
*/
|
| 58 |
+
export function superRequest(
|
| 59 |
+
resource: string,
|
| 60 |
+
config: {
|
| 61 |
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
| 62 |
+
setCookies?: string[];
|
| 63 |
+
},
|
| 64 |
+
options?: Options
|
| 65 |
+
): request.Test {
|
| 66 |
+
const { method, setCookies } = config;
|
| 67 |
+
const { sendCSRFToken = true } = options ?? {};
|
| 68 |
+
|
| 69 |
+
const req = requests[method](resource).set('Origin', ORIGIN);
|
| 70 |
+
|
| 71 |
+
if (setCookies) {
|
| 72 |
+
void req.set('Cookie', getCookies(setCookies));
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
const csrfToken = (setCookies && getCsrfToken(setCookies)) ?? '';
|
| 76 |
+
if (sendCSRFToken) {
|
| 77 |
+
void req.set(CSRF_HEADER, csrfToken);
|
| 78 |
+
}
|
| 79 |
+
return req;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Factory function for 'superRequest' allows for the creation of a concise
|
| 84 |
+
* request function with the desired method and setCookies baked in.
|
| 85 |
+
*
|
| 86 |
+
* @param config
|
| 87 |
+
* @param config.method - HTTP method.
|
| 88 |
+
* @param config.setCookies - Cookies to be set in the request.
|
| 89 |
+
* @returns A superRequest function with the desired method and setCookies.
|
| 90 |
+
*/
|
| 91 |
+
export function createSuperRequest(config: {
|
| 92 |
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
| 93 |
+
setCookies?: string[];
|
| 94 |
+
}): (resource: string, options?: Options) => request.Test {
|
| 95 |
+
return (resource, options) => superRequest(resource, config, options);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
type IndexData = {
|
| 99 |
+
collection: string;
|
| 100 |
+
indexes: {
|
| 101 |
+
key: Record<string, 1>;
|
| 102 |
+
name: string;
|
| 103 |
+
expireAfterSeconds?: number;
|
| 104 |
+
unique?: boolean;
|
| 105 |
+
}[];
|
| 106 |
+
};
|
| 107 |
+
const indexData: IndexData[] = [
|
| 108 |
+
{
|
| 109 |
+
collection: 'AccessToken',
|
| 110 |
+
indexes: [
|
| 111 |
+
{
|
| 112 |
+
key: { userId: 1 },
|
| 113 |
+
name: 'userId_1'
|
| 114 |
+
}
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
collection: 'Donation',
|
| 119 |
+
indexes: [
|
| 120 |
+
{ key: { email: 1 }, name: 'email_1' },
|
| 121 |
+
{ key: { userId: 1 }, name: 'userId_1' }
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
collection: 'MsUsername',
|
| 126 |
+
indexes: [{ key: { userId: 1, id: 1 }, name: 'userId_1__id_1' }]
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
collection: 'SocratesUsage',
|
| 130 |
+
indexes: [
|
| 131 |
+
{
|
| 132 |
+
key: { userId: 1, date: 1 },
|
| 133 |
+
name: 'userId_date_unique',
|
| 134 |
+
unique: true
|
| 135 |
+
}
|
| 136 |
+
]
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
collection: 'Survey',
|
| 140 |
+
indexes: [{ key: { userId: 1 }, name: 'userId_1' }]
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
collection: 'UserToken',
|
| 144 |
+
indexes: [{ key: { userId: 1 }, name: 'userId_1' }]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
collection: 'sessions',
|
| 148 |
+
indexes: [
|
| 149 |
+
{
|
| 150 |
+
key: { expires: 1 },
|
| 151 |
+
name: 'expires_1',
|
| 152 |
+
expireAfterSeconds: 0
|
| 153 |
+
}
|
| 154 |
+
]
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
collection: 'user',
|
| 158 |
+
indexes: [
|
| 159 |
+
{
|
| 160 |
+
key: { email: 1, sendQuincyEmail: 1 },
|
| 161 |
+
name: 'mailing-list-pull'
|
| 162 |
+
},
|
| 163 |
+
{ key: { email: 1 }, name: 'email_1' },
|
| 164 |
+
{ key: { isDonating: 1 }, name: 'isDonating_1' },
|
| 165 |
+
{ key: { username: 1, id: 1 }, name: 'username_1__id_1' }
|
| 166 |
+
]
|
| 167 |
+
}
|
| 168 |
+
];
|
| 169 |
+
|
| 170 |
+
export async function checkCanConnectToDb(
|
| 171 |
+
prisma: FastifyTestInstance['prisma']
|
| 172 |
+
): Promise<void> {
|
| 173 |
+
const countP = prisma.user.count();
|
| 174 |
+
const delayedRejection = new Promise((_resolve, reject) =>
|
| 175 |
+
setTimeout(
|
| 176 |
+
() => reject(Error('unable to connect to Mongodb (timeout)')),
|
| 177 |
+
1000
|
| 178 |
+
)
|
| 179 |
+
);
|
| 180 |
+
await Promise.race([countP, delayedRejection]);
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
export function setupServer(): void {
|
| 184 |
+
let fastify: FastifyTestInstance;
|
| 185 |
+
beforeAll(async () => {
|
| 186 |
+
if (process.env.FCC_ENABLE_TEST_LOGGING !== 'true') {
|
| 187 |
+
delete buildOptions.loggerInstance;
|
| 188 |
+
}
|
| 189 |
+
fastify = await build(buildOptions);
|
| 190 |
+
await fastify.ready();
|
| 191 |
+
// Supertest does not handle multiple concurrent requests gracefully
|
| 192 |
+
// https://github.com/forwardemail/supertest/issues/709
|
| 193 |
+
// it calls `server.close` and can end up killing live connections.
|
| 194 |
+
// By listening to 0, we keep the ephemeral port generation, but the fact
|
| 195 |
+
// it is listening means supertest will not attempt to close it.
|
| 196 |
+
fastify.server.listen(0);
|
| 197 |
+
|
| 198 |
+
await checkCanConnectToDb(fastify.prisma);
|
| 199 |
+
|
| 200 |
+
// Prisma does not support TTL indexes in the schema yet, so, to avoid
|
| 201 |
+
// conflicts with the TTL index in the sessions collection, we need to
|
| 202 |
+
// create it manually (before interacting with the db in any way). Also,
|
| 203 |
+
// to save time, we create all other indexes so we don't need to invoke
|
| 204 |
+
// `prisma db push` (which is relatively slow).
|
| 205 |
+
|
| 206 |
+
await Promise.all(
|
| 207 |
+
indexData.map(async ({ collection, indexes }) => {
|
| 208 |
+
await fastify.prisma.$runCommandRaw({
|
| 209 |
+
createIndexes: collection,
|
| 210 |
+
indexes
|
| 211 |
+
});
|
| 212 |
+
})
|
| 213 |
+
);
|
| 214 |
+
|
| 215 |
+
global.fastifyTestInstance = fastify;
|
| 216 |
+
// allow a little time to setup the db
|
| 217 |
+
}, 10000);
|
| 218 |
+
|
| 219 |
+
afterAll(async () => {
|
| 220 |
+
if (!global.fastifyTestInstance)
|
| 221 |
+
throw Error(`fastifyTestInstance was not created. Typically this means that something went wrong when building the fastify instance.
|
| 222 |
+
If you are seeing this error, the root cause is likely an error thrown in the beforeAll hook.`);
|
| 223 |
+
await fastifyTestInstance.prisma.$runCommandRaw({ dropDatabase: 1 });
|
| 224 |
+
|
| 225 |
+
await fastifyTestInstance.close();
|
| 226 |
+
});
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// demoUser _id to allow testing with mock data
|
| 230 |
+
export const defaultUserId = '5bd30e0f1caf6ac3ddddddb5';
|
| 231 |
+
export const defaultUserEmail = 'foo@bar.com';
|
| 232 |
+
export const defaultUsername = 'fcc-test-user';
|
| 233 |
+
|
| 234 |
+
export const resetDefaultUser = async (): Promise<void> => {
|
| 235 |
+
await fastifyTestInstance.prisma.user.deleteMany({
|
| 236 |
+
where: { OR: [{ id: defaultUserId }, { email: defaultUserEmail }] }
|
| 237 |
+
});
|
| 238 |
+
|
| 239 |
+
await fastifyTestInstance.prisma.user.create({
|
| 240 |
+
data: {
|
| 241 |
+
...createUserInput(defaultUserEmail),
|
| 242 |
+
id: defaultUserId,
|
| 243 |
+
username: defaultUsername
|
| 244 |
+
}
|
| 245 |
+
});
|
| 246 |
+
};
|
| 247 |
+
|
| 248 |
+
export async function devLogin(): Promise<string[]> {
|
| 249 |
+
await resetDefaultUser();
|
| 250 |
+
const res = await superRequest('/signin', { method: 'GET' });
|
| 251 |
+
expect(res.status).toBe(302);
|
| 252 |
+
return res.get('Set-Cookie');
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
export async function seedExam(): Promise<void> {
|
| 256 |
+
const query = { where: { id: examJson.id } };
|
| 257 |
+
const testExamExists =
|
| 258 |
+
await fastifyTestInstance.prisma.exam.findUnique(query);
|
| 259 |
+
|
| 260 |
+
if (testExamExists) {
|
| 261 |
+
await fastifyTestInstance.prisma.exam.deleteMany(query);
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
await fastifyTestInstance.prisma.exam.create({
|
| 265 |
+
data: {
|
| 266 |
+
...examJson
|
| 267 |
+
}
|
| 268 |
+
});
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
export function createFetchMock({ ok = true, body = {} } = {}) {
|
| 272 |
+
return vi.fn().mockResolvedValue(
|
| 273 |
+
Promise.resolve({
|
| 274 |
+
ok,
|
| 275 |
+
json: () => Promise.resolve(body)
|
| 276 |
+
})
|
| 277 |
+
);
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
/**
|
| 281 |
+
* Utility type to recursively replace `Date` with `string`.
|
| 282 |
+
*/
|
| 283 |
+
export type ReplaceDates<T> = T extends Date
|
| 284 |
+
? string
|
| 285 |
+
: T extends (infer U)[]
|
| 286 |
+
? ReplaceDates<U>[]
|
| 287 |
+
: T extends Record<string, unknown>
|
| 288 |
+
? { [K in keyof T]: ReplaceDates<T[K]> }
|
| 289 |
+
: T;
|
| 290 |
+
|
| 291 |
+
/**
|
| 292 |
+
* Recursively finds and converts Date objects to ISO strings while preserving shape.
|
| 293 |
+
*/
|
| 294 |
+
export function serializeDates<T>(data: T): ReplaceDates<T> {
|
| 295 |
+
if (data === null || data === undefined) {
|
| 296 |
+
return data as ReplaceDates<T>;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// Preserve Vitest/Jest asymmetric matchers (e.g., expect.any(Number))
|
| 300 |
+
if (
|
| 301 |
+
typeof data === 'object' &&
|
| 302 |
+
data !== null &&
|
| 303 |
+
typeof (data as { asymmetricMatch?: unknown }).asymmetricMatch ===
|
| 304 |
+
'function'
|
| 305 |
+
) {
|
| 306 |
+
return data as unknown as ReplaceDates<T>;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
if (data instanceof Date) {
|
| 310 |
+
return data.toISOString() as ReplaceDates<T>;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
if (Array.isArray(data)) {
|
| 314 |
+
return (data as unknown[]).map(item =>
|
| 315 |
+
serializeDates(item)
|
| 316 |
+
) as ReplaceDates<T>;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
if (typeof data === 'object') {
|
| 320 |
+
const entries = Object.entries(data as Record<string, unknown>).map(
|
| 321 |
+
([key, value]) => [key, serializeDates(value)] as const
|
| 322 |
+
);
|
| 323 |
+
return Object.fromEntries(entries) as ReplaceDates<T>;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
return data as ReplaceDates<T>;
|
| 327 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/.babelrc.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable filenames-simple/naming-convention */
|
| 2 |
+
require('dotenv').config({ path: '../.env' });
|
| 3 |
+
const config = {
|
| 4 |
+
presets: [
|
| 5 |
+
[
|
| 6 |
+
'@babel/preset-env',
|
| 7 |
+
{
|
| 8 |
+
loose: true,
|
| 9 |
+
modules: false,
|
| 10 |
+
useBuiltIns: 'usage',
|
| 11 |
+
corejs: 3,
|
| 12 |
+
shippedProposals: true,
|
| 13 |
+
targets: {
|
| 14 |
+
browsers: ['>0.25%', 'not dead']
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
[
|
| 19 |
+
'@babel/preset-react',
|
| 20 |
+
{
|
| 21 |
+
useBuiltIns: true,
|
| 22 |
+
pragma: 'React.createElement'
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
'@babel/preset-typescript'
|
| 26 |
+
],
|
| 27 |
+
plugins: [
|
| 28 |
+
'preval',
|
| 29 |
+
'@babel/plugin-syntax-dynamic-import',
|
| 30 |
+
'babel-plugin-macros',
|
| 31 |
+
[
|
| 32 |
+
'@babel/plugin-transform-runtime',
|
| 33 |
+
{
|
| 34 |
+
helpers: true,
|
| 35 |
+
regenerator: true
|
| 36 |
+
}
|
| 37 |
+
],
|
| 38 |
+
[
|
| 39 |
+
'prismjs',
|
| 40 |
+
{
|
| 41 |
+
languages: [
|
| 42 |
+
'bash',
|
| 43 |
+
'c',
|
| 44 |
+
'clike',
|
| 45 |
+
'cpp',
|
| 46 |
+
'css',
|
| 47 |
+
'csharp',
|
| 48 |
+
'html',
|
| 49 |
+
'javascript',
|
| 50 |
+
'json',
|
| 51 |
+
'jsx',
|
| 52 |
+
'markup',
|
| 53 |
+
'mathml',
|
| 54 |
+
'pug',
|
| 55 |
+
'python',
|
| 56 |
+
'scss',
|
| 57 |
+
'sass',
|
| 58 |
+
'sql',
|
| 59 |
+
'svg',
|
| 60 |
+
'typescript',
|
| 61 |
+
'tsx',
|
| 62 |
+
'xml'
|
| 63 |
+
],
|
| 64 |
+
theme: 'default',
|
| 65 |
+
css: true,
|
| 66 |
+
plugins: ['line-numbers']
|
| 67 |
+
}
|
| 68 |
+
]
|
| 69 |
+
]
|
| 70 |
+
};
|
| 71 |
+
module.exports = config;
|
github_code/freeCodeCamp__freeCodeCamp/client/.gitignore
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Project dependencies
|
| 2 |
+
.cache
|
| 3 |
+
node_modules
|
| 4 |
+
yarn-error.log
|
| 5 |
+
|
| 6 |
+
# Build directory
|
| 7 |
+
/public
|
| 8 |
+
.DS_Store
|
| 9 |
+
|
| 10 |
+
/static/js
|
| 11 |
+
/static/css
|
| 12 |
+
/static/curriculum-data
|
| 13 |
+
|
| 14 |
+
# i18n build script copies non-English translations from i18n-curriculum submodule
|
| 15 |
+
/i18n/locales/*/translations.json
|
| 16 |
+
/i18n/locales/*/intro.json
|
| 17 |
+
/i18n/locales/*/meta-tags.json
|
| 18 |
+
/i18n/locales/*/motivation.json
|
| 19 |
+
# english is a special case and is commited in this repo
|
| 20 |
+
!/i18n/locales/english/translations.json
|
| 21 |
+
!/i18n/locales/english/intro.json
|
| 22 |
+
!/i18n/locales/english/meta-tags.json
|
| 23 |
+
!/i18n/locales/english/motivation.json
|
| 24 |
+
|
| 25 |
+
# Generated for all locales
|
| 26 |
+
i18n/locales/**/trending.json
|
| 27 |
+
i18n/locales/**/search-bar.json
|
| 28 |
+
|
| 29 |
+
# Config
|
| 30 |
+
|
| 31 |
+
config/env.json
|
github_code/freeCodeCamp__freeCodeCamp/client/.lintstagedrc.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable filenames-simple/naming-convention */
|
| 2 |
+
import { createLintStagedConfig } from '@freecodecamp/eslint-config/lintstaged';
|
| 3 |
+
|
| 4 |
+
export default createLintStagedConfig(import.meta.dirname);
|
github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/gatsby.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import type { GatsbyLinkProps } from 'gatsby';
|
| 3 |
+
import { vi } from 'vitest';
|
| 4 |
+
import gatsby from 'gatsby';
|
| 5 |
+
|
| 6 |
+
import envData from '../config/env.json';
|
| 7 |
+
const { clientLocale } = envData;
|
| 8 |
+
|
| 9 |
+
export const navigate = vi.fn();
|
| 10 |
+
export const graphql = vi.fn();
|
| 11 |
+
export const Link = vi
|
| 12 |
+
.fn()
|
| 13 |
+
.mockImplementation(({ to, ...rest }: GatsbyLinkProps<undefined | boolean>) =>
|
| 14 |
+
React.createElement('a', { ...rest, href: to })
|
| 15 |
+
);
|
| 16 |
+
export const withPrefix = vi.fn().mockImplementation((path: string) => {
|
| 17 |
+
const pathPrefix = clientLocale === 'english' ? '' : '/' + clientLocale;
|
| 18 |
+
return pathPrefix + path;
|
| 19 |
+
});
|
| 20 |
+
export const StaticQuery = vi.fn();
|
| 21 |
+
export const useStaticQuery = vi.fn();
|
| 22 |
+
|
| 23 |
+
export default {
|
| 24 |
+
// ...existing code...
|
| 25 |
+
// spread the actual gatsby module to keep other exports working
|
| 26 |
+
...gatsby,
|
| 27 |
+
navigate,
|
| 28 |
+
graphql,
|
| 29 |
+
Link,
|
| 30 |
+
withPrefix,
|
| 31 |
+
StaticQuery,
|
| 32 |
+
useStaticQuery
|
| 33 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/react-i18next.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
// modified from https://github.com/i18next/react-i18next/blob/master/example/test-jest/src/__mocks__/react-i18next.js
|
| 4 |
+
const hasChildren = node =>
|
| 5 |
+
node && (node.children || (node.props && node.props.children));
|
| 6 |
+
|
| 7 |
+
const getChildren = node =>
|
| 8 |
+
node && node.children ? node.children : node.props && node.props.children;
|
| 9 |
+
|
| 10 |
+
const renderNodes = reactNodes => {
|
| 11 |
+
if (typeof reactNodes === 'string') {
|
| 12 |
+
return reactNodes;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
return Object.keys(reactNodes).map((key, i) => {
|
| 16 |
+
const child = reactNodes[key];
|
| 17 |
+
const isElement = React.isValidElement(child);
|
| 18 |
+
|
| 19 |
+
if (typeof child === 'string') {
|
| 20 |
+
return child;
|
| 21 |
+
}
|
| 22 |
+
if (hasChildren(child)) {
|
| 23 |
+
const inner = renderNodes(getChildren(child));
|
| 24 |
+
return React.cloneElement(child, { ...child.props, key: i }, inner);
|
| 25 |
+
}
|
| 26 |
+
if (typeof child === 'object' && !isElement) {
|
| 27 |
+
return Object.keys(child).reduce(
|
| 28 |
+
(str, childKey) => `${str}${child[childKey]}`,
|
| 29 |
+
''
|
| 30 |
+
);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
return child;
|
| 34 |
+
});
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
const withTranslation = () => Component => {
|
| 38 |
+
const WrappedComponent = props =>
|
| 39 |
+
React.createElement(Component, {
|
| 40 |
+
...props,
|
| 41 |
+
t: props.t ?? (str => str)
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
WrappedComponent.WrappedComponent = Component;
|
| 45 |
+
WrappedComponent.displayName = `withTranslation(${Component.displayName || Component.name || 'Component'})`;
|
| 46 |
+
|
| 47 |
+
return WrappedComponent;
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
const useTranslation = () => {
|
| 51 |
+
return {
|
| 52 |
+
t: str => str,
|
| 53 |
+
i18n: {
|
| 54 |
+
changeLanguage: () => new Promise(() => {})
|
| 55 |
+
}
|
| 56 |
+
};
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
const Trans = ({ children }) =>
|
| 60 |
+
Array.isArray(children) ? renderNodes(children) : renderNodes([children]);
|
| 61 |
+
|
| 62 |
+
// translate isn't being used anywhere, uncomment if needed
|
| 63 |
+
/* const translate = () => Component => props => (
|
| 64 |
+
<Component t={() => ''} {...props} />
|
| 65 |
+
); */
|
| 66 |
+
|
| 67 |
+
module.exports = { withTranslation, useTranslation, Trans };
|
github_code/freeCodeCamp__freeCodeCamp/client/__mocks__/react-spinkit.tsx
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
// eslint-disable-next-line react/display-name
|
| 4 |
+
export default () => <div>Spinner</div>;
|
github_code/freeCodeCamp__freeCodeCamp/client/config/analytics-settings.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const prodAnalyticsId = 'GTM-57R6KJM';
|
| 2 |
+
export const devAnalyticsId = 'GTM-WSS47LM';
|
github_code/freeCodeCamp__freeCodeCamp/client/config/cert-and-project-map.test.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'node:path';
|
| 2 |
+
import fs from 'node:fs';
|
| 3 |
+
import { describe, test, expect } from 'vitest';
|
| 4 |
+
|
| 5 |
+
import { getContentDir } from '@freecodecamp/curriculum/file-handler';
|
| 6 |
+
import { buildCertification } from '@freecodecamp/curriculum/build-certification';
|
| 7 |
+
|
| 8 |
+
import { allCerts } from './cert-and-project-map';
|
| 9 |
+
|
| 10 |
+
describe('certifications', () => {
|
| 11 |
+
const certificationsDir = path.resolve(
|
| 12 |
+
getContentDir('english'),
|
| 13 |
+
'certifications'
|
| 14 |
+
);
|
| 15 |
+
|
| 16 |
+
const certificationFiles = fs.readdirSync(certificationsDir);
|
| 17 |
+
|
| 18 |
+
certificationFiles.forEach(filename => {
|
| 19 |
+
test(`${filename} should have matching items in cert-and-project-map`, () => {
|
| 20 |
+
const filePath = path.join(certificationsDir, filename);
|
| 21 |
+
const result = buildCertification(filePath);
|
| 22 |
+
|
| 23 |
+
const certData = result.challenges[0];
|
| 24 |
+
const certTests = certData.tests;
|
| 25 |
+
|
| 26 |
+
const matchingCert = allCerts.find(cert => cert.id === certData.id);
|
| 27 |
+
|
| 28 |
+
expect(
|
| 29 |
+
matchingCert,
|
| 30 |
+
`Cert ID ${certData.id} not found in allCerts.`
|
| 31 |
+
).toBeDefined();
|
| 32 |
+
expect(
|
| 33 |
+
matchingCert,
|
| 34 |
+
`Matching cert has no 'projects' property`
|
| 35 |
+
).toHaveProperty('projects');
|
| 36 |
+
|
| 37 |
+
// skip legacy-full-stack as it has no projects
|
| 38 |
+
if (filename === 'legacy-full-stack.yml') {
|
| 39 |
+
return;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
expect(
|
| 43 |
+
Array.isArray(matchingCert?.projects),
|
| 44 |
+
`Matching cert 'projects' is not an array`
|
| 45 |
+
).toBe(true);
|
| 46 |
+
|
| 47 |
+
const certProjects = matchingCert?.projects;
|
| 48 |
+
|
| 49 |
+
expect(
|
| 50 |
+
certProjects?.length,
|
| 51 |
+
`Project count mismatch: allCerts has ${certProjects?.length} projects, YAML has ${certTests.length} tests`
|
| 52 |
+
).toBe(certTests.length);
|
| 53 |
+
|
| 54 |
+
certTests.forEach((test, i) => {
|
| 55 |
+
expect(
|
| 56 |
+
test,
|
| 57 |
+
`Test at index ${i} in missing id property`
|
| 58 |
+
).toHaveProperty('id');
|
| 59 |
+
expect(
|
| 60 |
+
test,
|
| 61 |
+
`Test at index ${i} missing title property`
|
| 62 |
+
).toHaveProperty('title');
|
| 63 |
+
|
| 64 |
+
const matchingProject = certProjects?.[i];
|
| 65 |
+
|
| 66 |
+
expect(
|
| 67 |
+
matchingProject,
|
| 68 |
+
`No project found at index ${i} for test ${test.id}`
|
| 69 |
+
).toBeDefined();
|
| 70 |
+
expect(
|
| 71 |
+
matchingProject?.id,
|
| 72 |
+
`Project ID mismatch at index ${i}: allCerts has "${matchingProject?.id}", YAML has "${test.id}"`
|
| 73 |
+
).toBe(test.id);
|
| 74 |
+
});
|
| 75 |
+
});
|
| 76 |
+
});
|
| 77 |
+
});
|
github_code/freeCodeC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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
Certification,
|
| 3 |
+
legacyCertifications,
|
| 4 |
+
upcomingCertifications,
|
| 5 |
+
currentCertifications
|
| 6 |
+
} from '@freecodecamp/shared/config/certification-settings';
|
| 7 |
+
|
| 8 |
+
import config from '../config/env.json';
|
| 9 |
+
|
| 10 |
+
const { showUpcomingChanges } = config;
|
| 11 |
+
|
| 12 |
+
const responsiveWebBase =
|
| 13 |
+
'/learn/responsive-web-design/responsive-web-design-projects';
|
| 14 |
+
const responsiveWeb22Base = '/learn/2022/responsive-web-design';
|
| 15 |
+
const jsAlgoBase =
|
| 16 |
+
'/learn/javascript-algorithms-and-data-structures/' +
|
| 17 |
+
'javascript-algorithms-and-data-structures-projects';
|
| 18 |
+
const jsAlgo22Base = '/learn/javascript-algorithms-and-data-structures-v8';
|
| 19 |
+
const feLibsBase =
|
| 20 |
+
'/learn/front-end-development-libraries/front-end-development-libraries-projects';
|
| 21 |
+
const dataVisBase = '/learn/data-visualization/data-visualization-projects';
|
| 22 |
+
const relationalDatabaseBase = '/learn/relational-database';
|
| 23 |
+
const apiMicroBase =
|
| 24 |
+
'/learn/back-end-development-and-apis/back-end-development-and-apis-projects';
|
| 25 |
+
const qaBase = '/learn/quality-assurance/quality-assurance-projects';
|
| 26 |
+
const infoSecBase = '/learn/information-security/information-security-projects';
|
| 27 |
+
const sciCompPyBase = '/learn/scientific-computing-with-python';
|
| 28 |
+
const dataAnalysisPyBase =
|
| 29 |
+
'/learn/data-analysis-with-python/data-analysis-with-python-projects';
|
| 30 |
+
const machineLearningPyBase =
|
| 31 |
+
'/learn/machine-learning-with-python/machine-learning-with-python-projects';
|
| 32 |
+
const collegeAlgebraPyBase = '/learn/college-algebra-with-python';
|
| 33 |
+
const takeHomeBase = '/learn/coding-interview-prep/take-home-projects';
|
| 34 |
+
const foundationalCSharpBase =
|
| 35 |
+
'/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam';
|
| 36 |
+
const respWebV9Base = '/learn/responsive-web-design-v9';
|
| 37 |
+
const jsV9Base = '/learn/javascript-v9';
|
| 38 |
+
const frontEndDevLibsV9Base = '/learn/front-end-development-libraries-v9';
|
| 39 |
+
const pythonV9Base = '/learn/python-v9';
|
| 40 |
+
const relationalDbV9Base = '/learn/relational-databases-v9';
|
| 41 |
+
const backEndDevApisV9Base = '/learn/back-end-development-and-apis-v9';
|
| 42 |
+
const fullStackDeveloperV9Base = '/learn/full-stack-developer-v9';
|
| 43 |
+
const a2EnglishBase = '/learn/a2-english-for-developers';
|
| 44 |
+
const b1EnglishBase = '/learn/b1-english-for-developers';
|
| 45 |
+
const a2SpanishBase = '/learn/a2-professional-spanish';
|
| 46 |
+
const a2ChineseBase = '/learn/a2-professional-chinese';
|
| 47 |
+
const a1ChineseBase = '/learn/a1-professional-chinese';
|
| 48 |
+
const legacyFrontEndBase = feLibsBase;
|
| 49 |
+
const legacyFrontEndResponsiveBase = responsiveWebBase;
|
| 50 |
+
const legacyFrontEndTakeHomeBase = takeHomeBase;
|
| 51 |
+
const legacyBackEndBase = apiMicroBase;
|
| 52 |
+
const legacyBackEndTakeHomeBase = takeHomeBase;
|
| 53 |
+
const legacyDataVisBase = dataVisBase;
|
| 54 |
+
const legacyDataVisFrontEndBase = feLibsBase;
|
| 55 |
+
const legacyDataVisTakeHomeBase = takeHomeBase;
|
| 56 |
+
const legacyInfosecQaQaBase = qaBase;
|
| 57 |
+
const legacyInfosecQaInfosecBase = infoSecBase;
|
| 58 |
+
|
| 59 |
+
// TODO: generate this automatically in a separate file
|
| 60 |
+
// from the md/meta.json files for each cert and projects
|
| 61 |
+
const fullstackCert = {
|
| 62 |
+
id: '561add10cb82ac38a17213bd',
|
| 63 |
+
title: 'Legacy Full-Stack',
|
| 64 |
+
certSlug: Certification.LegacyFullStack,
|
| 65 |
+
projects: null
|
| 66 |
+
// Requirements are other certs and is
|
| 67 |
+
// handled elsewhere
|
| 68 |
+
} as const;
|
| 69 |
+
const allStandardCerts = [
|
| 70 |
+
{
|
| 71 |
+
id: '561add10cb82ac38a17513bc',
|
| 72 |
+
title: 'Responsive Web Design',
|
| 73 |
+
certSlug: Certification.RespWebDesign,
|
| 74 |
+
projects: [
|
| 75 |
+
{
|
| 76 |
+
id: '587d78af367417b2b2512b03',
|
| 77 |
+
title: 'Build a Survey Form',
|
| 78 |
+
link: getResponsiveWebDesignPath('build-a-survey-form'),
|
| 79 |
+
certSlug: Certification.RespWebDesign
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
id: 'bd7158d8c442eddfaeb5bd18',
|
| 83 |
+
title: 'Build a Tribute Page',
|
| 84 |
+
link: getResponsiveWebDesignPath('build-a-tribute-page'),
|
| 85 |
+
certSlug: Certification.RespWebDesign
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
id: '587d78b0367417b2b2512b05',
|
| 89 |
+
title: 'Build a Technical Documentation Page',
|
| 90 |
+
link: getResponsiveWebDesignPath(
|
| 91 |
+
'build-a-technical-documentation-page'
|
| 92 |
+
),
|
| 93 |
+
certSlug: Certification.RespWebDesign
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
id: '587d78af367417b2b2512b04',
|
| 97 |
+
title: 'Build a Product Landing Page',
|
| 98 |
+
link: getResponsiveWebDesignPath('build-a-product-landing-page'),
|
| 99 |
+
certSlug: Certification.RespWebDesign
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
id: 'bd7158d8c242eddfaeb5bd13',
|
| 103 |
+
title: 'Build a Personal Portfolio Webpage',
|
| 104 |
+
link: getResponsiveWebDesignPath('build-a-personal-portfolio-webpage'),
|
| 105 |
+
certSlug: Certification.RespWebDesign
|
| 106 |
+
}
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
id: '658180220947283cdc0689ce',
|
| 111 |
+
title: 'JavaScript Algorithms and Data Structures',
|
| 112 |
+
certSlug: Certification.JsAlgoDataStructNew,
|
| 113 |
+
projects: [
|
| 114 |
+
{
|
| 115 |
+
id: '657bdc55a322aae1eac3838f',
|
| 116 |
+
title: 'Build a Palindrome Checker',
|
| 117 |
+
link: getJavaScriptAlgoPath('build-a-palindrome-checker'),
|
| 118 |
+
certSlug: Certification.JsAlgoDataStructNew
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
id: '657bdc8ba322aae1eac38390',
|
| 122 |
+
title: 'Build a Roman Numeral Converter',
|
| 123 |
+
link: getJavaScriptAlgoPath('build-a-roman-numeral-converter'),
|
| 124 |
+
certSlug: Certification.JsAlgoDataStructNew
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
id: '657bdcb9a322aae1eac38391',
|
| 128 |
+
title: 'Build a Telephone Number Validator',
|
| 129 |
+
link: getJavaScriptAlgoPath('build-a-telephone-number-validator'),
|
| 130 |
+
certSlug: Certification.JsAlgoDataStructNew
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
id: '657bdcc3a322aae1eac38392',
|
| 134 |
+
title: 'Build a Cash Register',
|
| 135 |
+
link: getJavaScriptAlgoPath('build-a-cash-register'),
|
| 136 |
+
certSlug: Certification.JsAlgoDataStructNew
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
id: '6555c1d3e11a1574434cf8b5',
|
| 140 |
+
title: 'Build an RPG Creature Search App',
|
| 141 |
+
link: getJavaScriptAlgoPath('build-an-rpg-creature-search-app'),
|
| 142 |
+
certSlug: Certification.JsAlgoDataStructNew
|
| 143 |
+
}
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
id: '561acd10cb82ac38a17513bc',
|
| 148 |
+
title: 'Front-End Development Libraries',
|
| 149 |
+
certSlug: Certification.FrontEndDevLibs,
|
| 150 |
+
projects: [
|
| 151 |
+
{
|
| 152 |
+
id: 'bd7158d8c442eddfaeb5bd13',
|
| 153 |
+
title: 'Build a Random Quote Machine',
|
| 154 |
+
link: `${feLibsBase}/build-a-random-quote-machine`,
|
| 155 |
+
certSlug: Certification.FrontEndDevLibs
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
id: 'bd7157d8c242eddfaeb5bd13',
|
| 159 |
+
title: 'Build a Markdown Previewer',
|
| 160 |
+
link: `${feLibsBase}/build-a-markdown-previewer`,
|
| 161 |
+
certSlug: Certification.FrontEndDevLibs
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
id: '587d7dbc367417b2b2512bae',
|
| 165 |
+
title: 'Build a Drum Machine',
|
| 166 |
+
link: `${feLibsBase}/build-a-drum-machine`,
|
| 167 |
+
certSlug: Certification.FrontEndDevLibs
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
id: 'bd7158d8c442eddfaeb5bd17',
|
| 171 |
+
title: 'Build a JavaScript Calculator',
|
| 172 |
+
link: `${feLibsBase}/build-a-javascript-calculator`,
|
| 173 |
+
certSlug: Certification.FrontEndDevLibs
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
id: 'bd7158d8c442eddfaeb5bd0f',
|
| 177 |
+
title: 'Build a 25 + 5 Clock',
|
| 178 |
+
link: `${feLibsBase}/build-a-25--5-clock`,
|
| 179 |
+
certSlug: Certification.FrontEndDevLibs
|
| 180 |
+
}
|
| 181 |
+
]
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
id: '5a553ca864b52e1d8bceea14',
|
| 185 |
+
title: 'Data Visualization',
|
| 186 |
+
certSlug: Certification.DataVis,
|
| 187 |
+
projects: [
|
| 188 |
+
{
|
| 189 |
+
id: 'bd7168d8c242eddfaeb5bd13',
|
| 190 |
+
title: 'Visualize Data with a Bar Chart',
|
| 191 |
+
link: `${dataVisBase}/visualize-data-with-a-bar-chart`,
|
| 192 |
+
certSlug: Certification.DataVis
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
id: 'bd7178d8c242eddfaeb5bd13',
|
| 196 |
+
title: 'Visualize Data with a Scatterplot Graph',
|
| 197 |
+
link: `${dataVisBase}/visualize-data-with-a-scatterplot-graph`,
|
| 198 |
+
certSlug: Certification.DataVis
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
id: 'bd7188d8c242eddfaeb5bd13',
|
| 202 |
+
title: 'Visualize Data with a Heat Map',
|
| 203 |
+
link: `${dataVisBase}/visualize-data-with-a-heat-map`,
|
| 204 |
+
certSlug: Certification.DataVis
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
id: '587d7fa6367417b2b2512bbf',
|
| 208 |
+
title: 'Visualize Data with a Choropleth Map',
|
| 209 |
+
link: `${dataVisBase}/visualize-data-with-a-choropleth-map`,
|
| 210 |
+
certSlug: Certification.DataVis
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
id: '587d7fa6367417b2b2512bc0',
|
| 214 |
+
title: 'Visualize Data with a Treemap Diagram',
|
| 215 |
+
link: `${dataVisBase}/visualize-data-with-a-treemap-diagram`,
|
| 216 |
+
certSlug: Certification.DataVis
|
| 217 |
+
}
|
| 218 |
+
]
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
id: '606243f50267e718b1e755f4',
|
| 222 |
+
title: 'Relational Database',
|
| 223 |
+
certSlug: Certification.RelationalDb,
|
| 224 |
+
projects: [
|
| 225 |
+
{
|
| 226 |
+
id: '5f1a4ef5d5d6b5ab580fc6ae',
|
| 227 |
+
title: 'Celestial Bodies Database',
|
| 228 |
+
link: `${relationalDatabaseBase}/build-a-celestial-bodies-database-project/build-a-celestial-bodies-database`,
|
| 229 |
+
certSlug: Certification.RelationalDb
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
id: '5f9771307d4d22b9d2b75a94',
|
| 233 |
+
title: 'World Cup Database',
|
| 234 |
+
link: `${relationalDatabaseBase}/build-a-world-cup-database-project/build-a-world-cup-database`,
|
| 235 |
+
certSlug: Certification.RelationalDb
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
id: '5f87ac112ae598023a42df1a',
|
| 239 |
+
title: 'Salon Appointment Scheduler',
|
| 240 |
+
link: `${relationalDatabaseBase}/build-a-salon-appointment-scheduler-project/build-a-salon-appointment-scheduler`,
|
| 241 |
+
certSlug: Certification.RelationalDb
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
id: '602d9ff222201c65d2a019f2',
|
| 245 |
+
title: 'Periodic Table Database',
|
| 246 |
+
link: `${relationalDatabaseBase}/build-a-periodic-table-database-project/build-a-periodic-table-database`,
|
| 247 |
+
certSlug: Certification.RelationalDb
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
id: '602da04c22201c65d2a019f4',
|
| 251 |
+
title: 'Number Guessing Game',
|
| 252 |
+
link: `${relationalDatabaseBase}/build-a-number-guessing-game-project/build-a-number-guessing-game`,
|
| 253 |
+
certSlug: Certification.RelationalDb
|
| 254 |
+
}
|
| 255 |
+
]
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
id: '561add10cb82ac38a17523bc',
|
| 259 |
+
title: 'Back-End Development and APIs',
|
| 260 |
+
certSlug: Certification.BackEndDevApis,
|
| 261 |
+
projects: [
|
| 262 |
+
{
|
| 263 |
+
id: 'bd7158d8c443edefaeb5bdef',
|
| 264 |
+
title: 'Timestamp Microservice',
|
| 265 |
+
link: `${apiMicroBase}/timestamp-microservice`,
|
| 266 |
+
certSlug: Certification.BackEndDevApis
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
id: 'bd7158d8c443edefaeb5bdff',
|
| 270 |
+
title: 'Request Header Parser Microservice',
|
| 271 |
+
link: `${apiMicroBase}/request-header-parser-microservice`,
|
| 272 |
+
certSlug: Certification.BackEndDevApis
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
id: 'bd7158d8c443edefaeb5bd0e',
|
| 276 |
+
title: 'URL Shortener Microservice',
|
| 277 |
+
link: `${apiMicroBase}/url-shortener-microservice`,
|
| 278 |
+
certSlug: Certification.BackEndDevApis
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
id: '5a8b073d06fa14fcfde687aa',
|
| 282 |
+
title: 'Exercise Tracker',
|
| 283 |
+
link: `${apiMicroBase}/exercise-tracker`,
|
| 284 |
+
certSlug: Certification.BackEndDevApis
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
id: 'bd7158d8c443edefaeb5bd0f',
|
| 288 |
+
title: 'File Metadata Microservice',
|
| 289 |
+
link: `${apiMicroBase}/file-metadata-microservice`,
|
| 290 |
+
certSlug: Certification.BackEndDevApis
|
| 291 |
+
}
|
| 292 |
+
]
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
id: '5e611829481575a52dc59c0e',
|
| 296 |
+
title: 'Quality Assurance',
|
| 297 |
+
certSlug: Certification.QualityAssurance,
|
| 298 |
+
projects: [
|
| 299 |
+
{
|
| 300 |
+
id: '587d8249367417b2b2512c41',
|
| 301 |
+
title: 'Metric-Imperial Converter',
|
| 302 |
+
link: `${qaBase}/metric-imperial-converter`,
|
| 303 |
+
certSlug: Certification.QualityAssurance
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
id: '587d8249367417b2b2512c42',
|
| 307 |
+
title: 'Issue Tracker',
|
| 308 |
+
link: `${qaBase}/issue-tracker`,
|
| 309 |
+
certSlug: Certification.QualityAssurance
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
id: '587d824a367417b2b2512c43',
|
| 313 |
+
title: 'Personal Library',
|
| 314 |
+
link: `${qaBase}/personal-library`,
|
| 315 |
+
certSlug: Certification.QualityAssurance
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
id: '5e601bf95ac9d0ecd8b94afd',
|
| 319 |
+
title: 'Sudoku Solver',
|
| 320 |
+
link: `${qaBase}/sudoku-solver`,
|
| 321 |
+
certSlug: Certification.QualityAssurance
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
id: '5e601c0d5ac9d0ecd8b94afe',
|
| 325 |
+
title: 'American British Translator',
|
| 326 |
+
link: `${qaBase}/american-british-translator`,
|
| 327 |
+
certSlug: Certification.QualityAssurance
|
| 328 |
+
}
|
| 329 |
+
]
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
id: '5e44431b903586ffb414c951',
|
| 333 |
+
title: 'Scientific Computing with Python',
|
| 334 |
+
certSlug: Certification.SciCompPy,
|
| 335 |
+
projects: [
|
| 336 |
+
{
|
| 337 |
+
id: '5e44412c903586ffb414c94c',
|
| 338 |
+
title: 'Arithmetic Formatter',
|
| 339 |
+
link: `${sciCompPyBase}/build-an-arithmetic-formatter-project/build-an-arithmetic-formatter-project`,
|
| 340 |
+
certSlug: Certification.SciCompPy
|
| 341 |
+
},
|
| 342 |
+
{
|
| 343 |
+
id: '5e444136903586ffb414c94d',
|
| 344 |
+
title: 'Time Calculator',
|
| 345 |
+
link: `${sciCompPyBase}/build-a-time-calculator-project/build-a-time-calculator-project`,
|
| 346 |
+
certSlug: Certification.SciCompPy
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
id: '5e44413e903586ffb414c94e',
|
| 350 |
+
title: 'Budget App',
|
| 351 |
+
link: `${sciCompPyBase}/build-a-budget-app-project/build-a-budget-app-project`,
|
| 352 |
+
certSlug: Certification.SciCompPy
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
id: '5e444147903586ffb414c94f',
|
| 356 |
+
title: 'Polygon Area Calculator',
|
| 357 |
+
link: `${sciCompPyBase}/build-a-polygon-area-calculator-project/build-a-polygon-area-calculator-project`,
|
| 358 |
+
certSlug: Certification.SciCompPy
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
id: '5e44414f903586ffb414c950',
|
| 362 |
+
title: 'Probability Calculator',
|
| 363 |
+
link: `${sciCompPyBase}/build-a-probability-calculator-project/build-a-probability-calculator-project`,
|
| 364 |
+
certSlug: Certification.SciCompPy
|
| 365 |
+
}
|
| 366 |
+
]
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
id: '5e46fc95ac417301a38fb934',
|
| 370 |
+
title: 'Data Analysis with Python',
|
| 371 |
+
certSlug: Certification.DataAnalysisPy,
|
| 372 |
+
projects: [
|
| 373 |
+
{
|
| 374 |
+
id: '5e46f7e5ac417301a38fb928',
|
| 375 |
+
title: 'Mean-Variance-Standard Deviation Calculator',
|
| 376 |
+
link: `${dataAnalysisPyBase}/mean-variance-standard-deviation-calculator`,
|
| 377 |
+
certSlug: Certification.DataAnalysisPy
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
id: '5e46f7e5ac417301a38fb929',
|
| 381 |
+
title: 'Demographic Data Analyzer',
|
| 382 |
+
link: `${dataAnalysisPyBase}/demographic-data-analyzer`,
|
| 383 |
+
certSlug: Certification.DataAnalysisPy
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
id: '5e46f7f8ac417301a38fb92a',
|
| 387 |
+
title: 'Medical Data Visualizer',
|
| 388 |
+
link: `${dataAnalysisPyBase}/medical-data-visualizer`,
|
| 389 |
+
certSlug: Certification.DataAnalysisPy
|
| 390 |
+
},
|
| 391 |
+
{
|
| 392 |
+
id: '5e46f802ac417301a38fb92b',
|
| 393 |
+
title: 'Page View Time Series Visualizer',
|
| 394 |
+
link: `${dataAnalysisPyBase}/page-view-time-series-visualizer`,
|
| 395 |
+
certSlug: Certification.DataAnalysisPy
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
id: '5e4f5c4b570f7e3a4949899f',
|
| 399 |
+
title: 'Sea Level Predictor',
|
| 400 |
+
link: `${dataAnalysisPyBase}/sea-level-predictor`,
|
| 401 |
+
certSlug: Certification.DataAnalysisPy
|
| 402 |
+
}
|
| 403 |
+
]
|
| 404 |
+
},
|
| 405 |
+
|
| 406 |
+
{
|
| 407 |
+
id: '5e6021435ac9d0ecd8b94b00',
|
| 408 |
+
title: 'Information Security',
|
| 409 |
+
certSlug: Certification.InfoSec,
|
| 410 |
+
projects: [
|
| 411 |
+
{
|
| 412 |
+
id: '587d824a367417b2b2512c44',
|
| 413 |
+
title: 'Stock Price Checker',
|
| 414 |
+
link: `${infoSecBase}/stock-price-checker`,
|
| 415 |
+
certSlug: Certification.InfoSec
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
id: '587d824a367417b2b2512c45',
|
| 419 |
+
title: 'Anonymous Message Board',
|
| 420 |
+
link: `${infoSecBase}/anonymous-message-board`,
|
| 421 |
+
certSlug: Certification.InfoSec
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
id: '5e46f979ac417301a38fb932',
|
| 425 |
+
title: 'Port Scanner',
|
| 426 |
+
link: `${infoSecBase}/port-scanner`,
|
| 427 |
+
certSlug: Certification.InfoSec
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
id: '5e46f983ac417301a38fb933',
|
| 431 |
+
title: 'SHA-1 Password Cracker',
|
| 432 |
+
link: `${infoSecBase}/sha-1-password-cracker`,
|
| 433 |
+
certSlug: Certification.InfoSec
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
id: '5e601c775ac9d0ecd8b94aff',
|
| 437 |
+
title: 'Secure Real Time Multiplayer Game',
|
| 438 |
+
link: `${infoSecBase}/secure-real-time-multiplayer-game`,
|
| 439 |
+
certSlug: Certification.InfoSec
|
| 440 |
+
}
|
| 441 |
+
]
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
id: '5e46fc95ac417301a38fb935',
|
| 445 |
+
title: 'Machine Learning with Python',
|
| 446 |
+
certSlug: Certification.MachineLearningPy,
|
| 447 |
+
projects: [
|
| 448 |
+
{
|
| 449 |
+
id: '5e46f8d6ac417301a38fb92d',
|
| 450 |
+
title: 'Rock Paper Scissors',
|
| 451 |
+
link: `${machineLearningPyBase}/rock-paper-scissors`,
|
| 452 |
+
certSlug: Certification.MachineLearningPy
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
id: '5e46f8dcac417301a38fb92e',
|
| 456 |
+
title: 'Cat and Dog Image Classifier',
|
| 457 |
+
link: `${machineLearningPyBase}/cat-and-dog-image-classifier`,
|
| 458 |
+
certSlug: Certification.MachineLearningPy
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
id: '5e46f8e3ac417301a38fb92f',
|
| 462 |
+
title: 'Book Recommendation Engine using KNN',
|
| 463 |
+
link: `${machineLearningPyBase}/book-recommendation-engine-using-knn`,
|
| 464 |
+
certSlug: Certification.MachineLearningPy
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
id: '5e46f8edac417301a38fb930',
|
| 468 |
+
title: 'Linear Regression Health Costs Calculator',
|
| 469 |
+
link: `${machineLearningPyBase}/linear-regression-health-costs-calculator`,
|
| 470 |
+
certSlug: Certification.MachineLearningPy
|
| 471 |
+
},
|
| 472 |
+
{
|
| 473 |
+
id: '5e46f8edac417301a38fb931',
|
| 474 |
+
title: 'Neural Network SMS Text Classifier',
|
| 475 |
+
link: `${machineLearningPyBase}/neural-network-sms-text-classifier`,
|
| 476 |
+
certSlug: Certification.MachineLearningPy
|
| 477 |
+
}
|
| 478 |
+
]
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
id: '61531b20cc9dfa2741a5b800',
|
| 482 |
+
title: 'College Algebra with Python',
|
| 483 |
+
certSlug: Certification.CollegeAlgebraPy,
|
| 484 |
+
projects: [
|
| 485 |
+
{
|
| 486 |
+
id: '63d83ff239c73468b059cd3f',
|
| 487 |
+
title: 'Build a Multi-Function Calculator',
|
| 488 |
+
link: getCollegeAlgebraPyPath('build-a-multi-function-calculator'),
|
| 489 |
+
certSlug: Certification.CollegeAlgebraPy
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
id: '63d83ffd39c73468b059cd40',
|
| 493 |
+
title: 'Build a Graphing Calculator',
|
| 494 |
+
link: getCollegeAlgebraPyPath('build-a-graphing-calculator'),
|
| 495 |
+
certSlug: Certification.CollegeAlgebraPy
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
id: '63d8401039c73468b059cd41',
|
| 499 |
+
title: 'Build Three Math Games',
|
| 500 |
+
link: getCollegeAlgebraPyPath('build-three-math-games'),
|
| 501 |
+
certSlug: Certification.CollegeAlgebraPy
|
| 502 |
+
},
|
| 503 |
+
{
|
| 504 |
+
id: '63d8401e39c73468b059cd42',
|
| 505 |
+
title: 'Build a Financial Calculator',
|
| 506 |
+
link: getCollegeAlgebraPyPath('build-a-financial-calculator'),
|
| 507 |
+
certSlug: Certification.CollegeAlgebraPy
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
id: '63d8402e39c73468b059cd43',
|
| 511 |
+
title: 'Build a Data Graph Explorer',
|
| 512 |
+
link: getCollegeAlgebraPyPath('build-a-data-graph-explorer'),
|
| 513 |
+
certSlug: Certification.CollegeAlgebraPy
|
| 514 |
+
}
|
| 515 |
+
]
|
| 516 |
+
},
|
| 517 |
+
// Legacy certifications
|
| 518 |
+
{
|
| 519 |
+
id: '561add10cb82ac38a17513be',
|
| 520 |
+
title: 'Legacy Front-End',
|
| 521 |
+
certSlug: Certification.LegacyFrontEnd,
|
| 522 |
+
projects: [
|
| 523 |
+
{
|
| 524 |
+
id: 'bd7158d8c242eddfaeb5bd13',
|
| 525 |
+
title: 'Build a Personal Portfolio Webpage',
|
| 526 |
+
link: `${legacyFrontEndResponsiveBase}/build-a-personal-portfolio-webpage`,
|
| 527 |
+
certSlug: Certification.LegacyFrontEnd
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
id: 'bd7158d8c442eddfaeb5bd13',
|
| 531 |
+
title: 'Build a Random Quote Machine',
|
| 532 |
+
link: `${legacyFrontEndBase}/build-a-random-quote-machine`,
|
| 533 |
+
certSlug: Certification.LegacyFrontEnd
|
| 534 |
+
},
|
| 535 |
+
{
|
| 536 |
+
id: 'bd7158d8c442eddfaeb5bd0f',
|
| 537 |
+
title: 'Build a 25 + 5 Clock',
|
| 538 |
+
link: `${legacyFrontEndBase}/build-a-25--5-clock`,
|
| 539 |
+
certSlug: Certification.LegacyFrontEnd
|
| 540 |
+
},
|
| 541 |
+
{
|
| 542 |
+
id: 'bd7158d8c442eddfaeb5bd17',
|
| 543 |
+
title: 'Build a JavaScript Calculator',
|
| 544 |
+
link: `${legacyFrontEndBase}/build-a-javascript-calculator`,
|
| 545 |
+
certSlug: Certification.LegacyFrontEnd
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
id: 'bd7158d8c442eddfaeb5bd10',
|
| 549 |
+
title: 'Show the Local Weather',
|
| 550 |
+
link: `${legacyFrontEndTakeHomeBase}/show-the-local-weather`,
|
| 551 |
+
certSlug: Certification.LegacyFrontEnd
|
| 552 |
+
},
|
| 553 |
+
{
|
| 554 |
+
id: 'bd7158d8c442eddfaeb5bd1f',
|
| 555 |
+
title: 'Use the TwitchTV JSON API',
|
| 556 |
+
link: `${legacyFrontEndTakeHomeBase}/use-the-twitch-json-api`,
|
| 557 |
+
certSlug: Certification.LegacyFrontEnd
|
| 558 |
+
},
|
| 559 |
+
{
|
| 560 |
+
id: 'bd7158d8c442eddfaeb5bd18',
|
| 561 |
+
title: 'Build a Tribute Page',
|
| 562 |
+
link: `${legacyFrontEndResponsiveBase}/build-a-tribute-page`,
|
| 563 |
+
certSlug: Certification.LegacyFrontEnd
|
| 564 |
+
},
|
| 565 |
+
{
|
| 566 |
+
id: 'bd7158d8c442eddfaeb5bd19',
|
| 567 |
+
title: 'Build a Wikipedia Viewer',
|
| 568 |
+
link: `${legacyFrontEndTakeHomeBase}/build-a-wikipedia-viewer`,
|
| 569 |
+
certSlug: Certification.LegacyFrontEnd
|
| 570 |
+
},
|
| 571 |
+
{
|
| 572 |
+
id: 'bd7158d8c442eedfaeb5bd1c',
|
| 573 |
+
title: 'Build a Tic Tac Toe Game',
|
| 574 |
+
link: `${legacyFrontEndTakeHomeBase}/build-a-tic-tac-toe-game`,
|
| 575 |
+
certSlug: Certification.LegacyFrontEnd
|
| 576 |
+
},
|
| 577 |
+
{
|
| 578 |
+
id: 'bd7158d8c442eddfaeb5bd1c',
|
| 579 |
+
title: 'Build a Memory Light Game',
|
| 580 |
+
link: `${legacyFrontEndTakeHomeBase}/build-a-memory-light-game`,
|
| 581 |
+
certSlug: Certification.LegacyFrontEnd
|
| 582 |
+
}
|
| 583 |
+
]
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
id: '561abd10cb81ac38a17513bc',
|
| 587 |
+
title: 'Legacy JavaScript Algorithms and Data Structures',
|
| 588 |
+
certSlug: Certification.JsAlgoDataStruct,
|
| 589 |
+
projects: [
|
| 590 |
+
{
|
| 591 |
+
id: 'aaa48de84e1ecc7c742e1124',
|
| 592 |
+
title: 'Palindrome Checker',
|
| 593 |
+
link: `${jsAlgoBase}/palindrome-checker`,
|
| 594 |
+
certSlug: Certification.JsAlgoDataStruct
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
id: 'a7f4d8f2483413a6ce226cac',
|
| 598 |
+
title: 'Roman Numeral Converter',
|
| 599 |
+
link: `${jsAlgoBase}/roman-numeral-converter`,
|
| 600 |
+
certSlug: Certification.JsAlgoDataStruct
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
id: '56533eb9ac21ba0edf2244e2',
|
| 604 |
+
title: 'Caesars Cipher',
|
| 605 |
+
link: `${jsAlgoBase}/caesars-cipher`,
|
| 606 |
+
certSlug: Certification.JsAlgoDataStruct
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
id: 'aff0395860f5d3034dc0bfc9',
|
| 610 |
+
title: 'Telephone Number Validator',
|
| 611 |
+
link: `${jsAlgoBase}/telephone-number-validator`,
|
| 612 |
+
certSlug: Certification.JsAlgoDataStruct
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
id: 'aa2e6f85cab2ab736c9a9b24',
|
| 616 |
+
title: 'Cash Register',
|
| 617 |
+
link: `${jsAlgoBase}/cash-register`,
|
| 618 |
+
certSlug: Certification.JsAlgoDataStruct
|
| 619 |
+
}
|
| 620 |
+
]
|
| 621 |
+
},
|
| 622 |
+
{
|
| 623 |
+
id: '660add10cb82ac38a17513be',
|
| 624 |
+
title: 'Legacy Back-End',
|
| 625 |
+
certSlug: Certification.LegacyBackEnd,
|
| 626 |
+
projects: [
|
| 627 |
+
{
|
| 628 |
+
id: 'bd7158d8c443edefaeb5bdef',
|
| 629 |
+
title: 'Timestamp Microservice',
|
| 630 |
+
link: `${legacyBackEndBase}/timestamp-microservice`,
|
| 631 |
+
certSlug: Certification.LegacyBackEnd
|
| 632 |
+
},
|
| 633 |
+
{
|
| 634 |
+
id: 'bd7158d8c443edefaeb5bdff',
|
| 635 |
+
title: 'Request Header Parser Microservice',
|
| 636 |
+
link: `${legacyBackEndBase}/request-header-parser-microservice`,
|
| 637 |
+
certSlug: Certification.LegacyBackEnd
|
| 638 |
+
},
|
| 639 |
+
{
|
| 640 |
+
id: 'bd7158d8c443edefaeb5bd0e',
|
| 641 |
+
title: 'URL Shortener Microservice',
|
| 642 |
+
link: `${legacyBackEndBase}/url-shortener-microservice`,
|
| 643 |
+
certSlug: Certification.LegacyBackEnd
|
| 644 |
+
},
|
| 645 |
+
{
|
| 646 |
+
id: 'bd7158d8c443edefaeb5bdee',
|
| 647 |
+
title: 'Image Search Abstraction Layer',
|
| 648 |
+
link: `${legacyBackEndTakeHomeBase}/build-an-image-search-abstraction-layer`,
|
| 649 |
+
certSlug: Certification.LegacyBackEnd
|
| 650 |
+
},
|
| 651 |
+
{
|
| 652 |
+
id: 'bd7158d8c443edefaeb5bd0f',
|
| 653 |
+
title: 'File Metadata Microservice',
|
| 654 |
+
link: `${legacyBackEndBase}/file-metadata-microservice`,
|
| 655 |
+
certSlug: Certification.LegacyBackEnd
|
| 656 |
+
},
|
| 657 |
+
{
|
| 658 |
+
id: 'bd7158d8c443eddfaeb5bdef',
|
| 659 |
+
title: 'Build a Voting App',
|
| 660 |
+
link: `${legacyBackEndTakeHomeBase}/build-a-voting-app`,
|
| 661 |
+
certSlug: Certification.LegacyBackEnd
|
| 662 |
+
},
|
| 663 |
+
{
|
| 664 |
+
id: 'bd7158d8c443eddfaeb5bdff',
|
| 665 |
+
title: 'Build a Nightlife Coordination App',
|
| 666 |
+
link: `${legacyBackEndTakeHomeBase}/build-a-nightlife-coordination-app`,
|
| 667 |
+
certSlug: Certification.LegacyBackEnd
|
| 668 |
+
},
|
| 669 |
+
{
|
| 670 |
+
id: 'bd7158d8c443eddfaeb5bd0e',
|
| 671 |
+
title: 'Chart the Stock Market',
|
| 672 |
+
link: `${legacyBackEndTakeHomeBase}/chart-the-stock-market`,
|
| 673 |
+
certSlug: Certification.LegacyBackEnd
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
id: 'bd7158d8c443eddfaeb5bd0f',
|
| 677 |
+
title: 'Manage a Book Trading Club',
|
| 678 |
+
link: `${legacyBackEndTakeHomeBase}/manage-a-book-trading-club`,
|
| 679 |
+
certSlug: Certification.LegacyBackEnd
|
| 680 |
+
},
|
| 681 |
+
{
|
| 682 |
+
id: 'bd7158d8c443eddfaeb5bdee',
|
| 683 |
+
title: 'Build a Pinterest Clone',
|
| 684 |
+
link: `${legacyBackEndTakeHomeBase}/build-a-pinterest-clone`,
|
| 685 |
+
certSlug: Certification.LegacyBackEnd
|
| 686 |
+
}
|
| 687 |
+
]
|
| 688 |
+
},
|
| 689 |
+
|
| 690 |
+
{
|
| 691 |
+
id: '561add10cb82ac39a17513bc',
|
| 692 |
+
title: 'Legacy Data Visualization',
|
| 693 |
+
certSlug: Certification.LegacyDataVis,
|
| 694 |
+
projects: [
|
| 695 |
+
{
|
| 696 |
+
id: 'bd7157d8c242eddfaeb5bd13',
|
| 697 |
+
title: 'Build a Markdown Previewer',
|
| 698 |
+
link: `${legacyDataVisFrontEndBase}/build-a-markdown-previewer`,
|
| 699 |
+
certSlug: Certification.LegacyDataVis
|
| 700 |
+
},
|
| 701 |
+
{
|
| 702 |
+
id: 'bd7156d8c242eddfaeb5bd13',
|
| 703 |
+
title: 'Build a freeCodeCamp Forum Homepage',
|
| 704 |
+
link: `${legacyDataVisTakeHomeBase}/build-a-freecodecamp-forum-homepage`,
|
| 705 |
+
certSlug: Certification.LegacyDataVis
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
id: 'bd7155d8c242eddfaeb5bd13',
|
| 709 |
+
title: 'Build a Recipe Box',
|
| 710 |
+
link: `${legacyDataVisTakeHomeBase}/build-a-recipe-box`,
|
| 711 |
+
certSlug: Certification.LegacyDataVis
|
| 712 |
+
},
|
| 713 |
+
{
|
| 714 |
+
id: 'bd7154d8c242eddfaeb5bd13',
|
| 715 |
+
title: 'Build the Game of Life',
|
| 716 |
+
link: `${legacyDataVisTakeHomeBase}/build-the-game-of-life`,
|
| 717 |
+
certSlug: Certification.LegacyDataVis
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
id: 'bd7153d8c242eddfaeb5bd13',
|
| 721 |
+
title: 'Build a Roguelike Dungeon Crawler Game',
|
| 722 |
+
link: `${legacyDataVisTakeHomeBase}/build-a-roguelike-dungeon-crawler-game`,
|
| 723 |
+
certSlug: Certification.LegacyDataVis
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
id: 'bd7168d8c242eddfaeb5bd13',
|
| 727 |
+
title: 'Visualize Data with a Bar Chart',
|
| 728 |
+
link: `${legacyDataVisBase}/visualize-data-with-a-bar-chart`,
|
| 729 |
+
certSlug: Certification.LegacyDataVis
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
id: 'bd7178d8c242eddfaeb5bd13',
|
| 733 |
+
title: 'Visualize Data with a Scatterplot Graph',
|
| 734 |
+
link: `${legacyDataVisBase}/visualize-data-with-a-scatterplot-graph`,
|
| 735 |
+
certSlug: Certification.LegacyDataVis
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
id: 'bd7188d8c242eddfaeb5bd13',
|
| 739 |
+
title: 'Visualize Data with a Heat Map',
|
| 740 |
+
link: `${legacyDataVisBase}/visualize-data-with-a-heat-map`,
|
| 741 |
+
certSlug: Certification.LegacyDataVis
|
| 742 |
+
},
|
| 743 |
+
{
|
| 744 |
+
id: 'bd7198d8c242eddfaeb5bd13',
|
| 745 |
+
title: 'Show National Contiguity with a Force Directed Graph',
|
| 746 |
+
link: `${legacyDataVisTakeHomeBase}/show-national-contiguity-with-a-force-directed-graph`,
|
| 747 |
+
certSlug: Certification.LegacyDataVis
|
| 748 |
+
},
|
| 749 |
+
{
|
| 750 |
+
id: 'bd7108d8c242eddfaeb5bd13',
|
| 751 |
+
title: 'Map Data Across the Globe',
|
| 752 |
+
link: `${legacyDataVisTakeHomeBase}/map-data-across-the-globe`,
|
| 753 |
+
certSlug: Certification.LegacyDataVis
|
| 754 |
+
}
|
| 755 |
+
]
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
id: '561add10cb82ac38a17213bc',
|
| 759 |
+
title: 'Legacy Information Security and Quality Assurance',
|
| 760 |
+
// Keep this as information-security-and-quality-assurance
|
| 761 |
+
certSlug: Certification.LegacyInfoSecQa,
|
| 762 |
+
projects: [
|
| 763 |
+
// Keep this as information-security-and-quality-assurance
|
| 764 |
+
{
|
| 765 |
+
id: '587d8249367417b2b2512c41',
|
| 766 |
+
title: 'Metric-Imperial Converter',
|
| 767 |
+
link: `${legacyInfosecQaQaBase}/metric-imperial-converter`,
|
| 768 |
+
certSlug: Certification.LegacyInfoSecQa
|
| 769 |
+
},
|
| 770 |
+
{
|
| 771 |
+
id: '587d8249367417b2b2512c42',
|
| 772 |
+
title: 'Issue Tracker',
|
| 773 |
+
link: `${legacyInfosecQaQaBase}/issue-tracker`,
|
| 774 |
+
certSlug: Certification.LegacyInfoSecQa
|
| 775 |
+
},
|
| 776 |
+
{
|
| 777 |
+
id: '587d824a367417b2b2512c43',
|
| 778 |
+
title: 'Personal Library',
|
| 779 |
+
link: `${legacyInfosecQaQaBase}/personal-library`,
|
| 780 |
+
certSlug: Certification.LegacyInfoSecQa
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
id: '587d824a367417b2b2512c44',
|
| 784 |
+
title: 'Stock Price Checker',
|
| 785 |
+
link: `${legacyInfosecQaInfosecBase}/stock-price-checker`,
|
| 786 |
+
certSlug: Certification.LegacyInfoSecQa
|
| 787 |
+
},
|
| 788 |
+
{
|
| 789 |
+
id: '587d824a367417b2b2512c45',
|
| 790 |
+
title: 'Anonymous Message Board',
|
| 791 |
+
link: `${legacyInfosecQaInfosecBase}/anonymous-message-board`,
|
| 792 |
+
certSlug: Certification.LegacyInfoSecQa
|
| 793 |
+
}
|
| 794 |
+
]
|
| 795 |
+
},
|
| 796 |
+
{
|
| 797 |
+
id: '647f7da207d29547b3bee1ba',
|
| 798 |
+
title: 'Foundational C# with Microsoft',
|
| 799 |
+
certSlug: Certification.FoundationalCSharp,
|
| 800 |
+
projects: [
|
| 801 |
+
{
|
| 802 |
+
id: '647e22d18acb466c97ccbef8',
|
| 803 |
+
title: 'Foundational C# with Microsoft Certification Exam',
|
| 804 |
+
link: `${foundationalCSharpBase}/foundational-c-sharp-with-microsoft-certification-exam`,
|
| 805 |
+
certSlug: Certification.FoundationalCSharp
|
| 806 |
+
}
|
| 807 |
+
]
|
| 808 |
+
},
|
| 809 |
+
// Upcoming Certifications
|
| 810 |
+
{
|
| 811 |
+
id: '68db314d3c11a8bff07c7535',
|
| 812 |
+
title: 'Responsive Web Design',
|
| 813 |
+
certSlug: Certification.RespWebDesignV9,
|
| 814 |
+
projects: [
|
| 815 |
+
{
|
| 816 |
+
id: '68db37350b398ecddd1f5dac',
|
| 817 |
+
title: 'Responsive Web Design Certification Exam',
|
| 818 |
+
link: `${respWebV9Base}/exam-responsive-web-design-certification/exam-responsive-web-design-certification`,
|
| 819 |
+
certSlug: Certification.RespWebDesignV9
|
| 820 |
+
}
|
| 821 |
+
]
|
| 822 |
+
},
|
| 823 |
+
{
|
| 824 |
+
id: '68c4069c1ef859270e17c495',
|
| 825 |
+
title: 'JavaScript',
|
| 826 |
+
certSlug: Certification.JsV9,
|
| 827 |
+
projects: [
|
| 828 |
+
{
|
| 829 |
+
id: '68c462d7dc707f3ca82f8e6d',
|
| 830 |
+
title: 'JavaScript Certification Exam',
|
| 831 |
+
link: `${jsV9Base}/exam-javascript-certification/exam-javascript-certification`,
|
| 832 |
+
certSlug: Certification.JsV9
|
| 833 |
+
}
|
| 834 |
+
]
|
| 835 |
+
},
|
| 836 |
+
{
|
| 837 |
+
id: '68e008aa5f80c6099d47b3a2',
|
| 838 |
+
title: 'Front-End Development Libraries',
|
| 839 |
+
certSlug: Certification.FrontEndDevLibsV9,
|
| 840 |
+
projects: [
|
| 841 |
+
{
|
| 842 |
+
id: '68e00b355f80c6099d47b3a3',
|
| 843 |
+
title: 'Front-End Development Libraries Certification Exam',
|
| 844 |
+
link: `${frontEndDevLibsV9Base}/exam-front-end-development-libraries-certification/exam-front-end-development-libraries-certification`,
|
| 845 |
+
certSlug: Certification.FrontEndDevLibsV9
|
| 846 |
+
}
|
| 847 |
+
]
|
| 848 |
+
},
|
| 849 |
+
{
|
| 850 |
+
id: '68e6bd5020effa1586e79855',
|
| 851 |
+
title: 'Python',
|
| 852 |
+
certSlug: Certification.PythonV9,
|
| 853 |
+
projects: [
|
| 854 |
+
{
|
| 855 |
+
id: '68e6bf0320effa1586e79858',
|
| 856 |
+
title: 'Python Certification Exam',
|
| 857 |
+
link: `${pythonV9Base}/exam-python-certification/exam-python-certification`,
|
| 858 |
+
certSlug: Certification.PythonV9
|
| 859 |
+
}
|
| 860 |
+
]
|
| 861 |
+
},
|
| 862 |
+
{
|
| 863 |
+
id: '68e6bd5120effa1586e79856',
|
| 864 |
+
title: 'Relational Databases',
|
| 865 |
+
certSlug: Certification.RelationalDbV9,
|
| 866 |
+
projects: [
|
| 867 |
+
{
|
| 868 |
+
id: '68e6bf3f20effa1586e79859',
|
| 869 |
+
title: 'Relational Databases Certification Exam',
|
| 870 |
+
link: `${relationalDbV9Base}/exam-relational-databases-certification/exam-relational-databases-certification`,
|
| 871 |
+
certSlug: Certification.RelationalDbV9
|
| 872 |
+
}
|
| 873 |
+
]
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
id: '68e6bd5120effa1586e79857',
|
| 877 |
+
title: 'Back-End Development and APIs',
|
| 878 |
+
certSlug: Certification.BackEndDevApisV9,
|
| 879 |
+
projects: [
|
| 880 |
+
{
|
| 881 |
+
id: '68e6bfa120effa1586e7985a',
|
| 882 |
+
title: 'Back-End Development and APIs Certification Exam',
|
| 883 |
+
link: `${backEndDevApisV9Base}/exam-back-end-development-and-apis-certification/exam-back-end-development-and-apis-certification`,
|
| 884 |
+
certSlug: Certification.BackEndDevApisV9
|
| 885 |
+
}
|
| 886 |
+
]
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
id: '64514fda6c245de4d11eb7bb',
|
| 890 |
+
title: 'Certified Full-Stack Developer',
|
| 891 |
+
certSlug: Certification.FullStackDeveloperV9,
|
| 892 |
+
projects: [
|
| 893 |
+
{
|
| 894 |
+
id: '645147516c245de4d11eb7ba',
|
| 895 |
+
title: 'Certified Full-Stack Developer Exam',
|
| 896 |
+
link: `${fullStackDeveloperV9Base}/exam-certified-full-stack-developer/exam-certified-full-stack-developer`,
|
| 897 |
+
certSlug: Certification.FullStackDeveloperV9
|
| 898 |
+
}
|
| 899 |
+
]
|
| 900 |
+
},
|
| 901 |
+
{
|
| 902 |
+
id: '651dd7e01d697d0aab7833b7',
|
| 903 |
+
title: 'A2 English for Developers',
|
| 904 |
+
certSlug: Certification.A2English,
|
| 905 |
+
projects: [
|
| 906 |
+
{
|
| 907 |
+
id: '6721db5d9f0c116e6a0fe25a',
|
| 908 |
+
title: 'A2 English for Developers Certification Exam',
|
| 909 |
+
link: `${a2EnglishBase}/en-a2-certification-exam/en-a2-certification-exam`,
|
| 910 |
+
certSlug: Certification.A2English
|
| 911 |
+
}
|
| 912 |
+
]
|
| 913 |
+
},
|
| 914 |
+
{
|
| 915 |
+
id: '66607e53317411dd5e8aae21',
|
| 916 |
+
title: 'B1 English for Developers',
|
| 917 |
+
certSlug: Certification.B1English,
|
| 918 |
+
projects: [
|
| 919 |
+
{
|
| 920 |
+
id: '694106b87224ea1c1a9d3201',
|
| 921 |
+
title: 'B1 English for Developers Certification Exam',
|
| 922 |
+
link: `${b1EnglishBase}/en-b1-certification-exam/en-b1-certification-exam`,
|
| 923 |
+
certSlug: Certification.B1English
|
| 924 |
+
}
|
| 925 |
+
]
|
| 926 |
+
},
|
| 927 |
+
{
|
| 928 |
+
id: '681a6b22e5a782fe3459984a',
|
| 929 |
+
title: 'A2 Professional Spanish',
|
| 930 |
+
certSlug: Certification.A2Spanish,
|
| 931 |
+
projects: [
|
| 932 |
+
{
|
| 933 |
+
id: '681a8796e5a782fe3459984b',
|
| 934 |
+
title: 'Dialogue 1: PLACEHOLDER',
|
| 935 |
+
link: `${a2SpanishBase}/talk-about-who-you-are-by-using-key-verbs
|
| 936 |
+
/text-1`,
|
| 937 |
+
certSlug: Certification.A2Spanish
|
| 938 |
+
}
|
| 939 |
+
]
|
| 940 |
+
},
|
| 941 |
+
{
|
| 942 |
+
id: '682c3153086dd7cabe7f48bc',
|
| 943 |
+
title: 'A2 Professional Chinese',
|
| 944 |
+
certSlug: Certification.A2Chinese,
|
| 945 |
+
projects: [
|
| 946 |
+
{
|
| 947 |
+
id: '682c2753317b88f1ecdad894',
|
| 948 |
+
title: 'Dialogue 1: PLACEHOLDER',
|
| 949 |
+
link: `${a2ChineseBase}/talk-about-what-you-do-by-using-key-verbs
|
| 950 |
+
/text-1`,
|
| 951 |
+
certSlug: Certification.A2Chinese
|
| 952 |
+
}
|
| 953 |
+
]
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
id: '68f1268149f045a650d4229e',
|
| 957 |
+
title: 'A1 Professional Chinese',
|
| 958 |
+
certSlug: Certification.A1Chinese,
|
| 959 |
+
projects: [
|
| 960 |
+
{
|
| 961 |
+
id: '688f1daf0133dbe2a36b140b',
|
| 962 |
+
title: 'Dialogue 1: PLACEHOLDER',
|
| 963 |
+
link: `${a1ChineseBase}/learn-essential-courtesies-at-the-office
|
| 964 |
+
/text-1`,
|
| 965 |
+
certSlug: Certification.A1Chinese
|
| 966 |
+
}
|
| 967 |
+
]
|
| 968 |
+
}
|
| 969 |
+
] as const;
|
| 970 |
+
|
| 971 |
+
function getResponsiveWebDesignPath(project: string) {
|
| 972 |
+
return `${responsiveWeb22Base}/${project}-project/${project}`;
|
| 973 |
+
}
|
| 974 |
+
|
| 975 |
+
function getCollegeAlgebraPyPath(project: string) {
|
| 976 |
+
return `${collegeAlgebraPyBase}/${project}-project/${project}`;
|
| 977 |
+
}
|
| 978 |
+
|
| 979 |
+
function getJavaScriptAlgoPath(project: string) {
|
| 980 |
+
return `${jsAlgo22Base}/${project}-project/${project}`;
|
| 981 |
+
}
|
| 982 |
+
|
| 983 |
+
type FilteredCert<T, U> = T extends { certSlug: U } ? T : never;
|
| 984 |
+
|
| 985 |
+
type CurrentCert = FilteredCert<
|
| 986 |
+
(typeof allStandardCerts)[number],
|
| 987 |
+
(typeof currentCertifications)[number]
|
| 988 |
+
>;
|
| 989 |
+
|
| 990 |
+
type LegacyCert = FilteredCert<
|
| 991 |
+
(typeof allStandardCerts)[number],
|
| 992 |
+
(typeof legacyCertifications)[number]
|
| 993 |
+
>;
|
| 994 |
+
|
| 995 |
+
type UpcomingCert = FilteredCert<
|
| 996 |
+
(typeof allStandardCerts)[number],
|
| 997 |
+
(typeof upcomingCertifications)[number]
|
| 998 |
+
>;
|
| 999 |
+
|
| 1000 |
+
const currentCerts = allStandardCerts.filter((cert): cert is CurrentCert =>
|
| 1001 |
+
currentCertifications.includes(cert.certSlug)
|
| 1002 |
+
);
|
| 1003 |
+
const legacyCerts = allStandardCerts.filter((cert): cert is LegacyCert =>
|
| 1004 |
+
legacyCertifications.includes(cert.certSlug)
|
| 1005 |
+
);
|
| 1006 |
+
const upcomingCerts = allStandardCerts.filter((cert): cert is UpcomingCert =>
|
| 1007 |
+
upcomingCertifications.includes(cert.certSlug)
|
| 1008 |
+
);
|
| 1009 |
+
const liveCerts = showUpcomingChanges
|
| 1010 |
+
? [...currentCerts, ...legacyCerts, fullstackCert, ...upcomingCerts]
|
| 1011 |
+
: [...currentCerts, ...legacyCerts, fullstackCert];
|
| 1012 |
+
const allCerts = [
|
| 1013 |
+
...currentCerts,
|
| 1014 |
+
...legacyCerts,
|
| 1015 |
+
fullstackCert,
|
| 1016 |
+
...upcomingCerts
|
| 1017 |
+
];
|
| 1018 |
+
|
| 1019 |
+
type CertsToProjects = Record<
|
| 1020 |
+
(typeof allStandardCerts)[number]['certSlug'],
|
| 1021 |
+
(typeof allStandardCerts)[number]['projects']
|
| 1022 |
+
>;
|
| 1023 |
+
|
| 1024 |
+
const certsToProjects = allStandardCerts.reduce((acc, curr) => {
|
| 1025 |
+
return {
|
| 1026 |
+
...acc,
|
| 1027 |
+
[curr.certSlug]: curr.projects
|
| 1028 |
+
};
|
| 1029 |
+
}, {} as CertsToProjects);
|
| 1030 |
+
|
| 1031 |
+
export { liveCerts, certsToProjects, allCerts };
|
github_code/freeCodeCamp__freeCodeCamp/client/config/growthbook-features-default.json
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"aa-test": {
|
| 3 |
+
"defaultValue": false
|
| 4 |
+
},
|
| 5 |
+
"aa-test-in-component": {
|
| 6 |
+
"defaultValue": false
|
| 7 |
+
},
|
| 8 |
+
"rdb-codespaces-instructions": {
|
| 9 |
+
"defaultValue": true
|
| 10 |
+
},
|
| 11 |
+
"rdb-local-instructions": {
|
| 12 |
+
"defaultValue": true
|
| 13 |
+
},
|
| 14 |
+
"landing-top-skill-focused": {
|
| 15 |
+
"defaultValue": false,
|
| 16 |
+
"rules": [
|
| 17 |
+
{
|
| 18 |
+
"coverage": 1,
|
| 19 |
+
"hashAttribute": "id",
|
| 20 |
+
"seed": "landing-top-skill-focused",
|
| 21 |
+
"hashVersion": 2,
|
| 22 |
+
"variations": [
|
| 23 |
+
false,
|
| 24 |
+
true
|
| 25 |
+
],
|
| 26 |
+
"weights": [
|
| 27 |
+
0.5,
|
| 28 |
+
0.5
|
| 29 |
+
],
|
| 30 |
+
"key": "landing-top-skill-focused",
|
| 31 |
+
"meta": [
|
| 32 |
+
{
|
| 33 |
+
"key": "0",
|
| 34 |
+
"name": "Control"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"key": "1",
|
| 38 |
+
"name": "Variation 1"
|
| 39 |
+
}
|
| 40 |
+
],
|
| 41 |
+
"phase": "0",
|
| 42 |
+
"name": "tests the conversion rate of the new design comparing to the old one"
|
| 43 |
+
}
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
"replace-20-with-25": {
|
| 47 |
+
"defaultValue": false,
|
| 48 |
+
"rules": [
|
| 49 |
+
{
|
| 50 |
+
"coverage": 1,
|
| 51 |
+
"hashAttribute": "id",
|
| 52 |
+
"seed": "replace-20-with-25",
|
| 53 |
+
"hashVersion": 2,
|
| 54 |
+
"variations": [
|
| 55 |
+
false,
|
| 56 |
+
true
|
| 57 |
+
],
|
| 58 |
+
"weights": [
|
| 59 |
+
0.5,
|
| 60 |
+
0.5
|
| 61 |
+
],
|
| 62 |
+
"key": "replace-20-with-25",
|
| 63 |
+
"meta": [
|
| 64 |
+
{
|
| 65 |
+
"key": "0",
|
| 66 |
+
"name": "Control"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"key": "1",
|
| 70 |
+
"name": "Variation 1"
|
| 71 |
+
}
|
| 72 |
+
],
|
| 73 |
+
"phase": "0",
|
| 74 |
+
"name": "stg replace 20 with 25"
|
| 75 |
+
}
|
| 76 |
+
]
|
| 77 |
+
},
|
| 78 |
+
"show-modal-randomly": {
|
| 79 |
+
"defaultValue": false,
|
| 80 |
+
"rules": [
|
| 81 |
+
{
|
| 82 |
+
"coverage": 1,
|
| 83 |
+
"hashAttribute": "id",
|
| 84 |
+
"seed": "show-modal-randomly",
|
| 85 |
+
"hashVersion": 2,
|
| 86 |
+
"variations": [
|
| 87 |
+
false,
|
| 88 |
+
true
|
| 89 |
+
],
|
| 90 |
+
"weights": [
|
| 91 |
+
0.5,
|
| 92 |
+
0.5
|
| 93 |
+
],
|
| 94 |
+
"key": "show-modal-randomly",
|
| 95 |
+
"meta": [
|
| 96 |
+
{
|
| 97 |
+
"key": "0",
|
| 98 |
+
"name": "Control"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"key": "1",
|
| 102 |
+
"name": "Variation 1"
|
| 103 |
+
}
|
| 104 |
+
],
|
| 105 |
+
"phase": "0",
|
| 106 |
+
"name": "stg show modal randomly"
|
| 107 |
+
}
|
| 108 |
+
]
|
| 109 |
+
},
|
| 110 |
+
"landing-two-button-cta": {
|
| 111 |
+
"defaultValue": false,
|
| 112 |
+
"rules": [
|
| 113 |
+
{
|
| 114 |
+
"coverage": 1,
|
| 115 |
+
"hashAttribute": "id",
|
| 116 |
+
"seed": "landing-two-button-cta",
|
| 117 |
+
"hashVersion": 2,
|
| 118 |
+
"variations": [
|
| 119 |
+
false,
|
| 120 |
+
true
|
| 121 |
+
],
|
| 122 |
+
"weights": [
|
| 123 |
+
0.5,
|
| 124 |
+
0.5
|
| 125 |
+
],
|
| 126 |
+
"key": "landing-two-button-cta",
|
| 127 |
+
"meta": [
|
| 128 |
+
{
|
| 129 |
+
"key": "0",
|
| 130 |
+
"name": "Control"
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"key": "1",
|
| 134 |
+
"name": "Variation 1"
|
| 135 |
+
}
|
| 136 |
+
],
|
| 137 |
+
"phase": "0",
|
| 138 |
+
"name": "prod-landing-two-button-cta"
|
| 139 |
+
}
|
| 140 |
+
]
|
| 141 |
+
},
|
| 142 |
+
"classroom-mode": {
|
| 143 |
+
"defaultValue": false
|
| 144 |
+
},
|
| 145 |
+
"disabled_blocks": {
|
| 146 |
+
"defaultValue": []
|
| 147 |
+
},
|
| 148 |
+
"show-socrates": {
|
| 149 |
+
"defaultValue": false
|
| 150 |
+
}
|
| 151 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/config/misc.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const MAX_MOBILE_WIDTH = 767;
|
| 2 |
+
export const EX_SMALL_VIEWPORT_HEIGHT = 300;
|
| 3 |
+
export const SEARCH_EXPOSED_WIDTH = 980;
|
| 4 |
+
export const GITHUB_LOCATION = 'https://github.com/freeCodeCamp';
|
github_code/freeCodeCamp__freeCodeCamp/client/eslint.config.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
config,
|
| 3 |
+
configTypeChecked,
|
| 4 |
+
configReact,
|
| 5 |
+
configTestingLibrary,
|
| 6 |
+
jsFiles,
|
| 7 |
+
tsFiles
|
| 8 |
+
} from '@freecodecamp/eslint-config/base';
|
| 9 |
+
import globals from 'globals';
|
| 10 |
+
|
| 11 |
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
| 12 |
+
|
| 13 |
+
const baseLanguageOptions = {
|
| 14 |
+
globals: {
|
| 15 |
+
...globals.browser,
|
| 16 |
+
...globals.mocha,
|
| 17 |
+
...globals.node,
|
| 18 |
+
Promise: true,
|
| 19 |
+
window: true,
|
| 20 |
+
$: true,
|
| 21 |
+
ga: true,
|
| 22 |
+
jQuery: true,
|
| 23 |
+
router: true,
|
| 24 |
+
globalThis: true
|
| 25 |
+
}
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
const baseConfig = {
|
| 29 |
+
settings: {
|
| 30 |
+
react: {
|
| 31 |
+
version: '16.4.2'
|
| 32 |
+
},
|
| 33 |
+
|
| 34 |
+
'import/resolver': {
|
| 35 |
+
typescript: true,
|
| 36 |
+
node: true
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
|
| 40 |
+
rules: {
|
| 41 |
+
'import/no-cycle': [
|
| 42 |
+
2,
|
| 43 |
+
{
|
| 44 |
+
maxDepth: 2
|
| 45 |
+
}
|
| 46 |
+
],
|
| 47 |
+
'react/prop-types': 'off',
|
| 48 |
+
'react/jsx-no-useless-fragment': 'error'
|
| 49 |
+
}
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
// Order matters here; later configs can override settings in earlier ones.
|
| 53 |
+
export default defineConfig(
|
| 54 |
+
globalIgnores(['static', '.cache', 'public']),
|
| 55 |
+
{
|
| 56 |
+
files: jsFiles,
|
| 57 |
+
extends: [configReact, configTestingLibrary, config],
|
| 58 |
+
...baseConfig,
|
| 59 |
+
languageOptions: {
|
| 60 |
+
...baseLanguageOptions,
|
| 61 |
+
|
| 62 |
+
parserOptions: {
|
| 63 |
+
babelOptions: {
|
| 64 |
+
presets: ['@babel/preset-react'],
|
| 65 |
+
configFile: './.babelrc.js'
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
files: tsFiles,
|
| 72 |
+
extends: [configReact, configTestingLibrary, configTypeChecked],
|
| 73 |
+
...baseConfig,
|
| 74 |
+
languageOptions: {
|
| 75 |
+
...baseLanguageOptions
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
);
|
github_code/freeCodeCamp__freeCodeCamp/client/gatsby-browser.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { GatsbyBrowser } from 'gatsby';
|
| 2 |
+
import { LocationProvider } from '@gatsbyjs/reach-router';
|
| 3 |
+
import cookies from 'browser-cookies';
|
| 4 |
+
import React from 'react';
|
| 5 |
+
import { I18nextProvider } from 'react-i18next';
|
| 6 |
+
import { Provider } from 'react-redux';
|
| 7 |
+
import { Elements } from '@stripe/react-stripe-js';
|
| 8 |
+
|
| 9 |
+
import i18n from './i18n/config';
|
| 10 |
+
import { stripe } from './src/utils/stripe';
|
| 11 |
+
import AppMountNotifier from './src/components/app-mount-notifier';
|
| 12 |
+
import { createStore } from './src/redux/create-store';
|
| 13 |
+
import layoutSelector from './utils/gatsby/layout-selector';
|
| 14 |
+
import GrowthBookProvider from './src/components/growth-book/growth-book-wrapper';
|
| 15 |
+
|
| 16 |
+
const store = createStore();
|
| 17 |
+
|
| 18 |
+
export const wrapRootElement: GatsbyBrowser['wrapRootElement'] = ({
|
| 19 |
+
element
|
| 20 |
+
}) => {
|
| 21 |
+
return (
|
| 22 |
+
<LocationProvider>
|
| 23 |
+
<Provider store={store}>
|
| 24 |
+
<I18nextProvider i18n={i18n}>
|
| 25 |
+
<GrowthBookProvider>
|
| 26 |
+
<AppMountNotifier>
|
| 27 |
+
<Elements stripe={stripe}>{element}</Elements>
|
| 28 |
+
</AppMountNotifier>
|
| 29 |
+
</GrowthBookProvider>
|
| 30 |
+
</I18nextProvider>
|
| 31 |
+
</Provider>
|
| 32 |
+
</LocationProvider>
|
| 33 |
+
);
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = layoutSelector;
|
| 37 |
+
|
| 38 |
+
export const disableCorePrefetching: GatsbyBrowser['disableCorePrefetching'] =
|
| 39 |
+
() => true;
|
| 40 |
+
|
| 41 |
+
export const onRouteUpdate: GatsbyBrowser['onRouteUpdate'] = () => {
|
| 42 |
+
store.dispatch({ type: 'app.routeUpdated' });
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
export const onClientEntry: GatsbyBrowser['onClientEntry'] = () => {
|
| 46 |
+
// Letting the users' browsers expire the cookie seems to have caused issues
|
| 47 |
+
// for some users. Until we have time to investigate further, we should remove
|
| 48 |
+
// the cookie on every page load.
|
| 49 |
+
cookies.erase('csrf_token');
|
| 50 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/client/gatsby-config.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'path';
|
| 2 |
+
import type { GatsbyConfig } from 'gatsby';
|
| 3 |
+
|
| 4 |
+
import envData from './config/env.json';
|
| 5 |
+
import {
|
| 6 |
+
buildChallenges,
|
| 7 |
+
replaceChallengeNodes,
|
| 8 |
+
localeChallengesRootDir
|
| 9 |
+
} from './utils/build-challenges';
|
| 10 |
+
import { pathPrefix } from './utils/gatsby/path-prefix';
|
| 11 |
+
|
| 12 |
+
const { homeLocation } = envData;
|
| 13 |
+
|
| 14 |
+
const config: GatsbyConfig = {
|
| 15 |
+
flags: {
|
| 16 |
+
DEV_SSR: false
|
| 17 |
+
},
|
| 18 |
+
trailingSlash: 'ignore',
|
| 19 |
+
siteMetadata: {
|
| 20 |
+
title: 'freeCodeCamp',
|
| 21 |
+
siteUrl: homeLocation
|
| 22 |
+
},
|
| 23 |
+
pathPrefix: pathPrefix,
|
| 24 |
+
plugins: [
|
| 25 |
+
'gatsby-plugin-pnpm-gatsby-5',
|
| 26 |
+
{
|
| 27 |
+
resolve: 'gatsby-plugin-webpack-bundle-analyser-v2',
|
| 28 |
+
options: {
|
| 29 |
+
analyzerMode: 'disabled',
|
| 30 |
+
// It doesn't matter if the file is generated or not as far as caching
|
| 31 |
+
// is concerned. It doesn't affect any tasks in any way, so we can
|
| 32 |
+
// ignore it.
|
| 33 |
+
|
| 34 |
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
| 35 |
+
generateStatsFile: process.env.CI
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
'gatsby-plugin-react-helmet',
|
| 39 |
+
{
|
| 40 |
+
resolve: 'gatsby-plugin-postcss',
|
| 41 |
+
options: {
|
| 42 |
+
postcssOptions: {
|
| 43 |
+
config: path.resolve(__dirname, 'postcss.config.js')
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
resolve: path.resolve(
|
| 49 |
+
__dirname,
|
| 50 |
+
'../tools/client-plugins/gatsby-source-challenges'
|
| 51 |
+
),
|
| 52 |
+
options: {
|
| 53 |
+
name: 'challenges',
|
| 54 |
+
source: buildChallenges,
|
| 55 |
+
onSourceChange: replaceChallengeNodes(),
|
| 56 |
+
curriculumPath: localeChallengesRootDir
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
'gatsby-plugin-remove-serviceworker',
|
| 60 |
+
{
|
| 61 |
+
resolve: 'gatsby-plugin-schema-snapshot',
|
| 62 |
+
options: {
|
| 63 |
+
path: 'schema.gql',
|
| 64 |
+
update: process.env.GATSBY_UPDATE_SCHEMA_SNAPSHOT === 'true'
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
]
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
export default config;
|
github_code/freeCodeCamp__freeCodeCamp/client/gatsby-node.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
| 2 |
+
|
| 3 |
+
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
| 4 |
+
|
| 5 |
+
const env = require('./config/env.json');
|
| 6 |
+
const { createSuperBlockIntroPages } = require('./utils/gatsby');
|
| 7 |
+
|
| 8 |
+
exports.createPages = async function createPages({
|
| 9 |
+
actions,
|
| 10 |
+
graphql,
|
| 11 |
+
reporter
|
| 12 |
+
}: any) {
|
| 13 |
+
if (!env.algoliaAPIKey || !env.algoliaAppId) {
|
| 14 |
+
if (process.env.FREECODECAMP_NODE_ENV === 'production') {
|
| 15 |
+
throw new Error(
|
| 16 |
+
'Algolia App id and API key are required to start the client!'
|
| 17 |
+
);
|
| 18 |
+
} else {
|
| 19 |
+
reporter.info(
|
| 20 |
+
'Algolia keys missing or invalid. Required for search to yield results.'
|
| 21 |
+
);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
if (!env.stripePublicKey) {
|
| 26 |
+
if (process.env.FREECODECAMP_NODE_ENV === 'production') {
|
| 27 |
+
throw new Error('Stripe public key is required to start the client!');
|
| 28 |
+
} else {
|
| 29 |
+
reporter.info(
|
| 30 |
+
'Stripe public key is missing or invalid. Required for Stripe integration.'
|
| 31 |
+
);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
const { createPage } = actions;
|
| 36 |
+
|
| 37 |
+
const result = await graphql(`
|
| 38 |
+
{
|
| 39 |
+
allSuperBlockStructure {
|
| 40 |
+
nodes {
|
| 41 |
+
superBlock
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
`);
|
| 46 |
+
|
| 47 |
+
if (result.errors) {
|
| 48 |
+
reporter.panic('createPages GraphQL query failed', result.errors);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
const {
|
| 52 |
+
data: { allSuperBlockStructure }
|
| 53 |
+
} = result;
|
| 54 |
+
|
| 55 |
+
const superBlocks = allSuperBlockStructure.nodes.map(
|
| 56 |
+
(node: { superBlock: string }) => node.superBlock
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
superBlocks.forEach((superBlock: string) => {
|
| 60 |
+
createSuperBlockIntroPages(createPage)({ superBlock });
|
| 61 |
+
});
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
exports.onCreateWebpackConfig = ({ stage, actions, plugins }: any) => {
|
| 65 |
+
const newPlugins = [
|
| 66 |
+
// We add the shims of the node globals to the global scope
|
| 67 |
+
plugins.provide({
|
| 68 |
+
Buffer: ['buffer', 'Buffer']
|
| 69 |
+
}),
|
| 70 |
+
plugins.provide({
|
| 71 |
+
process: 'process/browser'
|
| 72 |
+
})
|
| 73 |
+
];
|
| 74 |
+
|
| 75 |
+
// The monaco editor relies on some browser only globals so should not be
|
| 76 |
+
// involved in SSR. Also, if the plugin is used during the 'build-html' or
|
| 77 |
+
// 'develop-html' stage it overwrites the minfied files with ordinary ones.
|
| 78 |
+
|
| 79 |
+
if (stage !== 'build-html' && stage !== 'develop-html') {
|
| 80 |
+
newPlugins.push(
|
| 81 |
+
new MonacoWebpackPlugin({
|
| 82 |
+
filename: '[name].worker-[contenthash].js'
|
| 83 |
+
})
|
| 84 |
+
);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
actions.setWebpackConfig({
|
| 88 |
+
resolve: {
|
| 89 |
+
fallback: {
|
| 90 |
+
fs: false,
|
| 91 |
+
path: 'path-browserify',
|
| 92 |
+
assert: 'assert',
|
| 93 |
+
crypto: 'crypto-browserify',
|
| 94 |
+
util: 'util/util',
|
| 95 |
+
buffer: 'buffer',
|
| 96 |
+
stream: 'stream-browserify',
|
| 97 |
+
process: 'process/browser',
|
| 98 |
+
url: 'url'
|
| 99 |
+
}
|
| 100 |
+
},
|
| 101 |
+
plugins: newPlugins,
|
| 102 |
+
ignoreWarnings: [
|
| 103 |
+
(warning: Error) => {
|
| 104 |
+
if (warning instanceof Error) {
|
| 105 |
+
if (warning.message.includes('mini-css-extract-plugin')) {
|
| 106 |
+
return true;
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
return false;
|
| 110 |
+
}
|
| 111 |
+
]
|
| 112 |
+
});
|
| 113 |
+
};
|
| 114 |
+
|
| 115 |
+
exports.onCreateBabelConfig = ({ actions }: any) => {
|
| 116 |
+
actions.setBabelPlugin({
|
| 117 |
+
name: '@babel/plugin-proposal-function-bind'
|
| 118 |
+
});
|
| 119 |
+
|
| 120 |
+
actions.setBabelPlugin({
|
| 121 |
+
name: '@babel/plugin-proposal-export-default-from'
|
| 122 |
+
});
|
| 123 |
+
};
|
| 124 |
+
|
| 125 |
+
exports.createSchemaCustomization = ({ actions }: any) => {
|
| 126 |
+
const { createTypes } = actions;
|
| 127 |
+
|
| 128 |
+
// This hook is supported by the test runner, but is not currently used by the
|
| 129 |
+
// client, so we have to tell Gatsby that it exists.
|
| 130 |
+
const typeDefs = `
|
| 131 |
+
type ChallengeNodeChallengeHooks {
|
| 132 |
+
afterEach: String
|
| 133 |
+
}
|
| 134 |
+
`;
|
| 135 |
+
|
| 136 |
+
createTypes(typeDefs);
|
| 137 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/client/gatsby-ssr.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { GatsbySSR } from 'gatsby';
|
| 2 |
+
import React from 'react';
|
| 3 |
+
import { I18nextProvider } from 'react-i18next';
|
| 4 |
+
import { Provider } from 'react-redux';
|
| 5 |
+
import { Elements } from '@stripe/react-stripe-js';
|
| 6 |
+
|
| 7 |
+
import i18n from './i18n/config';
|
| 8 |
+
import { stripe } from './src/utils/stripe';
|
| 9 |
+
import { createStore } from './src/redux/create-store';
|
| 10 |
+
import layoutSelector from './utils/gatsby/layout-selector';
|
| 11 |
+
import { webmanifestComponents } from './src/components/webmanifest';
|
| 12 |
+
import {
|
| 13 |
+
getheadTagComponents,
|
| 14 |
+
getPostBodyComponents,
|
| 15 |
+
getPreBodyThemeScript
|
| 16 |
+
} from './utils/tags';
|
| 17 |
+
import GrowthBookProvider from './src/components/growth-book/growth-book-wrapper';
|
| 18 |
+
|
| 19 |
+
const store = createStore();
|
| 20 |
+
|
| 21 |
+
export const wrapRootElement: GatsbySSR['wrapRootElement'] = ({ element }) => {
|
| 22 |
+
return (
|
| 23 |
+
<Provider store={store}>
|
| 24 |
+
<I18nextProvider i18n={i18n}>
|
| 25 |
+
<GrowthBookProvider>
|
| 26 |
+
<Elements stripe={stripe}>{element}</Elements>
|
| 27 |
+
</GrowthBookProvider>
|
| 28 |
+
</I18nextProvider>
|
| 29 |
+
</Provider>
|
| 30 |
+
);
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
export const wrapPageElement: GatsbySSR['wrapPageElement'] = layoutSelector;
|
| 34 |
+
|
| 35 |
+
export const onRenderBody: GatsbySSR['onRenderBody'] = ({
|
| 36 |
+
pathname,
|
| 37 |
+
setHeadComponents,
|
| 38 |
+
setPreBodyComponents,
|
| 39 |
+
setPostBodyComponents
|
| 40 |
+
}) => {
|
| 41 |
+
setHeadComponents([...getheadTagComponents(), ...webmanifestComponents]);
|
| 42 |
+
setPreBodyComponents(getPreBodyThemeScript());
|
| 43 |
+
setPostBodyComponents(getPostBodyComponents(pathname));
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
export const onPreRenderHTML: GatsbySSR['onPreRenderHTML'] = ({
|
| 47 |
+
getHeadComponents,
|
| 48 |
+
replaceHeadComponents
|
| 49 |
+
}) => {
|
| 50 |
+
const isBootstrapScript = (key: React.Key | null) =>
|
| 51 |
+
key === 'bootstrap-min-preload' || key === 'bootstrap-min';
|
| 52 |
+
|
| 53 |
+
const headComponents = getHeadComponents();
|
| 54 |
+
headComponents.sort((x, y) => {
|
| 55 |
+
const xKey = React.isValidElement(x) ? x.key : null;
|
| 56 |
+
const yKey = React.isValidElement(y) ? y.key : null;
|
| 57 |
+
|
| 58 |
+
if (isBootstrapScript(xKey)) {
|
| 59 |
+
return -1;
|
| 60 |
+
} else if (isBootstrapScript(yKey)) {
|
| 61 |
+
return 1;
|
| 62 |
+
}
|
| 63 |
+
return 0;
|
| 64 |
+
});
|
| 65 |
+
replaceHeadComponents(headComponents);
|
| 66 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/config-for-tests.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import i18n from 'i18next';
|
| 2 |
+
import { initReactI18next } from 'react-i18next';
|
| 3 |
+
|
| 4 |
+
i18n
|
| 5 |
+
.use(initReactI18next)
|
| 6 |
+
.init({
|
| 7 |
+
debug: true,
|
| 8 |
+
defaultNS: 'translations',
|
| 9 |
+
fallbackLng: 'en',
|
| 10 |
+
interpolation: {
|
| 11 |
+
escapeValue: false
|
| 12 |
+
},
|
| 13 |
+
lng: 'en',
|
| 14 |
+
ns: ['intro', 'translations'],
|
| 15 |
+
resources: { en: { intro: {}, translations: {} } },
|
| 16 |
+
returnNull: false
|
| 17 |
+
})
|
| 18 |
+
.catch((error: Error) => {
|
| 19 |
+
throw Error(error.message);
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
export default i18n;
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/config.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* global preval */
|
| 2 |
+
|
| 3 |
+
import i18n from 'i18next';
|
| 4 |
+
import { initReactI18next } from 'react-i18next';
|
| 5 |
+
import { i18nextCodes } from '@freecodecamp/shared/config/i18n';
|
| 6 |
+
|
| 7 |
+
import translations from './locales/english/translations.json';
|
| 8 |
+
import trending from './locales/english/trending.json';
|
| 9 |
+
import intro from './locales/english/intro.json';
|
| 10 |
+
import metaTags from './locales/english/meta-tags.json';
|
| 11 |
+
import links from './locales/english/links.json';
|
| 12 |
+
import searchBar from './locales/english/search-bar.json';
|
| 13 |
+
|
| 14 |
+
import envData from '../config/env.json';
|
| 15 |
+
|
| 16 |
+
const { clientLocale } = envData;
|
| 17 |
+
|
| 18 |
+
const i18nextCode = i18nextCodes[clientLocale];
|
| 19 |
+
|
| 20 |
+
// Non-english locale resources are loaded via preval so that webpack only
|
| 21 |
+
// bundles the single locale selected by CLIENT_LOCALE and the english fallback.
|
| 22 |
+
// For english the preval returns undefined, so webpack will not bundle the
|
| 23 |
+
// english resources twice.
|
| 24 |
+
i18n.use(initReactI18next).init({
|
| 25 |
+
fallbackLng: 'en',
|
| 26 |
+
lng: i18nextCode,
|
| 27 |
+
resources: {
|
| 28 |
+
[i18nextCode]: {
|
| 29 |
+
translations: preval`
|
| 30 |
+
const { clientLocale } = require('../config/env.json');
|
| 31 |
+
if (clientLocale !== 'english') {
|
| 32 |
+
module.exports = require('./locales/' + clientLocale + '/translations.json');
|
| 33 |
+
}
|
| 34 |
+
`,
|
| 35 |
+
trending: preval`
|
| 36 |
+
const { clientLocale } = require('../config/env.json');
|
| 37 |
+
if (clientLocale !== 'english') {
|
| 38 |
+
module.exports = require('./locales/' + clientLocale + '/trending.json');
|
| 39 |
+
}
|
| 40 |
+
`,
|
| 41 |
+
intro: preval`
|
| 42 |
+
const { clientLocale } = require('../config/env.json');
|
| 43 |
+
if (clientLocale !== 'english') {
|
| 44 |
+
module.exports = require('./locales/' + clientLocale + '/intro.json');
|
| 45 |
+
}
|
| 46 |
+
`,
|
| 47 |
+
metaTags: preval`
|
| 48 |
+
const { clientLocale } = require('../config/env.json');
|
| 49 |
+
if (clientLocale !== 'english') {
|
| 50 |
+
module.exports = require('./locales/' + clientLocale + '/meta-tags.json');
|
| 51 |
+
}
|
| 52 |
+
`,
|
| 53 |
+
links: preval`
|
| 54 |
+
const { clientLocale } = require('../config/env.json');
|
| 55 |
+
if (clientLocale !== 'english') {
|
| 56 |
+
module.exports = require('./locales/' + clientLocale + '/links.json');
|
| 57 |
+
}
|
| 58 |
+
`,
|
| 59 |
+
'search-bar': preval`
|
| 60 |
+
const { clientLocale } = require('../config/env.json');
|
| 61 |
+
if (clientLocale !== 'english') {
|
| 62 |
+
module.exports = require('./locales/' + clientLocale + '/search-bar.json');
|
| 63 |
+
}
|
| 64 |
+
`
|
| 65 |
+
},
|
| 66 |
+
en: {
|
| 67 |
+
translations,
|
| 68 |
+
trending,
|
| 69 |
+
intro,
|
| 70 |
+
metaTags,
|
| 71 |
+
links,
|
| 72 |
+
'search-bar': searchBar
|
| 73 |
+
}
|
| 74 |
+
},
|
| 75 |
+
ns: ['translations', 'trending', 'intro', 'metaTags', 'links', 'search-bar'],
|
| 76 |
+
defaultNS: 'translations',
|
| 77 |
+
returnObjects: true,
|
| 78 |
+
// Uncomment the next line for debug logging
|
| 79 |
+
// debug: true,
|
| 80 |
+
interpolation: {
|
| 81 |
+
escapeValue: false
|
| 82 |
+
},
|
| 83 |
+
react: {
|
| 84 |
+
useSuspense: true
|
| 85 |
+
},
|
| 86 |
+
returnNull: false
|
| 87 |
+
});
|
| 88 |
+
|
| 89 |
+
i18n.languages = clientLocale;
|
| 90 |
+
|
| 91 |
+
export default i18n;
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales.test.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { dirname } from 'path';
|
| 2 |
+
import { fileURLToPath } from 'url';
|
| 3 |
+
|
| 4 |
+
import { describe, test, expect } from 'vitest';
|
| 5 |
+
|
| 6 |
+
import {
|
| 7 |
+
availableLangs,
|
| 8 |
+
LangNames,
|
| 9 |
+
LangCodes
|
| 10 |
+
} from '@freecodecamp/shared/config/i18n';
|
| 11 |
+
import {
|
| 12 |
+
SuperBlocks,
|
| 13 |
+
superBlockStages,
|
| 14 |
+
SuperBlockStage
|
| 15 |
+
} from '@freecodecamp/shared/config/curriculum';
|
| 16 |
+
import { getCurriculum } from '../tools/get-curriculum';
|
| 17 |
+
import intro from './locales/english/intro.json';
|
| 18 |
+
|
| 19 |
+
interface Intro {
|
| 20 |
+
[key: string]: {
|
| 21 |
+
title: string;
|
| 22 |
+
summary?: string[];
|
| 23 |
+
intro: string[];
|
| 24 |
+
blocks: {
|
| 25 |
+
[block: string]: {
|
| 26 |
+
title: string;
|
| 27 |
+
intro: string[];
|
| 28 |
+
};
|
| 29 |
+
};
|
| 30 |
+
};
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
const __filename = fileURLToPath(import.meta.url);
|
| 34 |
+
const __dirname = dirname(__filename);
|
| 35 |
+
|
| 36 |
+
describe('Locale tests:', () => {
|
| 37 |
+
availableLangs.client.forEach(lang => {
|
| 38 |
+
describe(`-- ${lang} --`, () => {
|
| 39 |
+
test(`has an entry in the langDisplayNames enum`, () => {
|
| 40 |
+
expect(
|
| 41 |
+
Object.keys(LangNames)
|
| 42 |
+
.map(langCode => langCode.toLowerCase())
|
| 43 |
+
.includes(lang)
|
| 44 |
+
).toBe(true);
|
| 45 |
+
});
|
| 46 |
+
|
| 47 |
+
test(`has an entry in the langCodes enum`, () => {
|
| 48 |
+
expect(
|
| 49 |
+
Object.keys(LangCodes)
|
| 50 |
+
.map(langCode => langCode.toLowerCase())
|
| 51 |
+
.includes(lang)
|
| 52 |
+
).toBe(true);
|
| 53 |
+
});
|
| 54 |
+
});
|
| 55 |
+
});
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
describe('Intro file structure tests:', () => {
|
| 59 |
+
const typedIntro = intro as unknown as Intro;
|
| 60 |
+
const superblocks = Object.values(SuperBlocks);
|
| 61 |
+
const catalogSuperBlocks = superBlockStages[SuperBlockStage.Catalog];
|
| 62 |
+
for (const superBlock of superblocks) {
|
| 63 |
+
test(`superBlock ${superBlock} has required properties`, () => {
|
| 64 |
+
expect(typeof typedIntro[superBlock].title).toBe('string');
|
| 65 |
+
|
| 66 |
+
// catalog superblocks should have a summary
|
| 67 |
+
expect(
|
| 68 |
+
!catalogSuperBlocks.includes(superBlock) ||
|
| 69 |
+
Array.isArray(typedIntro[superBlock].summary)
|
| 70 |
+
).toBe(true);
|
| 71 |
+
|
| 72 |
+
expect(typedIntro[superBlock].intro).toBeInstanceOf(Array);
|
| 73 |
+
expect(typedIntro[superBlock].blocks).toBeInstanceOf(Object);
|
| 74 |
+
const blocks = Object.keys(typedIntro[superBlock].blocks);
|
| 75 |
+
blocks.forEach(block => {
|
| 76 |
+
expect(typeof typedIntro[superBlock].blocks[block].title).toBe(
|
| 77 |
+
'string'
|
| 78 |
+
);
|
| 79 |
+
expect(typedIntro[superBlock].blocks[block].intro).toBeInstanceOf(
|
| 80 |
+
Array
|
| 81 |
+
);
|
| 82 |
+
});
|
| 83 |
+
});
|
| 84 |
+
}
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
type SuperBlockInfo = {
|
| 88 |
+
blocks: Record<string, unknown>;
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
describe('Curriculum validation', () => {
|
| 92 |
+
const curriculum = getCurriculum() as Record<string, SuperBlockInfo>;
|
| 93 |
+
// certifications are not superblocks, they're just mixed in with them.
|
| 94 |
+
const superblocks = Object.entries(curriculum).filter(
|
| 95 |
+
([key]) => key !== 'certifications'
|
| 96 |
+
);
|
| 97 |
+
|
| 98 |
+
// It's important that we check that each block in the curriculum has a title
|
| 99 |
+
// in the intro, rather than the other way around, because the intro must
|
| 100 |
+
// include upcoming changes. The curriculum only does if SHOW_UPCOMING_CHANGES
|
| 101 |
+
// is true.
|
| 102 |
+
superblocks.forEach(superblock => {
|
| 103 |
+
const [name, superBlockInfo] = superblock;
|
| 104 |
+
const blockObject = superBlockInfo.blocks;
|
| 105 |
+
describe(`${name}`, () => {
|
| 106 |
+
test('should have titles for each block in intro.json', () => {
|
| 107 |
+
const blocks = Object.keys(blockObject);
|
| 108 |
+
|
| 109 |
+
blocks.forEach(block => {
|
| 110 |
+
const blockFromIntro = (intro as unknown as Intro)[superblock[0]]
|
| 111 |
+
.blocks[block];
|
| 112 |
+
expect(
|
| 113 |
+
blockFromIntro.title,
|
| 114 |
+
`block ${block} needs a non-empty title`
|
| 115 |
+
).toBeTruthy();
|
| 116 |
+
});
|
| 117 |
+
});
|
| 118 |
+
});
|
| 119 |
+
});
|
| 120 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/arabic/links.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://cdn.freecodecamp.org/non-profit-docs/freeCodeCamp-determination-letter.pdf",
|
| 18 |
+
"download-990-url": "https://cdn.freecodecamp.org/non-profit-docs/freeCodeCamp-2019-f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp",
|
| 20 |
+
"one-time-external-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#how-can-i-make-a-one-time-donation",
|
| 21 |
+
"mail-check-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#can-i-mail-a-physical-check"
|
| 22 |
+
},
|
| 23 |
+
"nav": {
|
| 24 |
+
"contribute": "https://contribute.freecodecamp.org/#/",
|
| 25 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 26 |
+
"news": "https://freecodecamp.org/news/",
|
| 27 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 28 |
+
},
|
| 29 |
+
"help": {
|
| 30 |
+
"HTML-CSS": "programming/html-css",
|
| 31 |
+
"JavaScript": "programming/javascript",
|
| 32 |
+
"Python": "programming/python",
|
| 33 |
+
"Backend Development": "programming/backend-development",
|
| 34 |
+
"C-Sharp": "programming/c-sharp",
|
| 35 |
+
"English": "world-languages/english",
|
| 36 |
+
"Spanish Curriculum": "world-languages/spanish-curriculum",
|
| 37 |
+
"Chinese Curriculum": "world-languages/chinese-curriculum",
|
| 38 |
+
"Odin": "programming/the-odin-project",
|
| 39 |
+
"Euler": "programming/project-euler",
|
| 40 |
+
"Rosetta": "programming/rosetta-code",
|
| 41 |
+
"General": "General"
|
| 42 |
+
}
|
| 43 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/chinese-traditional/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://chinese.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://chinese.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://chinese.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://chinese.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://chinese.freecodecamp.org/news/how-to-donate-to-free-code-camp/",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/chinese/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://chinese.freecodecamp.org/news/",
|
| 25 |
+
"podcast": "open.spotify.com/show/3dIVV6XRRPMs75z2xDtsOg?si=Ugm6rwlcTgiEJ1Udw9WzVQ"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/chinese/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://chinese.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://chinese.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://chinese.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://chinese.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://chinese.freecodecamp.org/news/how-to-donate-to-free-code-camp/",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/chinese/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://chinese.freecodecamp.org/news/",
|
| 25 |
+
"podcast": "open.spotify.com/show/3dIVV6XRRPMs75z2xDtsOg?si=Ugm6rwlcTgiEJ1Udw9WzVQ"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/intro.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/links.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://cdn.freecodecamp.org/non-profit-docs/freeCodeCamp-determination-letter.pdf",
|
| 18 |
+
"download-990-url": "https://cdn.freecodecamp.org/non-profit-docs/freeCodeCamp-2019-f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp",
|
| 20 |
+
"one-time-external-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#how-can-i-make-a-one-time-donation",
|
| 21 |
+
"mail-check-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#can-i-mail-a-physical-check"
|
| 22 |
+
},
|
| 23 |
+
"nav": {
|
| 24 |
+
"contribute": "https://contribute.freecodecamp.org/#/",
|
| 25 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 26 |
+
"news": "https://freecodecamp.org/news/",
|
| 27 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 28 |
+
},
|
| 29 |
+
"help": {
|
| 30 |
+
"HTML-CSS": "curriculum-help",
|
| 31 |
+
"JavaScript": "curriculum-help",
|
| 32 |
+
"Python": "curriculum-help",
|
| 33 |
+
"Backend Development": "curriculum-help",
|
| 34 |
+
"C-Sharp": "curriculum-help",
|
| 35 |
+
"English": "curriculum-help",
|
| 36 |
+
"Spanish Curriculum": "curriculum-help",
|
| 37 |
+
"Chinese Curriculum": "curriculum-help",
|
| 38 |
+
"Odin": "curriculum-help",
|
| 39 |
+
"Euler": "curriculum-help",
|
| 40 |
+
"Rosetta": "curriculum-help",
|
| 41 |
+
"General": "curriculum-help"
|
| 42 |
+
}
|
| 43 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/meta-tags.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"title": "Learn to Code for Free. Coding Courses & Certifications | freeCodeCamp",
|
| 3 |
+
"description": "Learn to Code for Free",
|
| 4 |
+
"social-description": "Learn to Code for Free",
|
| 5 |
+
"keywords": [
|
| 6 |
+
"python",
|
| 7 |
+
"javascript",
|
| 8 |
+
"js",
|
| 9 |
+
"git",
|
| 10 |
+
"github",
|
| 11 |
+
"website",
|
| 12 |
+
"web",
|
| 13 |
+
"development",
|
| 14 |
+
"free",
|
| 15 |
+
"code",
|
| 16 |
+
"camp",
|
| 17 |
+
"course",
|
| 18 |
+
"courses",
|
| 19 |
+
"html",
|
| 20 |
+
"css",
|
| 21 |
+
"react",
|
| 22 |
+
"redux",
|
| 23 |
+
"api",
|
| 24 |
+
"front",
|
| 25 |
+
"back",
|
| 26 |
+
"end",
|
| 27 |
+
"learn",
|
| 28 |
+
"tutorial",
|
| 29 |
+
"programming"
|
| 30 |
+
],
|
| 31 |
+
"youre-unsubscribed": "You have been unsubscribed"
|
| 32 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/motivation.json
ADDED
|
@@ -0,0 +1,891 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compliments": [
|
| 3 |
+
"Over the top!",
|
| 4 |
+
"Down the rabbit hole we go!",
|
| 5 |
+
"Bring that rain!",
|
| 6 |
+
"Target acquired.",
|
| 7 |
+
"Feel that need for speed!",
|
| 8 |
+
"You've got guts!",
|
| 9 |
+
"We have liftoff!",
|
| 10 |
+
"To infinity and beyond!",
|
| 11 |
+
"Encore!",
|
| 12 |
+
"Onward!",
|
| 13 |
+
"Challenge destroyed!",
|
| 14 |
+
"It's on like Donkey Kong!",
|
| 15 |
+
"Power level? It's over 9000!",
|
| 16 |
+
"Coding spree!",
|
| 17 |
+
"Code long and prosper.",
|
| 18 |
+
"The crowd goes wild!",
|
| 19 |
+
"One for the Guinness book!",
|
| 20 |
+
"Flawless victory!",
|
| 21 |
+
"Most efficient!",
|
| 22 |
+
"You've got the touch!",
|
| 23 |
+
"You're on fire!",
|
| 24 |
+
"The town is now red!",
|
| 25 |
+
"To the nines!",
|
| 26 |
+
"To the Batmobile!",
|
| 27 |
+
"Pull out all the stops!",
|
| 28 |
+
"You're a wizard, Harry!",
|
| 29 |
+
"You're an all star!",
|
| 30 |
+
"Way to go!",
|
| 31 |
+
"Outta sight!",
|
| 32 |
+
"You're crushing it!",
|
| 33 |
+
"What sorcery is this?",
|
| 34 |
+
"The world rejoices!",
|
| 35 |
+
"That's the way it's done!",
|
| 36 |
+
"You rock!",
|
| 37 |
+
"Woo-hoo!",
|
| 38 |
+
"We knew you could do it!",
|
| 39 |
+
"Hyper Combo Finish!",
|
| 40 |
+
"Nothing but net!",
|
| 41 |
+
"Boom-shakalaka!",
|
| 42 |
+
"You're a shooting star!",
|
| 43 |
+
"You're unstoppable!",
|
| 44 |
+
"Way cool!",
|
| 45 |
+
"Walk on that sunshine!",
|
| 46 |
+
"Keep on trucking!",
|
| 47 |
+
"Off the charts!",
|
| 48 |
+
"There is no spoon!",
|
| 49 |
+
"Cranked it up to 11!",
|
| 50 |
+
"Escape velocity reached!",
|
| 51 |
+
"You make this look easy!",
|
| 52 |
+
"Passed with flying colors!",
|
| 53 |
+
"You've got this!",
|
| 54 |
+
"Happy, happy, joy, joy!",
|
| 55 |
+
"Tomorrow, the world!",
|
| 56 |
+
"Your powers combined!",
|
| 57 |
+
"It's alive. It's alive!",
|
| 58 |
+
"Sonic Boom!",
|
| 59 |
+
"Here's looking at you, Code!",
|
| 60 |
+
"Ride like the wind!",
|
| 61 |
+
"Legen - wait for it - dary!",
|
| 62 |
+
"Ludicrous Speed! Go!",
|
| 63 |
+
"Most triumphant!",
|
| 64 |
+
"One loop to rule them all!",
|
| 65 |
+
"By the power of Grayskull!",
|
| 66 |
+
"You did it!",
|
| 67 |
+
"Storm that castle!",
|
| 68 |
+
"Face-melting guitar solo!",
|
| 69 |
+
"Checkmate!",
|
| 70 |
+
"Bodacious!",
|
| 71 |
+
"Tubular!",
|
| 72 |
+
"You're outta sight!",
|
| 73 |
+
"Keep calm and code on!",
|
| 74 |
+
"Even sad panda smiles!",
|
| 75 |
+
"Even grumpy cat approves!",
|
| 76 |
+
"Kool Aid Man says oh yeah!",
|
| 77 |
+
"Bullseye!",
|
| 78 |
+
"Far out!",
|
| 79 |
+
"You're heating up!",
|
| 80 |
+
"Standing ovation!",
|
| 81 |
+
"Nice one!",
|
| 82 |
+
"All right!",
|
| 83 |
+
"Hasta la vista, challenge!",
|
| 84 |
+
"Terminated.",
|
| 85 |
+
"Off the hook!",
|
| 86 |
+
"Thundercats, Hooo!",
|
| 87 |
+
"Shiver me timbers!",
|
| 88 |
+
"Raise the roof!",
|
| 89 |
+
"Bingo!",
|
| 90 |
+
"Even Honey Badger cares!",
|
| 91 |
+
"Helm, Warp Nine. Engage!",
|
| 92 |
+
"Gotta code 'em all!",
|
| 93 |
+
"Spool up the FTL drive!",
|
| 94 |
+
"Cool beans!",
|
| 95 |
+
"They're in another castle.",
|
| 96 |
+
"Power UP!",
|
| 97 |
+
"Pikachu chooses you!",
|
| 98 |
+
"I gotta have more cowbell.",
|
| 99 |
+
"Gotta go fast!",
|
| 100 |
+
"Yippee!",
|
| 101 |
+
"Cowabunga!",
|
| 102 |
+
"Moon Prism Power!",
|
| 103 |
+
"Plus Ultra!",
|
| 104 |
+
"Everything's coming up Milhouse!",
|
| 105 |
+
"King of the Pirates!",
|
| 106 |
+
"Thunder Breathing First Form!",
|
| 107 |
+
"It's time to duel!",
|
| 108 |
+
"You better believe it!",
|
| 109 |
+
"Do a barrel roll!",
|
| 110 |
+
"You can do this all day!",
|
| 111 |
+
"It's super effective!",
|
| 112 |
+
"This is the way!",
|
| 113 |
+
"You're king of the world!",
|
| 114 |
+
"It's morphin' time!",
|
| 115 |
+
"Just keep swimming!",
|
| 116 |
+
"You are the one who knocks!",
|
| 117 |
+
"Inconceivable!",
|
| 118 |
+
"Great Scott!",
|
| 119 |
+
"By Grabthar's hammer!",
|
| 120 |
+
"Get to the choppa!",
|
| 121 |
+
"It's clobberin' time!",
|
| 122 |
+
"Somebody stop me!",
|
| 123 |
+
"Oh, hi Mark!",
|
| 124 |
+
"Groovy!",
|
| 125 |
+
"The Dude abides!",
|
| 126 |
+
"Are you not entertained?",
|
| 127 |
+
"There can be only one!",
|
| 128 |
+
"You are the danger!",
|
| 129 |
+
"You know kung fu!",
|
| 130 |
+
"Elementary, my dear Watson!",
|
| 131 |
+
"Maximum effort!"
|
| 132 |
+
],
|
| 133 |
+
"motivationalQuotes": [
|
| 134 |
+
{
|
| 135 |
+
"quote": "Whatever you are, be a good one.",
|
| 136 |
+
"author": "Abraham Lincoln"
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"quote": "A change in perspective is worth 80 IQ points.",
|
| 140 |
+
"author": "Alan Kay"
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"quote": "The best way to predict the future is to invent it.",
|
| 144 |
+
"author": "Alan Kay"
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"quote": "The future is not laid out on a track. It is something that we can decide, and to the extent that we do not violate any known laws of the universe, we can probably make it work the way that we want to.",
|
| 148 |
+
"author": "Alan Kay"
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"quote": "We can only see a short distance ahead, but we can see plenty there that needs to be done.",
|
| 152 |
+
"author": "Alan Turing"
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"quote": "In the depth of winter, I finally learned that within me there lay an invincible summer.",
|
| 156 |
+
"author": "Albert Camus"
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"quote": "A person who never made a mistake never tried anything new.",
|
| 160 |
+
"author": "Albert Einstein"
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"quote": "Creativity is intelligence having fun.",
|
| 164 |
+
"author": "Albert Einstein"
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"quote": "I have no special talents. I am only passionately curious.",
|
| 168 |
+
"author": "Albert Einstein"
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"quote": "Life is like riding a bicycle. To keep your balance, you must keep moving.",
|
| 172 |
+
"author": "Albert Einstein"
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"quote": "Make everything as simple as possible, but not simpler.",
|
| 176 |
+
"author": "Albert Einstein"
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"quote": "Never memorize something that you can look up.",
|
| 180 |
+
"author": "Albert Einstein"
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"quote": "Once we accept our limits, we go beyond them.",
|
| 184 |
+
"author": "Albert Einstein"
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"quote": "Play is the highest form of research.",
|
| 188 |
+
"author": "Albert Einstein"
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"quote": "We cannot solve our problems with the same thinking we used when we created them.",
|
| 192 |
+
"author": "Albert Einstein"
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"quote": "Wisdom is not a product of schooling but of the lifelong attempt to acquire it.",
|
| 196 |
+
"author": "Albert Einstein"
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"quote": "Your imagination is your preview of life's coming attractions.",
|
| 200 |
+
"author": "Albert Einstein"
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"quote": "There is only one corner of the universe you can be certain of improving, and that's your own self.",
|
| 204 |
+
"author": "Aldous Huxley"
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"quote": "I am thankful for my struggle because, without it, I wouldn't have stumbled across my strength.",
|
| 208 |
+
"author": "Alex Elle"
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"quote": "The most common way people give up their power is by thinking they don't have any.",
|
| 212 |
+
"author": "Alice Walker"
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"quote": "Follow your inner moonlight. Don't hide the madness.",
|
| 216 |
+
"author": "Allen Ginsberg"
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"quote": "The most difficult thing is the decision to act. The rest is merely tenacity.",
|
| 220 |
+
"author": "Amelia Earhart"
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"quote": "Life shrinks or expands in proportion with one's courage.",
|
| 224 |
+
"author": "Anaïs Nin"
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"quote": "Weeks of programming can save you hours of planning.",
|
| 228 |
+
"author": "Unknown"
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"quote": "Quality is not an act, it is a habit.",
|
| 232 |
+
"author": "Aristotle"
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"quote": "Start where you are. Use what you have. Do what you can.",
|
| 236 |
+
"author": "Arthur Ashe"
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"quote": "Nothing is impossible, the word itself says 'I'm possible'!",
|
| 240 |
+
"author": "Audrey Hepburn"
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"quote": "Every strike brings me closer to the next home run.",
|
| 244 |
+
"author": "Babe Ruth"
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"quote": "By failing to prepare, you are preparing to fail.",
|
| 248 |
+
"author": "Benjamin Franklin"
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"quote": "Tell me and I forget. Teach me and I remember. Involve me and I learn.",
|
| 252 |
+
"author": "Benjamin Franklin"
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"quote": "Well done is better than well said.",
|
| 256 |
+
"author": "Benjamin Franklin"
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"quote": "There are no short cuts to any place worth going.",
|
| 260 |
+
"author": "Beverly Sills"
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"quote": "Controlling complexity is the essence of computer programming.",
|
| 264 |
+
"author": "Brian Kernighan"
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"quote": "I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.",
|
| 268 |
+
"author": "Bruce Lee"
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"quote": "There are far, far better things ahead than any we leave behind.",
|
| 272 |
+
"author": "C.S. Lewis"
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"quote": "We are what we believe we are.",
|
| 276 |
+
"author": "C.S. Lewis"
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"quote": "With the possible exception of the equator, everything begins somewhere.",
|
| 280 |
+
"author": "C.S. Lewis"
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"quote": "You are never too old to set another goal, or to dream a new dream.",
|
| 284 |
+
"author": "C.S. Lewis"
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"quote": "Somewhere, something incredible is waiting to be known.",
|
| 288 |
+
"author": "Carl Sagan"
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"quote": "When you have a dream, you've got to grab it and never let go.",
|
| 292 |
+
"author": "Carol Burnett"
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"quote": "If you're not making mistakes, then you're not making decisions.",
|
| 296 |
+
"author": "Catherine Cook"
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"quote": "Find what you love and let it kill you.",
|
| 300 |
+
"author": "Charles Bukowski"
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"quote": "What matters most is how well you walk through the fire.",
|
| 304 |
+
"author": "Charles Bukowski"
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"quote": "It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change.",
|
| 308 |
+
"author": "Charles Darwin"
|
| 309 |
+
},
|
| 310 |
+
{
|
| 311 |
+
"quote": "The details are not the details. They make the design.",
|
| 312 |
+
"author": "Charles Eames"
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"quote": "Creativity is more than just being different. Anybody can plan weird. That's easy. What's hard is to be as simple as Bach. Making the simple, awesomely simple, that's creativity.",
|
| 316 |
+
"author": "Charles Mingus"
|
| 317 |
+
},
|
| 318 |
+
{
|
| 319 |
+
"quote": "Life is 10% what happens to you and 90% how you react to it.",
|
| 320 |
+
"author": "Charles R. Swindoll"
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"quote": "You will do foolish things, but do them with enthusiasm.",
|
| 324 |
+
"author": "Colette"
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"quote": "It does not matter how slowly you go as long as you do not stop.",
|
| 328 |
+
"author": "Confucius"
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"quote": "Real knowledge is to know the extent of one's ignorance.",
|
| 332 |
+
"author": "Confucius"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"quote": "The past cannot be changed. The future is yet in your power.",
|
| 336 |
+
"author": "Confucius"
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"quote": "Looking at code you wrote more than two weeks ago is like looking at code you are seeing for the first time.",
|
| 340 |
+
"author": "Dan Hurvitz"
|
| 341 |
+
},
|
| 342 |
+
{
|
| 343 |
+
"quote": "Someday is not a day of the week.",
|
| 344 |
+
"author": "Denise Brennan-Nelson"
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"quote": "UNIX is simple. It just takes a genius to understand its simplicity.",
|
| 348 |
+
"author": "Dennis Ritchie"
|
| 349 |
+
},
|
| 350 |
+
{
|
| 351 |
+
"quote": "The way I see it, if you want the rainbow, you gotta put up with the rain!",
|
| 352 |
+
"author": "Dolly Parton"
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"quote": "Computers are good at following instructions, but not at reading your mind.",
|
| 356 |
+
"author": "Donald Knuth"
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"quote": "A good programmer is someone who always looks both ways before crossing a one-way street.",
|
| 360 |
+
"author": "Doug Linder"
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"quote": "Creativity is a wild mind and a disciplined eye.",
|
| 364 |
+
"author": "Dorothy Parker"
|
| 365 |
+
},
|
| 366 |
+
{
|
| 367 |
+
"quote": "Tough times never last, but tough people do.",
|
| 368 |
+
"author": "Dr. Robert Schuller"
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"quote": "If things start happening, don't worry, don't stew, just go right along and you'll start happening too.",
|
| 372 |
+
"author": "Dr. Seuss"
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"quote": "Do not go gentle into that good night. Rage, rage against the dying of the light.",
|
| 376 |
+
"author": "Dylan Thomas"
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"quote": "The question of whether computers can think is like the question of whether submarines can swim.",
|
| 380 |
+
"author": "E.W. Dijkstra"
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"quote": "Any code of your own that you haven't looked at for six or more months might as well have been written by someone else.",
|
| 384 |
+
"author": "Eagleson's Law"
|
| 385 |
+
},
|
| 386 |
+
{
|
| 387 |
+
"quote": "Do one thing every day that scares you.",
|
| 388 |
+
"author": "Eleanor Roosevelt"
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"quote": "With the new day comes new strength and new thoughts.",
|
| 392 |
+
"author": "Eleanor Roosevelt"
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"quote": "You must do the things you think you cannot do.",
|
| 396 |
+
"author": "Eleanor Roosevelt"
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"quote": "Light tomorrow with today.",
|
| 400 |
+
"author": "Elizabeth Barrett Browning"
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"quote": "If your dreams do not scare you, they are not big enough.",
|
| 404 |
+
"author": "Ellen Johnson Sirleaf"
|
| 405 |
+
},
|
| 406 |
+
{
|
| 407 |
+
"quote": "Forever is composed of nows.",
|
| 408 |
+
"author": "Emily Dickinson"
|
| 409 |
+
},
|
| 410 |
+
{
|
| 411 |
+
"quote": "Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.",
|
| 412 |
+
"author": "Eric Raymond"
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"quote": "If you don't risk anything, you risk even more.",
|
| 416 |
+
"author": "Erica Jong"
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"quote": "The world breaks everyone, and afterward, many are strong at the broken places.",
|
| 420 |
+
"author": "Ernest Hemingway"
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"quote": "There is nothing noble in being superior to your fellow man; true nobility is being superior to your former self.",
|
| 424 |
+
"author": "Ernest Hemingway"
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"quote": "Never confuse a single defeat with a final defeat.",
|
| 428 |
+
"author": "F. Scott Fitzgerald"
|
| 429 |
+
},
|
| 430 |
+
{
|
| 431 |
+
"quote": "I attribute my success to this - I never gave or took any excuse.",
|
| 432 |
+
"author": "Florence Nightingale"
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"quote": "The best revenge is massive success.",
|
| 436 |
+
"author": "Frank Sinatra"
|
| 437 |
+
},
|
| 438 |
+
{
|
| 439 |
+
"quote": "The only limit to our realization of tomorrow, will be our doubts of today.",
|
| 440 |
+
"author": "Franklin D. Roosevelt"
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"quote": "Right or wrong, it's very pleasant to break something from time to time.",
|
| 444 |
+
"author": "Fyodor Dostoevsky"
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"quote": "The harder I work, the luckier I get.",
|
| 448 |
+
"author": "Gary Player"
|
| 449 |
+
},
|
| 450 |
+
{
|
| 451 |
+
"quote": "Giving up is the only sure way to fail.",
|
| 452 |
+
"author": "Gena Showalter"
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"quote": "The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards.",
|
| 456 |
+
"author": "Gene Spafford"
|
| 457 |
+
},
|
| 458 |
+
{
|
| 459 |
+
"quote": "A life spent making mistakes is not only more honorable, but more useful than a life spent doing nothing.",
|
| 460 |
+
"author": "George Bernard Shaw"
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"quote": "First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.",
|
| 464 |
+
"author": "George Carrette"
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"quote": "Discovering the unexpected is more important than confirming the known.",
|
| 468 |
+
"author": "George Box"
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"quote": "We only see what we know.",
|
| 472 |
+
"author": "Goethe"
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"quote": "Without hard work, nothing grows but weeds.",
|
| 476 |
+
"author": "Gordon B. Hinckley"
|
| 477 |
+
},
|
| 478 |
+
{
|
| 479 |
+
"quote": "The function of good software is to make the complex appear to be simple.",
|
| 480 |
+
"author": "Grady Booch"
|
| 481 |
+
},
|
| 482 |
+
{
|
| 483 |
+
"quote": "When you know that you're capable of dealing with whatever comes, you have the only security the world has to offer.",
|
| 484 |
+
"author": "Harry Browne"
|
| 485 |
+
},
|
| 486 |
+
{
|
| 487 |
+
"quote": "Pain is inevitable. Suffering is optional.",
|
| 488 |
+
"author": "Haruki Murakami"
|
| 489 |
+
},
|
| 490 |
+
{
|
| 491 |
+
"quote": "Optimism is the faith that leads to achievement. Nothing can be done without hope and confidence.",
|
| 492 |
+
"author": "Helen Keller"
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"quote": "The price of anything is the amount of life you exchange for it.",
|
| 496 |
+
"author": "Henry David Thoreau"
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"quote": "Whether you think you can or think you can't, you're right.",
|
| 500 |
+
"author": "Henry Ford"
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"quote": "The most exciting phrase to hear in science, the one that heralds discoveries, is not 'Eureka!' but 'Now that's funny…'",
|
| 504 |
+
"author": "Isaac Asimov"
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"quote": "What you do makes a difference. And you have to decide what kind of difference you want to make.",
|
| 508 |
+
"author": "Jane Goodall"
|
| 509 |
+
},
|
| 510 |
+
{
|
| 511 |
+
"quote": "We are all failures. At least the best of us are.",
|
| 512 |
+
"author": "J.M. Barrie"
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"quote": "You can't wait for inspiration. You have to go after it with a club.",
|
| 516 |
+
"author": "Jack London"
|
| 517 |
+
},
|
| 518 |
+
{
|
| 519 |
+
"quote": "Don't wish it were easier, wish you were better.",
|
| 520 |
+
"author": "Jim Rohn"
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"quote": "By seeking and blundering we learn.",
|
| 524 |
+
"author": "Johann Wolfgang von Goethe"
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"quote": "Knowing is not enough; we must apply. Wishing is not enough; we must do.",
|
| 528 |
+
"author": "Johann Wolfgang von Goethe"
|
| 529 |
+
},
|
| 530 |
+
{
|
| 531 |
+
"quote": "We first make our habits, then our habits make us.",
|
| 532 |
+
"author": "John Dryden"
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"quote": "The power of imagination makes us infinite.",
|
| 536 |
+
"author": "John Muir"
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
"quote": "May you live every day of your life.",
|
| 540 |
+
"author": "Jonathan Swift"
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"quote": "Perseverance is failing 19 times and succeeding the 20th.",
|
| 544 |
+
"author": "Julie Andrews"
|
| 545 |
+
},
|
| 546 |
+
{
|
| 547 |
+
"quote": "The work of today is the history of tomorrow, and we are its makers.",
|
| 548 |
+
"author": "Juliette Gordon Low"
|
| 549 |
+
},
|
| 550 |
+
{
|
| 551 |
+
"quote": "If you reveal your secrets to the wind, you should not blame the wind for revealing them to the trees.",
|
| 552 |
+
"author": "Kahlil Gibran"
|
| 553 |
+
},
|
| 554 |
+
{
|
| 555 |
+
"quote": "Optimism is an occupational hazard of programming; feedback is the treatment.",
|
| 556 |
+
"author": "Kent Beck"
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"quote": "Opportunity does not knock, it presents itself when you beat down the door.",
|
| 560 |
+
"author": "Kyle Chandler"
|
| 561 |
+
},
|
| 562 |
+
{
|
| 563 |
+
"quote": "To iterate is human, to recurse divine.",
|
| 564 |
+
"author": "Peter Deutsch"
|
| 565 |
+
},
|
| 566 |
+
{
|
| 567 |
+
"quote": "A good traveler has no fixed plans and is not intent on arriving.",
|
| 568 |
+
"author": "Lao Tzu"
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"quote": "An ant on the move does more than a dozing ox.",
|
| 572 |
+
"author": "Lao Tzu"
|
| 573 |
+
},
|
| 574 |
+
{
|
| 575 |
+
"quote": "Do the difficult things while they are easy and do the great things while they are small. A journey of a thousand miles must begin with a single step.",
|
| 576 |
+
"author": "Lao Tzu"
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"quote": "That's the thing about people who think they hate computers. What they really hate is lousy programmers.",
|
| 580 |
+
"author": "Larry Niven"
|
| 581 |
+
},
|
| 582 |
+
{
|
| 583 |
+
"quote": "It had long since come to my attention that people of accomplishment rarely sat back and let things happen to them. They went out and happened to things.",
|
| 584 |
+
"author": "Elinor Smith"
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"quote": "If you're any good at all, you know you can be better.",
|
| 588 |
+
"author": "Lindsay Buckingham"
|
| 589 |
+
},
|
| 590 |
+
{
|
| 591 |
+
"quote": "If people never did silly things, nothing intelligent would ever get done.",
|
| 592 |
+
"author": "Ludwig Wittgenstein"
|
| 593 |
+
},
|
| 594 |
+
{
|
| 595 |
+
"quote": "You only live once, but if you do it right, once is enough.",
|
| 596 |
+
"author": "Mae West"
|
| 597 |
+
},
|
| 598 |
+
{
|
| 599 |
+
"quote": "Live as if you were to die tomorrow. Learn as if you were to live forever.",
|
| 600 |
+
"author": "Mahatma Gandhi"
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"quote": "Strength does not come from physical capacity. It comes from an indomitable will.",
|
| 604 |
+
"author": "Mahatma Gandhi"
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
"quote": "One person's 'paranoia' is another person's 'engineering redundancy'.",
|
| 608 |
+
"author": "Marcus J. Ranum"
|
| 609 |
+
},
|
| 610 |
+
{
|
| 611 |
+
"quote": "Nothing in life is to be feared, it is only to be understood. Now is the time to understand more, so that we may fear less.",
|
| 612 |
+
"author": "Marie Curie"
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"quote": "If you have everything under control, you're not moving fast enough.",
|
| 616 |
+
"author": "Mario Andretti"
|
| 617 |
+
},
|
| 618 |
+
{
|
| 619 |
+
"quote": "Education: the path from cocky ignorance to miserable uncertainty.",
|
| 620 |
+
"author": "Mark Twain"
|
| 621 |
+
},
|
| 622 |
+
{
|
| 623 |
+
"quote": "It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so.",
|
| 624 |
+
"author": "Mark Twain"
|
| 625 |
+
},
|
| 626 |
+
{
|
| 627 |
+
"quote": "The secret of getting ahead is getting started.",
|
| 628 |
+
"author": "Mark Twain"
|
| 629 |
+
},
|
| 630 |
+
{
|
| 631 |
+
"quote": "The two most important days in your life are the day you are born and the day you find out why.",
|
| 632 |
+
"author": "Mark Twain"
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"quote": "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails.",
|
| 636 |
+
"author": "Mark Twain"
|
| 637 |
+
},
|
| 638 |
+
{
|
| 639 |
+
"quote": "Any fool can write code that a computer can understand. Good programmers write code that humans can understand.",
|
| 640 |
+
"author": "Martin Fowler"
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"quote": "I know, somehow, that only when it is dark enough can you see the stars.",
|
| 644 |
+
"author": "Martin Luther King Jr."
|
| 645 |
+
},
|
| 646 |
+
{
|
| 647 |
+
"quote": "It is never too late to be what you might have been.",
|
| 648 |
+
"author": "Mary Anne Evans"
|
| 649 |
+
},
|
| 650 |
+
{
|
| 651 |
+
"quote": "Nothing will work unless you do.",
|
| 652 |
+
"author": "Maya Angelou"
|
| 653 |
+
},
|
| 654 |
+
{
|
| 655 |
+
"quote": "You can't use up creativity. The more you use, the more you have.",
|
| 656 |
+
"author": "Maya Angelou"
|
| 657 |
+
},
|
| 658 |
+
{
|
| 659 |
+
"quote": "We delight in the beauty of the butterfly, but rarely admit the changes it has gone through to achieve that beauty.",
|
| 660 |
+
"author": "Maya Angelou"
|
| 661 |
+
},
|
| 662 |
+
{
|
| 663 |
+
"quote": "We may encounter many defeats, but we must not be defeated.",
|
| 664 |
+
"author": "Maya Angelou"
|
| 665 |
+
},
|
| 666 |
+
{
|
| 667 |
+
"quote": "Everybody has talent, but ability takes hard work.",
|
| 668 |
+
"author": "Michael Jordan"
|
| 669 |
+
},
|
| 670 |
+
{
|
| 671 |
+
"quote": "I've missed more than 9,000 shots during my career. I've lost almost 300 games. 26 times, I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed.",
|
| 672 |
+
"author": "Michael Jordan"
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
"quote": "Impossible is just a big word thrown around by small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare. Impossible is potential. Impossible is temporary. Impossible is nothing.",
|
| 676 |
+
"author": "Muhammad Ali"
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"quote": "A winner is a dreamer who never gives up.",
|
| 680 |
+
"author": "Nelson Mandela"
|
| 681 |
+
},
|
| 682 |
+
{
|
| 683 |
+
"quote": "It always seems impossible until it's done.",
|
| 684 |
+
"author": "Nelson Mandela"
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
"quote": "Failure will never overtake me if my determination to succeed is strong enough.",
|
| 688 |
+
"author": "Og Mandino"
|
| 689 |
+
},
|
| 690 |
+
{
|
| 691 |
+
"quote": "I am not young enough to know everything.",
|
| 692 |
+
"author": "Oscar Wilde"
|
| 693 |
+
},
|
| 694 |
+
{
|
| 695 |
+
"quote": "There is only one thing that makes a dream impossible to achieve: the fear of failure.",
|
| 696 |
+
"author": "Paulo Coelho"
|
| 697 |
+
},
|
| 698 |
+
{
|
| 699 |
+
"quote": "Never go to bed mad. Stay up and fight.",
|
| 700 |
+
"author": "Phyllis Diller"
|
| 701 |
+
},
|
| 702 |
+
{
|
| 703 |
+
"quote": "You can't cross the sea merely by standing and staring at the water.",
|
| 704 |
+
"author": "Rabindranath Tagore"
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"quote": "The only person you are destined to become is the person you decide to be.",
|
| 708 |
+
"author": "Ralph Waldo Emerson"
|
| 709 |
+
},
|
| 710 |
+
{
|
| 711 |
+
"quote": "What you do speaks so loudly that I cannot hear what you say.",
|
| 712 |
+
"author": "Ralph Waldo Emerson"
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"quote": "People who are crazy enough to think they can change the world, are the ones who do.",
|
| 716 |
+
"author": "Rob Siltanen"
|
| 717 |
+
},
|
| 718 |
+
{
|
| 719 |
+
"quote": "The best way out is always through.",
|
| 720 |
+
"author": "Robert Frost"
|
| 721 |
+
},
|
| 722 |
+
{
|
| 723 |
+
"quote": "Today's accomplishments were yesterday's impossibilities.",
|
| 724 |
+
"author": "Robert H. Schuller"
|
| 725 |
+
},
|
| 726 |
+
{
|
| 727 |
+
"quote": "Don't be satisfied with stories, how things have gone with others. Unfold your own myth.",
|
| 728 |
+
"author": "Rumi"
|
| 729 |
+
},
|
| 730 |
+
{
|
| 731 |
+
"quote": "Forget safety. Live where you fear to live. Destroy your reputation. Be notorious.",
|
| 732 |
+
"author": "Rumi"
|
| 733 |
+
},
|
| 734 |
+
{
|
| 735 |
+
"quote": "Sell your cleverness and buy bewilderment.",
|
| 736 |
+
"author": "Rumi"
|
| 737 |
+
},
|
| 738 |
+
{
|
| 739 |
+
"quote": "The cure for pain is in the pain.",
|
| 740 |
+
"author": "Rumi"
|
| 741 |
+
},
|
| 742 |
+
{
|
| 743 |
+
"quote": "Have no fear of perfection - you'll never reach it.",
|
| 744 |
+
"author": "Salvador Dalí"
|
| 745 |
+
},
|
| 746 |
+
{
|
| 747 |
+
"quote": "Don't watch the clock. Do what it does. Keep going.",
|
| 748 |
+
"author": "Sam Levenson"
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"quote": "Ever Tried. Ever failed. No matter. Try again. Fail again. Fail better.",
|
| 752 |
+
"author": "Samuel Beckett"
|
| 753 |
+
},
|
| 754 |
+
{
|
| 755 |
+
"quote": "The more you know, the more you realize you know nothing.",
|
| 756 |
+
"author": "Socrates"
|
| 757 |
+
},
|
| 758 |
+
{
|
| 759 |
+
"quote": "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.",
|
| 760 |
+
"author": "Stephen Hawking"
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"quote": "The universe doesn't allow perfection.",
|
| 764 |
+
"author": "Stephen Hawking"
|
| 765 |
+
},
|
| 766 |
+
{
|
| 767 |
+
"quote": "Whether you want to uncover the secrets of the universe, or you want to pursue a career in the 21st century, basic computer programming is an essential skill to learn.",
|
| 768 |
+
"author": "Stephen Hawking"
|
| 769 |
+
},
|
| 770 |
+
{
|
| 771 |
+
"quote": "The scariest moment is always just before you start.",
|
| 772 |
+
"author": "Stephen King"
|
| 773 |
+
},
|
| 774 |
+
{
|
| 775 |
+
"quote": "You can, you should, and if you're brave enough to start, you will.",
|
| 776 |
+
"author": "Stephen King"
|
| 777 |
+
},
|
| 778 |
+
{
|
| 779 |
+
"quote": "Arise, Awake and Stop not until the goal is reached.",
|
| 780 |
+
"author": "Swami Vivekananda"
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"quote": "It is said that your life flashes before your eyes just before you die. That is true, it's called Life.",
|
| 784 |
+
"author": "Terry Pratchett"
|
| 785 |
+
},
|
| 786 |
+
{
|
| 787 |
+
"quote": "Believe you can and you're halfway there.",
|
| 788 |
+
"author": "Theodore Roosevelt"
|
| 789 |
+
},
|
| 790 |
+
{
|
| 791 |
+
"quote": "I have not failed. I've just found 10,000 ways that won't work.",
|
| 792 |
+
"author": "Thomas A. Edison"
|
| 793 |
+
},
|
| 794 |
+
{
|
| 795 |
+
"quote": "Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.",
|
| 796 |
+
"author": "Thomas A. Edison"
|
| 797 |
+
},
|
| 798 |
+
{
|
| 799 |
+
"quote": "The harder the conflict, the more glorious the triumph.",
|
| 800 |
+
"author": "Thomas Paine"
|
| 801 |
+
},
|
| 802 |
+
{
|
| 803 |
+
"quote": "The Web as I envisaged it, we have not seen it yet. The future is still so much bigger than the past.",
|
| 804 |
+
"author": "Tim Berners-Lee"
|
| 805 |
+
},
|
| 806 |
+
{
|
| 807 |
+
"quote": "Failure is the condiment that gives success its flavor.",
|
| 808 |
+
"author": "Truman Capote"
|
| 809 |
+
},
|
| 810 |
+
{
|
| 811 |
+
"quote": "Those who say it cannot be done should not interrupt the person doing it.",
|
| 812 |
+
"author": "Unknown"
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"quote": "Look at usual things with unusual eyes.",
|
| 816 |
+
"author": "Vico Magistetti"
|
| 817 |
+
},
|
| 818 |
+
{
|
| 819 |
+
"quote": "Even if you fall on your face, you're still moving forward.",
|
| 820 |
+
"author": "Victor Kiam"
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"quote": "It's not whether you get knocked down, it's whether you get up.",
|
| 824 |
+
"author": "Vince Lombardi"
|
| 825 |
+
},
|
| 826 |
+
{
|
| 827 |
+
"quote": "I dream my painting and I paint my dream.",
|
| 828 |
+
"author": "Vincent van Gogh"
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"quote": "Great things are done by a series of small things brought together.",
|
| 832 |
+
"author": "Vincent van Gogh"
|
| 833 |
+
},
|
| 834 |
+
{
|
| 835 |
+
"quote": "Let us cultivate our garden.",
|
| 836 |
+
"author": "Voltaire"
|
| 837 |
+
},
|
| 838 |
+
{
|
| 839 |
+
"quote": "Aim for the moon. If you miss, you may hit a star.",
|
| 840 |
+
"author": "W. Clement Stone"
|
| 841 |
+
},
|
| 842 |
+
{
|
| 843 |
+
"quote": "The way to get started is to quit talking and begin doing.",
|
| 844 |
+
"author": "Walt Disney"
|
| 845 |
+
},
|
| 846 |
+
{
|
| 847 |
+
"quote": "You miss 100% of the shots you don't take.",
|
| 848 |
+
"author": "Wayne Gretzky"
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
"quote": "Don't let yesterday take up too much of today.",
|
| 852 |
+
"author": "Will Rogers"
|
| 853 |
+
},
|
| 854 |
+
{
|
| 855 |
+
"quote": "Even if you're on the right track, you'll get run over if you just sit there.",
|
| 856 |
+
"author": "Will Rogers"
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"quote": "Do not wait to strike till the iron is hot; but make it hot by striking.",
|
| 860 |
+
"author": "William Butler Yeats"
|
| 861 |
+
},
|
| 862 |
+
{
|
| 863 |
+
"quote": "You cannot swim for new horizons until you have courage to lose sight of the shore.",
|
| 864 |
+
"author": "William Faulkner"
|
| 865 |
+
},
|
| 866 |
+
{
|
| 867 |
+
"quote": "Be not afraid of greatness. Some are born great, some achieve greatness, and others have greatness thrust upon them.",
|
| 868 |
+
"author": "William Shakespeare"
|
| 869 |
+
},
|
| 870 |
+
{
|
| 871 |
+
"quote": "We know what we are, but not what we may be.",
|
| 872 |
+
"author": "William Shakespeare"
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"quote": "In theory there is no difference between theory and practice. In practice there is.",
|
| 876 |
+
"author": "Yogi Berra"
|
| 877 |
+
},
|
| 878 |
+
{
|
| 879 |
+
"quote": "You can see a lot by just looking.",
|
| 880 |
+
"author": "Yogi Berra"
|
| 881 |
+
},
|
| 882 |
+
{
|
| 883 |
+
"quote": "There is no elevator to success, you have to take the stairs.",
|
| 884 |
+
"author": "Zig Ziglar"
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"quote": "You don't have to be great to start, but you have to start to be great.",
|
| 888 |
+
"author": "Zig Ziglar"
|
| 889 |
+
}
|
| 890 |
+
]
|
| 891 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/english/translations.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/espanol/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/espanol/news/acerca-de-freecodecamp-preguntas-frecuentes/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/espanol/news/preguntas-comunes-de-soporte-tecnico/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/espanol/news/politica-de-honestidad-academica/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/espanol/news/codigo-de-conducta/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/espanol/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://freecodecamp.org/espanol/news/",
|
| 25 |
+
"podcast": "https://www.freecodecamp.org/espanol/news/el-podcast-de-freecodecamp-en-espanol/"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/german/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/german/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://freecodecamp.org/german/news/",
|
| 25 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/italian/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/italian/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://freecodecamp.org/italian/news/",
|
| 25 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/japanese/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/japanese/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/japanese/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/japanese/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/japanese/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/japanese/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/japanese/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://www.freecodecamp.org/japanese/news/",
|
| 25 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/korean/links.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp",
|
| 20 |
+
"one-time-external-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#how-can-i-make-a-one-time-donation",
|
| 21 |
+
"mail-check-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#can-i-mail-a-physical-check"
|
| 22 |
+
},
|
| 23 |
+
"nav": {
|
| 24 |
+
"contribute": "https://contribute.freecodecamp.org/#/",
|
| 25 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 26 |
+
"news": "https://www.freecodecamp.org/korean/news/search/",
|
| 27 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 28 |
+
},
|
| 29 |
+
"help": {
|
| 30 |
+
"HTML-CSS": "curriculum-help",
|
| 31 |
+
"JavaScript": "curriculum-help",
|
| 32 |
+
"Python": "curriculum-help",
|
| 33 |
+
"Backend Development": "curriculum-help",
|
| 34 |
+
"C-Sharp": "curriculum-help",
|
| 35 |
+
"English": "curriculum-help",
|
| 36 |
+
"Spanish Curriculum": "curriculum-help",
|
| 37 |
+
"Chinese Curriculum": "curriculum-help",
|
| 38 |
+
"Odin": "curriculum-help",
|
| 39 |
+
"Euler": "curriculum-help",
|
| 40 |
+
"Rosetta": "curriculum-help",
|
| 41 |
+
"General": "curriculum-help"
|
| 42 |
+
}
|
| 43 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/portuguese/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/portuguese/news/sobre-o-freecodecamp-perguntas-frequentes/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/portuguese/news/perguntas-frequentes-sobre-suporte-tecnico-faq-do-freecodecamp/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/portuguese/news/politica-de-honestidade-academica-do-freecodecamp/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/portuguese/news/codigo-de-conduta-do-freecodecamp/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/i18n/portuguese/index",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://freecodecamp.org/portuguese/news/",
|
| 25 |
+
"podcast": "https://open.spotify.com/show/70m92At5oht4zY4f87lLEE?si=6tozUAOBQFSVyaqixy6aCg"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/client/i18n/locales/swahili/links.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"help-translate-link-url": "https://contribute.freecodecamp.org/getting-started/#translations",
|
| 3 |
+
"top-contributors": "https://www.freecodecamp.org/news/freecodecamp-top-contributors/",
|
| 4 |
+
"footer": {
|
| 5 |
+
"about-url": "https://www.freecodecamp.org/news/about/",
|
| 6 |
+
"shop-url": "https://shop.freecodecamp.org/",
|
| 7 |
+
"support-url": "https://www.freecodecamp.org/news/support/",
|
| 8 |
+
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
|
| 9 |
+
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
|
| 10 |
+
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
|
| 11 |
+
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
|
| 12 |
+
"tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
|
| 13 |
+
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
|
| 14 |
+
},
|
| 15 |
+
"donate": {
|
| 16 |
+
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
|
| 17 |
+
"download-irs-url": "https://s3.amazonaws.com/freecodecamp/Free+Code+Camp+Inc+IRS+Determination+Letter.pdf",
|
| 18 |
+
"download-990-url": "https://freecodecamp.s3.amazonaws.com/freeCodeCamp+2019+f990.pdf",
|
| 19 |
+
"one-time-url": "https://paypal.me/freecodecamp"
|
| 20 |
+
},
|
| 21 |
+
"nav": {
|
| 22 |
+
"contribute": "https://contribute.freecodecamp.org/#/",
|
| 23 |
+
"forum": "https://forum.freecodecamp.org/",
|
| 24 |
+
"news": "https://freecodecamp.org/news/",
|
| 25 |
+
"podcast": "https://freecodecamp.libsyn.com/"
|
| 26 |
+
},
|
| 27 |
+
"help": {
|
| 28 |
+
"HTML-CSS": "curriculum-help",
|
| 29 |
+
"JavaScript": "curriculum-help",
|
| 30 |
+
"Python": "curriculum-help",
|
| 31 |
+
"Backend Development": "curriculum-help",
|
| 32 |
+
"C-Sharp": "curriculum-help",
|
| 33 |
+
"English": "curriculum-help",
|
| 34 |
+
"Spanish Curriculum": "curriculum-help",
|
| 35 |
+
"Chinese Curriculum": "curriculum-help",
|
| 36 |
+
"Odin": "curriculum-help",
|
| 37 |
+
"Euler": "curriculum-help",
|
| 38 |
+
"Rosetta": "curriculum-help",
|
| 39 |
+
"General": "curriculum-help"
|
| 40 |
+
}
|
| 41 |
+
}
|