diff --git a/README.md b/README.md index 2462e5e..8abac10 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,6 @@ Now run the server: ``` npm i node index.js -``` \ No newline at end of file +``` + +You can now connect via [Elemental from Browser](https://git.dervland.net/elemental/elemental-from-browser), with the URL parameter ``?server=URL_HERE``; \ No newline at end of file diff --git a/index.js b/index.js index 6e7117a..4b72a9f 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ const app = express(); app.use(express.json()) app.set('trust proxy', true) -app.use(express.static('static')); +//app.use(express.static('static')); app.post('/', async function (req, res) { let ip = req.headers['X-Real-IP'] || req.ip; diff --git a/static/arrows/left.svg b/static/arrows/left.svg deleted file mode 100644 index 216f5bc..0000000 --- a/static/arrows/left.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/arrows/right.svg b/static/arrows/right.svg deleted file mode 100644 index 9145fe9..0000000 --- a/static/arrows/right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/index.css b/static/index.css deleted file mode 100644 index 97f2874..0000000 --- a/static/index.css +++ /dev/null @@ -1,94 +0,0 @@ -:root, -input, -button { - font-family: sans-serif; -} - -body { - margin: 0; - display: flex; - flex-direction: column; - justify-content: space-between; - height: 100vh; - -} - -#form { - background: rgba(0, 0, 0, 0.15); - padding: 0.25rem; - box-sizing: border-box; - backdrop-filter: blur(10px); - position: sticky; - bottom: 0; -} - -.inner-form { - display: flex; - flex-direction: row; - justify-content: center; -} - -#input { - border: none; - padding: 0 1rem; - border-radius: 0.3rem; - margin: 0.25rem; - height: 2rem; - flex-grow: 1; -} - -#input:focus { - outline: none; -} - -.inner-form>button { - background: #333; - border: none; - padding: 0 1rem; - margin: 0.25rem; - height: 2rem; - border-radius: 3px; - outline: none; - flex-grow: 1; -} - -button, button a { - color: #fff; - text-decoration: none; -} - -button a { - width: 100%; - height: 2rem; - text-align: center; - line-height:2rem; - vertical-align: middle; - display: inline-block; -} - -#messages { - list-style-type: none; - margin: 0; - padding: 0; -} - -#messages>li { - padding: 0.5rem 1rem; - white-space: pre-wrap; -} -#messages>li>li { - margin: 0; - line-height: 1em; - height: 1em; - padding-bottom: 0.1em; - overflow: hidden; -} - - -#messages>li>li>img { - height: 1.1em; -} - -#messages>li:nth-child(odd) { - background: #efefef; -} \ No newline at end of file diff --git a/static/index.html b/static/index.html deleted file mode 100644 index 6f7f524..0000000 --- a/static/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Dervland - - - - - - - -
-
- -
-
- - - -
-
- - -
-
- - - - \ No newline at end of file diff --git a/static/index.js b/static/index.js deleted file mode 100644 index ae6600c..0000000 --- a/static/index.js +++ /dev/null @@ -1,76 +0,0 @@ - -var messages = document.getElementById('messages'); -var form = document.getElementById('form'); -var input = document.getElementById('input'); -const server = new URLSearchParams(document.location.search).get('server') || '/'; - -async function goPage(count) { - let counter = input.value.match(/[^\s]+$/g); - if (!counter) return false; - - input.value = `${input.value.match(/^[^\s]+/g)[0]} ${counter[0] * 1 + count}`; - main(new Event('placeholder')); - return false; -} - -async function addMsg(msg) { - let lines = msg.split('\n'); - var wrap = document.createElement('li'); - - for (let line of lines) { - var item = document.createElement('li'); - item.textContent = line; - - if (line.startsWith('-') || line.startsWith('<')) { - let img = new Image(); - if (line.startsWith('<') || line[2] == '>') { - item.textContent = line.slice(3); - img.src = `arrows/left.svg`; - } else { - item.textContent = line.slice(2); - img.src = `arrows/right.svg`; - } - item.insertBefore(img, item.childNodes[0]) - } - wrap.appendChild(item); - } - messages.appendChild(wrap); - window.scrollTo(0, messages.offsetHeight); -} - -async function main(e) { - e.preventDefault(); - - if (!input.value) return false; - - let msg = await fetch(server, { - "method": "POST", - "headers": { - "content-type": "application/json", - }, - "body": JSON.stringify({ "data": input.value }) - }) - - msg = await msg.text(); - msg = msg.trim(); - - addMsg(input.value) - addMsg(msg) - - return false; -} - -form.addEventListener('submit', main); - -document.querySelector('.send').addEventListener('click', main); -document.querySelector('.prev').addEventListener('click', (e) => { e.preventDefault(); return goPage(1) }); -document.querySelector('.next').addEventListener('click', (e) => { e.preventDefault(); return goPage(-1) }); - - -input.value = '/help 1'; -goPage(0); - -setTimeout(function () { - input.value = '/inv 1'; - goPage(0); -}, 500) \ No newline at end of file