Skip to content

Commit

Permalink
Decode Multiple CaaS Links
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon32 committed Sep 18, 2024
1 parent 4c7efe1 commit f0c33db
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 49 deletions.
92 changes: 56 additions & 36 deletions blocks/url-decode/url-decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,61 @@ export const createTable = (data) => {
return createTag('div', null, [download, table]);
};

const sortValidLinks = (a, b) => {
if (a.validLink === b.validLink) {
return 0;
} if (a.validLink === 'Yes') {
return -1;
export async function decodeUrl(url) {
if (!url) return null;
const encodedConfig = url.split('#')[1];
if (!encodedConfig) return null;

if (encodedConfig.startsWith('~~')) {
const config = await decodeCompressedString(encodedConfig.substring(2));
return config;
}
return 1;
};

async function fetchConfig(el, configColumn) {
const config = parseEncodedConfig(encodedConfig);
return config;
}

async function decodeUrls(data) {
let encodedLinks = [];

try {
encodedLinks = JSON.parse(data);

if (!Array.isArray(encodedLinks)) {
encodedLinks = [encodedLinks];
}
} catch (e) {
encodedLinks = [data];
}

const decodedLinks = await Promise.all(encodedLinks.map(decodeUrl));

return decodedLinks;
}

async function validateDecodedUrls(data, configColumn) {
return Promise.all(data.map(async (page) => {
const path = createTag('a', { href: page.path }, page.path);
try {
const configs = await decodeUrls(page[configColumn]);

for (const config of configs) {
if (!config) return { path, validLink: 'No Config Found' };

const validLink = Object.keys(config).length > 0;

if (!validLink) return { path, validLink: 'Empty Config' };
}

return { path, validLink: 'Yes' };
} catch (e) {
console.error(page[configColumn], e);
return { path, validLink: 'Could not decode link' };
}
}));
}

async function generateReport(el, configColumn) {
const report = el.querySelector('.report');
const locale = el.querySelector('select#locale').value;
const queryIndex = new URL(`${locale}/query-index.json`, window.location.origin);
Expand All @@ -91,34 +136,9 @@ async function fetchConfig(el, configColumn) {
return;
}

const decodedReports = data.map(async (page) => {
const path = createTag('a', { href: page.path }, page.path);
const encodedConfig = page[configColumn]?.split('#')[1] ?? '';

if (!encodedConfig) return { path, validLink: 'No Config Found' };

try {
if (encodedConfig.startsWith('~~')) {
const state = await decodeCompressedString(encodedConfig.substring(2));
const validLink = Object.keys(state).length > 0;

return { path, validLink: validLink ? 'Yes' : 'Empty Compressed Config' };
}

const state = parseEncodedConfig(encodedConfig);
const validLink = Object.keys(state).length > 0;

return { path, validLink: validLink ? 'Yes' : 'Empty Config' };
} catch (e) {
return { path, validLink: 'Could not decode link' };
}
});

// const sortedData = reportData.sort(sortValidLinks);
const reportData = await Promise.all(decodedReports);
const sortedData = reportData.sort(sortValidLinks);
const decodedReports = await validateDecodedUrls(data, configColumn);

const table = createTable(sortedData);
const table = createTable(decodedReports);
report.append(table);
}

Expand All @@ -141,5 +161,5 @@ export default async function init(el) {

el.replaceChildren(options, report);

submit.addEventListener('click', async () => fetchConfig(el, URL_COLUMN));
submit.addEventListener('click', async () => generateReport(el, URL_COLUMN));
}
16 changes: 8 additions & 8 deletions test/blocks/url-decode/mocks/query-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"offset":0,
"limit":4,
"data":[{
"path": "/resources/event-sessions/turn-newbies-into-superfans-building-an-epic-learning-academy",
"title": "Build an Epic Learning Academy",
"date": "45470",
"caas-url": "/tools/caas#~~H4sIAAAAAAAACq1WTY8bNwz9Lzp74s1u24Nv+4kacLLb2DkVxoKW6BliNeKU4tjrBPnvhebDYztToEB7MaxHSqTIx6f5biCAPyjZeM/eo1Xi8BlKNDNjJoNxJWDf5mUlGCNxMLMt+IjJwS04J7uCPJrZn98NBRVYQd6gZmaevzTHuM7BWIA4sxwUg2Z6qHAKomQ9msmIzdZRuUTJorIcRl0cljxqwA3z26glr8mNx6Ow5VygKsiO2gUrFh017cjheCJ73FAAGbcVpJhVUOG4vRJ2tdVMuR532HjOzfrH5F9WvjsvTj2CBAp5VkKAHMWsf6wnJpWsBHmbWw5LTHRoeXCKfw3xxGJB3FIPPhHm4+w6IUce3WnoTZVQCW0HL2mmtYQs4H5DGDMKylmsK5Q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o983V2zIV5PBeYd4PeYHgjqLbGQc5c6hAPqZePVddsVw3WhMTWC/kL6Ll4EAOI9CyJ+u6HfL5iTakwKnw86AoO/BnatCIELgcL7SEWVEeKH2X9hL0429edz6j7wsAAA==/resources/main"
},
{
"path": "/resources/2021-state-work",
"title": "The 2021 State of Work: How COVID-19 Changed Digital Work",
"date": "44715.6956838079",
"caas-url": "https://milo.adobe.com/tools/caas#eyJsIjoiZW5fdXMiLCJkIjoiL3Jlc291cmNlc3VuZGVmaW5lZCIsImFyIjp0cnVlLCJ0ZXN0IjpmYWxzZSwicSI6e30sInBjIjp7IjEiOiJqcyIsIjIiOiJmYWFzX3N1Ym1pc3Npb24iLCIzIjoic2ZkYyIsIjQiOiJkZW1hbmRiYXNlIiwiNSI6IiJ9LCJwIjp7ImpzIjp7IjMyIjoidW5rbm93biIsIjM2IjoiNzAxNVkwMDAwMDF6UWthUUFFIiwiMzkiOiIiLCI3NyI6MSwiNzgiOjEsIjc5IjoxLCI5MCI6IkZBQVMiLCI5MiI6Mjg0NiwiOTMiOiIyODQ3IiwiOTQiOjMyNzMsIjE3MiI6IlN0YXRlIG9mIFdvcmsgMjAyMSAoVVMpIiwiMTczIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL3Jlc291cmNlcy8yMDIxLXN0YXRlLXdvcmsuaHRtbD9ob3N0PWh0dHBzJTNhJTJmJTJmYnVzaW5lc3MuYWRvYmUuY29tIiwiMTc2IjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL3Jlc291cmNlcy8yMDIxLXN0YXRlLXdvcmsvdGhhbmsteW91Lmh0bWwiLCIxNzgiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvdG9vbHMvaW1wb3J0ZXIvaGVsaXgtaW1wb3J0ZXItdWkvaW1wb3J0LWJ1bGsuaHRtbCJ9LCJmYWFzX3N1Ym1pc3Npb24iOnt9LCJzZmRjIjp7ImNvbnRhY3RJZCI6bnVsbH0sImRlbWFuZGJhc2UiOnt9fSwiYXMi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yIzNiI6IjcwMTVZMDAwMDAxelFrYVFBRSIsIjM5IjoiIiwiNzciOjEsIjc4IjoxLCI3OSI6MSwiOTAiOiJGQUFTIiwiOTIiOjI4NDYsIjkzIjoiMjg0NyIsIjk0IjozMjczLCIxNzIiOiJTdGF0ZSBvZiBXb3JrIDIwMjEgKFVTKSJ9fSwiZSI6e319LCJvbmV0cnVzdF9hZHZlcnRpc2luZ19hY2NlcHRhbmNlIjoibm8iLCJvbmV0cnVzdF9wZXJmb3JtYW5jZV9hY2NlcHRhbmNlIjoibm8iLCJvbmV0cnVzdF9mdW5jdGlvbmFsaXR5X2FjY2VwdGFuY2UiOiJubyIsImNsZWFyYml0U3RlcCI6MSwiZm9ybVRhZyI6ImZhYXMtUkZJIiwiaWQiOiI2MyIsIl9mYyI6MSwiY29tcGxldGUiOnRydWUsInN0eWxlX2xheW91dCI6ImNvbHVtbjIiLCJjbGVhYml0U3R5bGUiOiIifQ==\"]"
},
{
"path": "/resources/event-sessions/turn-newbies-into-superfans-building-an-epic-learning-academy",
"title": "Build an Epic Learning Academy",
"date": "45470",
"caas-url": "[\"/tools/caas#~~H4sIAAAAAAAACq1WTY8bNwz9Lzp74s1u24Nv+4kacLLb2DkVxoKW6BliNeKU4tjrBPnvhebDYztToEB7MaxHSqTIx6f5biCAPyjZeM/eo1Xi8BlKNDNjJoNxJWDf5mUlGCNxMLMt+IjJwS04J7uCPJrZn98NBRVYQd6gZmaevzTHuM7BWIA4sxwUg2Z6qHAKomQ9msmIzdZRuUTJorIcRl0cljxqwA3z26glr8mNx6Ow5VygKsiO2gUrFh017cjheCJ73FAAGbcVpJhVUOG4vRJ2tdVMuR532HjOzfrH5F9WvjsvTj2CBAp5VkKAHMWsf6wnJpWsBHmbWw5LTHRoeXCKfw3xxGJB3FIPPhHm4+w6IUce3WnoTZVQCW0HL2mmtYQs4H5DGDMKylmsK5QthJhtavIuZQkhw4psdkwbLDgszw9c0rcmjaurBg4KFFDMzNxcfwLJKXQwBl0dKuwK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CyJ+u6HfL5iTakwKnw86AoO/BnatCIELgcL7SEWVEeKH2X9hL0429edz6j7wsAAA==/resources/main\"]"
},
{
"path": "/resources/event-sessions/explore-learning-in-the-experiential-age-from-passive-to-immersive",
Expand All @@ -24,7 +24,7 @@
"path": "/resources/event-sessions/adobe-learning-manager-disruptive-and-elegant-tech",
"title": "Learning Manager: Personalized, data-driven learning tech.",
"date": "45470",
"caas-url": ""
"caas-url": "0"
}],
":type":"sheet"
}
31 changes: 26 additions & 5 deletions test/blocks/url-decode/url-decode.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { expect } from '@esm-bundle/chai';
import { readFile } from '@web/test-runner-commands';
import sinon from 'sinon';
import init, { loadQueryIndex, createTable } from '../../../blocks/url-decode/url-decode.js';
import init, { loadQueryIndex, createTable, decodeUrl } from '../../../blocks/url-decode/url-decode.js';
import waitForElement from '../../helpers/waitForElement.js';

import { LIBS } from '../../../scripts/scripts.js';

const { utf8ToB64 } = await import(`${LIBS}/utils/utils.js`);

window.lana = { log: () => { } };
const queryIndex = await readFile({ path: './mocks/query-index.json' });

Expand Down Expand Up @@ -61,10 +65,27 @@ describe('URL Decode', () => {
expect(table.querySelectorAll('tr')).to.have.length(3);
});

it('decodes base64 url', async () => {
const url = `/tools/test#${utf8ToB64(JSON.stringify({ test: 'test' }))}`;
const data = await decodeUrl(url);

expect(data).to.deep.equal({ test: 'test' });
});

it('decodes compressed URL', async () => {
const url = 'https://main--milo--adobecom.hlx.page/tools/caas#~~H4sIAAAAAAAAE3VVTY/bNhD9Lzw7Wafb9qCb7V0jBrxZN/aihyIoxuRIIkxxVHJor1L0vxek9ek4N+kNOR9v3gz/FaCUZk0WzFf8J6DnHTiovMj++jYTqrFQabk6LNbktvqMz2e07EWWg/E4E2DBNKylX5ExKKOfL1ChyIQYGQ8O5GlT1Q6912RHt9WWCi0PULTxIDCtKFh2zRZs0Z88Ep0qcKeNJLvHGOkaYoy/WT+ySHBqz42JuZRg8g8l6qLk1nLQbHAhZUzoqI3mZotnNCL7fSZkX8qSbeeidroC14ixeah0wJLjW3Cvv/eYZdAWncjEp1/m8xd4/1MrLlsTWj40NQ58yCsXIhMSwGft70Pw8ULwTNUKnGp9MyxSOJGJvz2aXMyEoi/EW/jebAlUz6bSHo4Gl2AtuqGZykHOT8f+H62qSdtI6OVy+QiKjvhRUvUgS12hgw9Q64ehShFvnLUjW6Ftu4Dv0gSFKmbZltRCQ405GHMEeXoewomZyBE4uMnNXBtGlxTYnknAMmijdmBj+5KAKmAte/OWJLSsGMx5hBdaikyQ66FJHL9K/E6gfUmX56rmpueoCMypm7++i5koEVTvptQKVwwbNf0fCo/AEzBuLKM7g+mdantDkQFbBCiw00H3/4CRdQMNhSScmEeoI0SgXsjhXQVb4puxI2uaWNuyHaee9jYhcjcXaii0TbQurK7SRx8HClRifOTZRrUN8hssfwSwrDnFtnfsbU0tkDo1GN88Hkqs8HG4aEBiSUahe3PmqhGHPhj2O3S7ROBvM+ERnCzXGk3XGo+SrALXDBX20J6Ck9iBHIlZklPjwfElXRIOqsApvCZidE/6rFWUycjSce3XSVv3ba922ojkstPqCNvcnNmnEifQgTiu+MTGYCDHUYILL3/AnvAO+EJK53rUzGTAHIKJQ6m6e1fDtfM7qkM9uXDFv4JVVO2hqo0e7fp0IA75nhxP0HW7EyZgl9FtCR3+QxnXsFMIPbozabcjMiL7NJ/PbwwpSxTZ4xW/vh83jhN4E67VjijhcvLi20wwFP4qzp/v1HhGxKOuQI47/azjyhE9djtRHOcgLrj4xKGPS04hgzb+gO/8Wrf7T7V9mgmOqX5GUNoW7csnysdoiCpJmjtQnMpIxkwEj9voOnrrgwaPr2d0BpqttqdBU6P3MzDTnQUUPLqNzSkO1X//AxGj3OyCCAAA';
const data = await decodeUrl(url);

expect(data).to.not.be.empty;
expect(data).to.have.property('tagsUrl', 'www.adobe.com/chimera-api/tags');
});

it('shows report data', async () => {
const el = document.querySelector('.url-decode');
const submit = el.querySelector('button[type="submit"]');
submit.click();
const submit = el.querySelectorAll('button[type="submit"]');

expect(submit).to.have.length(1);
submit[0].click();

const table = await waitForElement('table');
expect(table).to.exist;
Expand All @@ -76,8 +97,8 @@ describe('URL Decode', () => {
expect(rows[0].querySelector('th:nth-child(2)').textContent).to.equal('validLink');

expect(rows[1].querySelector('td:nth-child(2)').textContent).to.equal('Yes');
expect(rows[2].querySelector('td:nth-child(2)').textContent).to.equal('Yes');
expect(rows[3].querySelector('td:nth-child(2)').textContent).to.equal('Could not decode link');
expect(rows[2].querySelector('td:nth-child(2)').textContent).to.equal('Could not decode link');
expect(rows[3].querySelector('td:nth-child(2)').textContent).to.equal('Yes');
expect(rows[4].querySelector('td:nth-child(2)').textContent).to.equal('No Config Found');
});
});

0 comments on commit f0c33db

Please sign in to comment.