Folders view tidy up, fix path with spaces, update url added to qmining

This commit is contained in:
MrFry 2019-10-24 15:05:08 +02:00
parent d5cf846433
commit 90de7e926b
5 changed files with 160 additions and 135 deletions

View file

@ -153,6 +153,12 @@ app.get('/greasy', function (req, res) {
logger.LogReq(req) logger.LogReq(req)
}) })
app.get('/update', function (req, res) {
res.redirect('http://qmining.frylabs.net/moodle-test-userscript/stable.user.js')
res.end()
logger.LogReq(req)
})
app.get('/install', function (req, res) { app.get('/install', function (req, res) {
res.redirect('http://qmining.frylabs.net/moodle-test-userscript/stable.user.js') res.redirect('http://qmining.frylabs.net/moodle-test-userscript/stable.user.js')
res.end() res.end()

View file

@ -49,7 +49,8 @@ app.use(bodyParser.json({
// -------------------------------------------------------------- // --------------------------------------------------------------
app.get('/*', function (req, res) { app.get('/*', function (req, res) {
let curr = listedFiles + '/' + req.url.substring('/'.length, req.url.length).split('?')[0] let parsedUrl = req.url.replace(/%20/g, " ")
let curr = listedFiles + '/' + parsedUrl.substring('/'.length, parsedUrl.length).split('?')[0]
let relPath = curr.substring('./public/files'.length, curr.length) let relPath = curr.substring('./public/files'.length, curr.length)
if (relPath[relPath.length - 1] !== '/') { relPath += '/' } if (relPath[relPath.length - 1] !== '/') { relPath += '/' }

@ -1 +1 @@
Subproject commit c935c9e078303b98d61d2d12bca3ab86e2695bdc Subproject commit fe74436ab119a31fdb35f7a3bbae50a572b0fb21

View file

@ -33,8 +33,8 @@ const logFile = '/nlogs/nlogs'
const allLogFile = '/nlogs/log' const allLogFile = '/nlogs/log'
const colors = [ const colors = [
'red',
'green', 'green',
'red',
'yellow', 'yellow',
'blue', 'blue',
'magenta', 'magenta',
@ -112,8 +112,8 @@ function C (c) {
if (c === 'redbg') { return '\x1b[41m' } if (c === 'redbg') { return '\x1b[41m' }
if (c === 'bluebg') { return '\x1b[44m' } if (c === 'bluebg') { return '\x1b[44m' }
if (c === 'red') { return '\x1b[31m' }
if (c === 'green') { return '\x1b[32m' } if (c === 'green') { return '\x1b[32m' }
if (c === 'red') { return '\x1b[31m' }
if (c === 'yellow') { return '\x1b[33m' } if (c === 'yellow') { return '\x1b[33m' }
if (c === 'blue') { return '\x1b[34m' } if (c === 'blue') { return '\x1b[34m' }
if (c === 'magenta') { return '\x1b[35m' } if (c === 'magenta') { return '\x1b[35m' }

View file

@ -5,6 +5,7 @@
<head> <head>
<title><%=dirname%></title> <title><%=dirname%></title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.6" />
<style> <style>
body { body {
font: normal 14px Verdana; font: normal 14px Verdana;
@ -12,7 +13,10 @@
} }
td { td {
vertical-align: top vertical-align: top;
word-wrap: break-word;
word-break: break-all;
table-layout: fixed;
} }
textarea { textarea {
@ -53,11 +57,6 @@
font-size: 13px; font-size: 13px;
} }
.active,
.butt:hover {
background-color: #555;
}
</style> </style>
</head> </head>
<center> <center>
@ -72,13 +71,16 @@
<% for (var i = 0; i < folders.length; i++) { %> <% for (var i = 0; i < folders.length; i++) { %>
<tr> <tr>
<td> <td>
<button class="butt"> <button
class="butt"
onclick='itemClick("<%= "http://stuff.frylabs.net" + folders[i].path %>")'
style='<%= i % 2 === 0 ? "background-color: #2f2f37" : "" %>'
onmouseenter='mouseEnter(this, <%= i %>)'
onmouseleave='mouseLeave(this, <%= i %>)'
>
<table class="subtable"> <table class="subtable">
<td style='width:30%;'> <td style='width:30%;'>
<a href="<%= "http://stuff.frylabs.net" + folders[i].path%>"> <%=folders[i].name %> </a> <%=folders[i].name %>
</td>
<td style='width:30%;'>
<%=folders[i].path %>
</td> </td>
<td style='width:20%;'> <td style='width:20%;'>
<%=folders[i].mtime %> <%=folders[i].mtime %>
@ -93,4 +95,20 @@
<% } %> <% } %>
</table> </table>
</body> </body>
<script>
console.log('hi')
function itemClick (e) {
location.href = e
}
function mouseEnter (e, i) {
e.style.backgroundColor = "#555"
}
function mouseLeave (e, i) {
if (i % 2 == 0) {
e.style.backgroundColor = "#2f2f37"
} else {
e.style.backgroundColor = "#212127"
}
}
</script>
</html> </html>