2020-03-18 16:47:48 +00:00
|
|
|
import sm from "sitemap";
|
2022-03-25 14:59:54 +00:00
|
|
|
import OperationConfig from "../../core/config/OperationConfig.json" assert {type: "json"};
|
2018-02-20 16:52:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
|
|
|
|
*
|
|
|
|
* @author n1474335 [n1474335@gmail.com]
|
|
|
|
* @copyright Crown Copyright 2018
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2020-03-18 16:47:48 +00:00
|
|
|
const smStream = new sm.SitemapStream({
|
2018-02-20 16:52:27 +00:00
|
|
|
hostname: "https://gchq.github.io/CyberChef",
|
|
|
|
});
|
|
|
|
|
2020-03-18 16:47:48 +00:00
|
|
|
smStream.write({
|
2018-02-20 16:52:27 +00:00
|
|
|
url: "/",
|
|
|
|
changefreq: "weekly",
|
|
|
|
priority: 1.0
|
|
|
|
});
|
|
|
|
|
2018-04-02 17:10:51 +01:00
|
|
|
for (const op in OperationConfig) {
|
2020-03-18 16:47:48 +00:00
|
|
|
smStream.write({
|
2018-02-20 17:39:46 +00:00
|
|
|
url: `/?op=${encodeURIComponent(op)}`,
|
2018-02-20 16:52:27 +00:00
|
|
|
changeFreq: "yearly",
|
|
|
|
priority: 0.5
|
|
|
|
});
|
|
|
|
}
|
2020-03-18 16:47:48 +00:00
|
|
|
smStream.end();
|
2018-02-20 16:52:27 +00:00
|
|
|
|
2020-03-18 16:47:48 +00:00
|
|
|
sm.streamToPromise(smStream).then(
|
|
|
|
buffer => console.log(buffer.toString()) // eslint-disable-line no-console
|
|
|
|
);
|