fuck-tiny-cloud/scripts/fetchLatest.js

59 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

import axios from "axios";
2024-01-10 14:13:07 -05:00
import {writeFileSync, mkdirSync, existsSync} from "fs";
import {resolve, dirname} from "path";
2024-01-09 20:10:19 -05:00
const freeKey = "qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc";
const skins = ["dark", "default", "document", "tinymce-5", "tinymce-5-dark", "writer"];
const uis = ["oxide", "oxide-dark", "tinymce-5", "tinymce-5-dark"];
2024-03-21 17:14:38 -04:00
const pluginList = "a11ychecker advcode advtable advtemplate typography ai casechange checklist tinycomments editimage mediaembed export footnotes formatpainter inlinecss linkchecker mentions mergetags moxiemanager pageembed permanentpen powerpaste rtc tinymcespellchecker autocorrect tableofcontents tinydrive accordion advlist anchor autolink autoresize autosave charmap code codesample directionality emoticons fullscreen help image importcss insertdatetime link lists media nonbreaking pagebreak preview quickbars save searchreplace table template visualblocks visualchars wordcount";
const base = `https://cdn.tiny.cloud/1/${freeKey}/tinymce/7`
2024-01-09 20:10:19 -05:00
let headers = {
Referer: "http://tiny.cloud"
}
async function fetchAux(path) {
const wpath = resolve(`..${path}`)
2024-01-10 14:13:07 -05:00
if(!existsSync(wpath)) mkdirSync(dirname(wpath), {recursive: true})
let {data: d} = await axios.get(`${base}${path}`, {headers});
2024-01-09 20:10:19 -05:00
writeFileSync(wpath, d);
}
async function main() {
try {
let {data: mainScript} = await axios.get(`${base}/tinymce.min.js`, {headers})
2024-01-09 20:10:19 -05:00
// writeFileSync(resolve("../models/dom/model.min.js"), (await axios.get(`${base}/models/dom/model.min.js`, {headers})).data)
writeFileSync(resolve("../tinymce.min.js"), mainScript);
2024-01-09 20:10:19 -05:00
await fetchAux("/tinymce.d.ts");
await fetchAux("/models/dom/model.min.js");
await fetchAux("/icons/default/icons.min.js");
2024-01-10 14:19:25 -05:00
await fetchAux("/plugins/powerpaste/js/wordimport.js");
2024-01-10 14:21:21 -05:00
await fetchAux("/plugins/a11ychecker/css/annotations.css");
await fetchAux("/plugins/pageembed/css/empa30.css");
2024-01-10 14:28:22 -05:00
await fetchAux("/plugins/mediaembed/content.min.css");
await fetchAux("/plugins/tinycomments/css/tinycomments.css");
await fetchAux("/plugins/tinycomments/js/tinycomments-sidebar.min.js");
2024-01-09 20:10:19 -05:00
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(" ")) {
let {data} = await axios.get(`${base}/plugins/${p}/plugin.min.js`, {headers});
2024-01-10 14:13:07 -05:00
if(!existsSync(resolve(`../plugins/${p}`))) mkdirSync(resolve(`../plugins/${p}`), {recursive: true})
writeFileSync(resolve(`../plugins/${p}/plugin.min.js`), data)
}
} finally {
process.exit()
}
}
2024-03-21 17:14:38 -04:00
main()