From e618c3f52c1c4ae161650679cda24eecbba579bb Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 4 Dec 2021 10:58:59 +0100 Subject: Code is now more cute! --- htdocs/public/metranslator/api/index.ejs | 33 ++++++ htdocs/public/metranslator/index.ejs | 194 +++++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+) create mode 100644 htdocs/public/metranslator/api/index.ejs create mode 100644 htdocs/public/metranslator/index.ejs (limited to 'htdocs/public/metranslator') diff --git a/htdocs/public/metranslator/api/index.ejs b/htdocs/public/metranslator/api/index.ejs new file mode 100644 index 0000000..47800bd --- /dev/null +++ b/htdocs/public/metranslator/api/index.ejs @@ -0,0 +1,33 @@ +<% + + res.writeHead(200, {'Content-Type': "application/json"}); + + if (get['t']) { + if (get['t'] === "en") { + target = "en"; + } else { + target = "mt"; + } + } else { + res.end(); + } + + if (get['u']) { + text = get['u']; + + if (text.length > 500) { + res.end(); + } + + text = text.split("\"").join("''"); + } else { + res.end(); + } + + aw = JSON.parse(child_process.execSync(`cd /mnt/metranslator-api && node index.js api ${target} "${text}"`).toString()); + last = child_process.execSync("cd /mnt/metranslator-api && git log -1 --pretty=format:'%an'") + aw["system"]["version"] = aw["system"]["version"] + "-" + fs.readFileSync("/mnt/metranslator-api/.git/refs/heads/trunk").toString().substr(0, 8); + aw["system"]["last_author"] = last; + aw["call"] = "cd /mnt/metranslator-api && node index.js api {$target} \"{$text}\""; + + %><%- JSON.stringify(aw); %> \ No newline at end of file diff --git a/htdocs/public/metranslator/index.ejs b/htdocs/public/metranslator/index.ejs new file mode 100644 index 0000000..943d772 --- /dev/null +++ b/htdocs/public/metranslator/index.ejs @@ -0,0 +1,194 @@ +<% global.title = "MeTranslator"; %> +<%- include(`${private}/header.ejs`) %> + +← <%- lang.global.back %> + +
+ +
+ + +

Metroz Translate

+

💡 Click one of the languages to invert

+
+
+

+ English

+ + +
+
+

+ Metroz

+
+ +
+
+
+ No facts available about this text +
+ +
+ Translator Insights +
    +
  • Database Name: n/a
  • +
  • Database Version: n/a
  • +
  • Database Size: n/a
  • +
  • Processing Time: n/a
  • +
+
+
+ + +<%- include(`${private}/footer.ejs`) %> \ No newline at end of file -- cgit