fetch script improvements :D

This commit is contained in:
parent 5591880b1b
commit 752a80da08
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -2,20 +2,43 @@ import axios from "axios";
import {writeFileSync, mkdirSync} from "fs"; import {writeFileSync, mkdirSync} from "fs";
import {resolve} from "path"; import {resolve} from "path";
const freeKey = "qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc" const freeKey = "qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc";
const dirWhitelist = ["scripts", ".vscode"]; const skins = ["dark", "default", "document", "tinymce-5", "tinymce-5-dark", "writer"];
const uis = ["oxide", "oxide-dark", "tinymce-5", "tinymce-5-dark"];
const pluginList = 'ai tinycomments mentions anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed permanentpen footnotes advtemplate advtable advcode editimage tableofcontents mergetags powerpaste tinymcespellchecker autocorrect a11ychecker typography inlinecss'; const pluginList = 'ai tinycomments mentions anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed permanentpen footnotes advtemplate advtable advcode editimage tableofcontents mergetags powerpaste tinymcespellchecker autocorrect a11ychecker typography inlinecss';
const base = `https://cdn.tiny.cloud/1/${freeKey}/tinymce/6`
async function main() {
try {
let headers = { let headers = {
Referer: "http://tiny.cloud" Referer: "http://tiny.cloud"
} }
let base = `https://cdn.tiny.cloud/1/${freeKey}/tinymce/6`
async function fetchAux(path) {
const wpath = resolve(`..${path}`)
let {data: d} = await axios.get(`${base}${path}`, {headers})
writeFileSync(wpath, d);
}
async function main() {
try {
let {data: mainScript} = await axios.get(`${base}/tinymce.min.js`, {headers}) let {data: mainScript} = await axios.get(`${base}/tinymce.min.js`, {headers})
// writeFileSync(resolve("../models/dom/model.min.js"), (await axios.get(`${base}/models/dom/model.min.js`, {headers})).data)
writeFileSync(resolve("../tinymce.min.js"), mainScript); writeFileSync(resolve("../tinymce.min.js"), mainScript);
let {data: ts} = await axios.get(`${base}/tinymce.min.js`, {headers}) await fetchAux("/tinymce.d.ts");
writeFileSync(resolve("../tinymce.d.ts"), ts); await fetchAux("/models/dom/model.min.js");
await fetchAux("/icons/default/icons.min.js");
for(let t of skins) {
await fetchAux(`/skins/content/${t}/content.min.css`)
}
for(let u of uis) {
for(let c of [
"content.inline.min.css",
"content.min.css",
"skin.min.css",
"skin.shadowdom.min.css"
]) {
await fetchAux(`/skins/ui/${u}/${c}`)
}
}
for(let p of pluginList.split(" ")) { for(let p of pluginList.split(" ")) {
let {data} = await axios.get(`${base}/plugins/${p}/plugin.min.js`, {headers}); let {data} = await axios.get(`${base}/plugins/${p}/plugin.min.js`, {headers});
mkdirSync(resolve(`../plugins/${p}`), {recursive: true}) mkdirSync(resolve(`../plugins/${p}`), {recursive: true})