From 55cddd10fe949aafee843a576a5e0bf012702489 Mon Sep 17 00:00:00 2001
From: Floorb <132411956+Neetpone@users.noreply.github.com>
Date: Wed, 25 Aug 2021 02:08:30 -0400
Subject: [PATCH] code
---
.gitignore | 9 +-
api/ajax_pastes.php | 1 -
assets/bundle.js | 126 ++++
assets/bundle.min.js | 2 +
assets/bundle.min.js.map | 1 +
babel.config.json | 3 +
includes/common.php | 6 +-
includes/config.php | 18 +-
js/main.js | 17 +
js/tag_input.js | 2 +
package.json | 15 +
rollup.config.js | 18 +
theme/bulma/common.php | 37 +-
yarn-error.log | 1319 ++++++++++++++++++++++++++++++++++++
yarn.lock | 1368 ++++++++++++++++++++++++++++++++++++++
15 files changed, 2894 insertions(+), 48 deletions(-)
create mode 100644 assets/bundle.js
create mode 100644 assets/bundle.min.js
create mode 100644 assets/bundle.min.js.map
create mode 100644 babel.config.json
create mode 100644 js/main.js
create mode 100644 package.json
create mode 100644 rollup.config.js
create mode 100644 yarn-error.log
create mode 100644 yarn.lock
diff --git a/.gitignore b/.gitignore
index 1c1b8b0..253937d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
tmp/temp.tdata
sitemap.xml
-
+node_modules/
+npm-debug.log
+yarn-error.log
+.yarn/*
+!.yarn/releases
+!.yarn/plugins
+!.yarn/sdks
+!.yarn/versions
diff --git a/api/ajax_pastes.php b/api/ajax_pastes.php
index cc2b43b..9d56d55 100644
--- a/api/ajax_pastes.php
+++ b/api/ajax_pastes.php
@@ -2,7 +2,6 @@
header('Content-Type: application/json; charset=UTF-8');
define('IN_PONEPASTE', 1);
-//require_once('../includes/config.php');
require_once('../includes/common.php');
require_once('../includes/NonRetardedSSP.class.php');
diff --git a/assets/bundle.js b/assets/bundle.js
new file mode 100644
index 0000000..c639e17
--- /dev/null
+++ b/assets/bundle.js
@@ -0,0 +1,126 @@
+function htmlToElement(html) {
+ const template = document.createElement('template');
+
+ template.innerHTML = html.trim();
+
+ return template.content.firstChild;
+}
+
+function escapeHtml(unsafe) {
+ return unsafe
+ .replace(/&/g, "&")
+ .replace(//g, ">")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+}
+
+class TagsInput {
+ constructor(element, options = {}) {
+ this.element = element;
+ this.tags = [];
+ this.options = options;
+
+ this.maxTags = options.maxTags || 10;
+ this.inputNode = null;
+ this.containerNode = null;
+ }
+
+ attach() {
+ this.element.style.display = 'none';
+
+ this.containerNode = htmlToElement('
');
+ this.inputNode = htmlToElement('');
+ this.containerNode.appendChild(this.inputNode);
+
+ this.element.parentNode.insertBefore(this.containerNode, this.element.nextSibling);
+
+ /* Handle addition and removal of tags via key-presses */
+ this.containerNode.addEventListener('keydown', this._handleInputKeyUp.bind(this));
+
+ /* Handle deletions by clicking the delete button */
+ this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));
+ }
+
+ detach() {
+ this.tags.clear();
+ this.containerNode.remove();
+ this.element.style.display = 'inline-block';
+ }
+
+ updateHiddenInputValue() {
+ this.element.value = this.tags.join(',');
+ }
+
+ deleteTagNode(node) {
+ this.tags.splice(this.tags.indexOf(node.dataset.value.toLowerCase()), 1);
+ node.remove();
+
+ /* Below the limit? Make sure the input is enabled. */
+ if (this.tags.length < this.maxTags) {
+ this.inputNode.disabled = false;
+ }
+ }
+
+ addTag(tagValue) {
+ tagValue = tagValue.trim();
+
+ /* Tag value is probably not empty and we don't already have the same tag. */
+ if (tagValue !== '' && this.tags.indexOf(tagValue.toLowerCase()) === -1) {
+ this.tags.push(tagValue.toLowerCase());
+
+ this.inputNode.parentNode.insertBefore(
+ htmlToElement('' + escapeHtml(tagValue) + ''),
+ this.inputNode
+ );
+
+ /* Too many tags, disable the input for now. */
+ if (this.tags.length >= this.maxTags) {
+ this.inputNode.disabled = true;
+ }
+ }
+ }
+
+ _handleInputKeyUp(evt) {
+ let tagValue = this.inputNode.value;
+
+ if (evt.key === 'Backspace' && tagValue === '') {
+ // Remove the child
+ if (this.inputNode.previousSibling) {
+ this.deleteTagNode(this.inputNode.previousSibling);
+
+ this.updateHiddenInputValue();
+ }
+ } else if (evt.key === ',') {
+ this.addTag(tagValue);
+
+ this.inputNode.value = '';
+ this.updateHiddenInputValue();
+
+ evt.preventDefault();
+ }
+ }
+
+ _handleContainerClick(evt) {
+ if (evt.target && evt.target.classList.contains('delete')) {
+ this.deleteTagNode(evt.target.closest('.tag'));
+ this.updateHiddenInputValue();
+ }
+ }
+}
+
+class Meme {
+ constructor() {
+ alert('xss');
+ }
+
+ meme() {
+ console.log('meme');
+ }
+}
+
+const meme = new Meme();
+
+meme.meme();
+
+new TagsInput(null);
diff --git a/assets/bundle.min.js b/assets/bundle.min.js
new file mode 100644
index 0000000..07602c0
--- /dev/null
+++ b/assets/bundle.min.js
@@ -0,0 +1,2 @@
+function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n/g,">").replace(/"/g,""").replace(/'/g,"'")}var s=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(this,t),this.element=n,this.tags=[],this.options=i,this.maxTags=i.maxTags||10,this.inputNode=null,this.containerNode=null}return n(t,[{key:"attach",value:function(){this.element.style.display="none",this.containerNode=i(''),this.inputNode=i(''),this.containerNode.appendChild(this.inputNode),this.element.parentNode.insertBefore(this.containerNode,this.element.nextSibling),this.containerNode.addEventListener("keydown",this._handleInputKeyUp.bind(this)),this.containerNode.addEventListener("click",this._handleContainerClick.bind(this))}},{key:"detach",value:function(){this.tags.clear(),this.containerNode.remove(),this.element.style.display="inline-block"}},{key:"updateHiddenInputValue",value:function(){this.element.value=this.tags.join(",")}},{key:"deleteTagNode",value:function(e){this.tags.splice(this.tags.indexOf(e.dataset.value.toLowerCase()),1),e.remove(),this.tags.length'+a(e)+''),this.inputNode),this.tags.length>=this.maxTags&&(this.inputNode.disabled=!0))}},{key:"_handleInputKeyUp",value:function(e){var t=this.inputNode.value;"Backspace"===e.key&&""===t?this.inputNode.previousSibling&&(this.deleteTagNode(this.inputNode.previousSibling),this.updateHiddenInputValue()):","===e.key&&(this.addTag(t),this.inputNode.value="",this.updateHiddenInputValue(),e.preventDefault())}},{key:"_handleContainerClick",value:function(e){e.target&&e.target.classList.contains("delete")&&(this.deleteTagNode(e.target.closest(".tag")),this.updateHiddenInputValue())}}]),t}();(new(function(){function t(){e(this,t),alert("xss")}return n(t,[{key:"meme",value:function(){console.log("meme")}}]),t}())).meme(),new s(null);
+//# sourceMappingURL=bundle.min.js.map
diff --git a/assets/bundle.min.js.map b/assets/bundle.min.js.map
new file mode 100644
index 0000000..70a8a93
--- /dev/null
+++ b/assets/bundle.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"bundle.min.js","sources":["../js/tag_input.js","../js/main.js"],"sourcesContent":["function htmlToElement(html) {\n const template = document.createElement('template');\n\n template.innerHTML = html.trim();\n\n return template.content.firstChild;\n}\n\nfunction escapeHtml(unsafe) {\n return unsafe\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\nclass TagsInput {\n constructor(element, options = {}) {\n this.element = element;\n this.tags = [];\n this.options = options\n\n this.maxTags = options.maxTags || 10;\n this.inputNode = null;\n this.containerNode = null;\n }\n\n attach() {\n this.element.style.display = 'none';\n\n this.containerNode = htmlToElement('');\n this.inputNode = htmlToElement('');\n this.containerNode.appendChild(this.inputNode);\n\n this.element.parentNode.insertBefore(this.containerNode, this.element.nextSibling);\n\n /* Handle addition and removal of tags via key-presses */\n this.containerNode.addEventListener('keydown', this._handleInputKeyUp.bind(this));\n\n /* Handle deletions by clicking the delete button */\n this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));\n }\n\n detach() {\n this.tags.clear();\n this.containerNode.remove();\n this.element.style.display = 'inline-block';\n }\n\n updateHiddenInputValue() {\n this.element.value = this.tags.join(',');\n }\n\n deleteTagNode(node) {\n this.tags.splice(this.tags.indexOf(node.dataset.value.toLowerCase()), 1);\n node.remove();\n\n /* Below the limit? Make sure the input is enabled. */\n if (this.tags.length < this.maxTags) {\n this.inputNode.disabled = false;\n }\n }\n\n addTag(tagValue) {\n tagValue = tagValue.trim();\n\n /* Tag value is probably not empty and we don't already have the same tag. */\n if (tagValue !== '' && this.tags.indexOf(tagValue.toLowerCase()) === -1) {\n this.tags.push(tagValue.toLowerCase());\n\n this.inputNode.parentNode.insertBefore(\n htmlToElement('' + escapeHtml(tagValue) + ''),\n this.inputNode\n );\n\n /* Too many tags, disable the input for now. */\n if (this.tags.length >= this.maxTags) {\n this.inputNode.disabled = true;\n }\n }\n }\n\n _handleInputKeyUp(evt) {\n let tagValue = this.inputNode.value;\n\n if (evt.key === 'Backspace' && tagValue === '') {\n // Remove the child\n if (this.inputNode.previousSibling) {\n this.deleteTagNode(this.inputNode.previousSibling);\n\n this.updateHiddenInputValue();\n }\n } else if (evt.key === ',') {\n this.addTag(tagValue);\n\n this.inputNode.value = ''\n this.updateHiddenInputValue();\n\n evt.preventDefault();\n }\n }\n\n _handleContainerClick(evt) {\n if (evt.target && evt.target.classList.contains('delete')) {\n this.deleteTagNode(evt.target.closest('.tag'));\n this.updateHiddenInputValue();\n }\n }\n}\n\nexport { TagsInput };","import { TagsInput } from './tag_input';\n\nclass Meme {\n constructor() {\n alert('xss');\n }\n\n meme() {\n console.log('meme');\n }\n}\n\nconst meme = new Meme();\n\nmeme.meme();\n\nnew TagsInput(null);"],"names":["htmlToElement","html","template","document","createElement","innerHTML","trim","content","firstChild","escapeHtml","unsafe","replace","TagsInput","element","options","tags","maxTags","inputNode","containerNode","style","display","appendChild","this","parentNode","insertBefore","nextSibling","addEventListener","_handleInputKeyUp","bind","_handleContainerClick","clear","remove","value","join","node","splice","indexOf","dataset","toLowerCase","length","disabled","tagValue","push","evt","key","previousSibling","deleteTagNode","updateHiddenInputValue","addTag","preventDefault","target","classList","contains","closest","alert","console","log","meme"],"mappings":"6TAAA,SAASA,EAAcC,OACbC,EAAWC,SAASC,cAAc,mBAExCF,EAASG,UAAYJ,EAAKK,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AAU4B,uBACVC,cAAcxB,KAAKL,UAAU4B,sBAE7BE,0BAEU,MAAZJ,EAAIC,WACNI,OAAOP,QAEPxB,UAAUe,MAAQ,QAClBe,yBAELJ,EAAIM,uDAIZ,SAAsBN,GACdA,EAAIO,QAAUP,EAAIO,OAAOC,UAAUC,SAAS,iBACvCN,cAAcH,EAAIO,OAAOG,QAAQ,cACjCN,oCC9FJ,sCARLO,MAAM,qCAGV,WACIC,QAAQC,IAAI,mBAMfC,OAEL,IAAI7C,EAAU"}
\ No newline at end of file
diff --git a/babel.config.json b/babel.config.json
new file mode 100644
index 0000000..8aa924d
--- /dev/null
+++ b/babel.config.json
@@ -0,0 +1,3 @@
+{
+ "presets": ["@babel/preset-env"]
+}
\ No newline at end of file
diff --git a/includes/common.php b/includes/common.php
index 1997ab6..72ede7c 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -117,12 +117,12 @@ $default_theme = $lang_and_theme['theme'];
// Site permissions
$site_permissions = $site_info['permissions'];
+$site_is_private = false;
+$site_disable_guests = false;
+
if ($site_permissions) {
$site_is_private = (bool) $site_permissions['private'];
$site_disable_guests = (bool) $site_permissions['disable_guest'];
-} else {
- $site_is_private = false;
- $site_disable_guests = false;
}
// CAPTCHA configuration
diff --git a/includes/config.php b/includes/config.php
index 340bee8..85da325 100644
--- a/includes/config.php
+++ b/includes/config.php
@@ -1,18 +1,6 @@
",
+ "license": "MIT"
+}
diff --git a/rollup.config.js b/rollup.config.js
new file mode 100644
index 0000000..c5a0fdc
--- /dev/null
+++ b/rollup.config.js
@@ -0,0 +1,18 @@
+import { getBabelOutputPlugin } from '@rollup/plugin-babel';
+import { terser } from 'rollup-plugin-terser';
+
+export default {
+ input: 'js/main.js',
+ output: [
+ {
+ file: 'assets/bundle.js',
+ format: 'esm'
+ },
+ {
+ file: 'assets/bundle.min.js',
+ format: 'esm',
+ plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] }), terser()],
+ sourcemap: true
+ }
+ ]
+};
diff --git a/theme/bulma/common.php b/theme/bulma/common.php
index 92fb8fa..cca5350 100644
--- a/theme/bulma/common.php
+++ b/theme/bulma/common.php
@@ -5,19 +5,14 @@ if (!in_array($page_template . '.php', $template_candidates)) {
die('Failed to find template');
}
-//$page_content = ob_get_clean();
-$date = time();
-$statrttime = microtime();
-$time = explode(' ', $statrttime);
-$time = $time[1] + $time[0];
-$start = $time;
+$start = microtime(true);
?>
">
-
-
+
+
/theme/bulma/js/datatables.min.js">
+
@@ -209,8 +205,7 @@ $start = $time;
-
+