1234567891011121314151617181920212223242526272829 |
- /**
- * API САЙТА lycArch.urfu.ru
- * Copyright © 2021, А.М.Гольдин. ISC license
- */
- "use strict";
- // Подключение необходимых модулей API
- const modReq = [
- "officeEdit", "createFolder", "getArticles", "delArticle", "delFile",
- "sendArticle", "loadArticle", "getFields", "goCoAuth", "artInfo",
- "artsWork", "sendNotes", "getRevCorr", "setRevCorr", "puplication",
- "fullDel", "getRevCorID", "corrEnd", "find"
- ];
- let mod = {};
- for (let modName of modReq) mod[modName] = require("./" + modName);
- module.exports = async (post, user) => {
-
- // Разбираем переданные в аргументе POST-данные
- let postDt;
- try {postDt = JSON.parse(post);} catch (e) {return "none";}
- if (!postDt.f) postDt.f = "noFunc";
-
- // Реализуем соответствующую функцию api в зависимости от переменной f
- if (!modReq.includes(postDt.f)) return "none";
- let argsObj = postDt.dt || {};
- return (await mod[postDt.f](argsObj, user));
- }
|