mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
merge
This commit is contained in:
commit
19246d6931
14 changed files with 425 additions and 239 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
const siteUrl = 'https://qmining.frylabs.net' // http(s)//asd.basd
|
||||
let url = '' // http(s)//asd.basd
|
||||
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
@ -49,7 +49,7 @@ app.use(bodyParser.json({
|
|||
|
||||
app.get('/', function (req, res) {
|
||||
res.render('main/main', {
|
||||
siteurl: siteUrl
|
||||
siteurl: url
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -65,5 +65,8 @@ app.post('*', function (req, res) {
|
|||
})
|
||||
|
||||
exports.app = app
|
||||
exports.setup = (x) => {
|
||||
url = x.url
|
||||
}
|
||||
|
||||
logger.Log('Main module started', logger.GetColor('yellow'))
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
let url = ''
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
|
||||
|
@ -26,17 +27,20 @@ const logger = require('../utils/logger.js')
|
|||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.redirect('https://qmining.frylabs.net' + req.url)
|
||||
res.redirect(url + req.url)
|
||||
})
|
||||
|
||||
app.get('*', function (req, res) {
|
||||
res.redirect('https://qmining.frylabs.net' + req.url)
|
||||
res.redirect(url + req.url)
|
||||
})
|
||||
|
||||
app.post('*', function (req, res) {
|
||||
res.redirect('https://qmining.frylabs.net' + req.url)
|
||||
res.redirect(url + req.url)
|
||||
})
|
||||
|
||||
exports.app = app
|
||||
exports.setup = (x) => {
|
||||
url = x.url
|
||||
}
|
||||
|
||||
logger.Log('Old module started', logger.GetColor('yellow'))
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
const siteUrl = 'https://qmining.frylabs.net' // http(s)//asd.basd
|
||||
let url = ''
|
||||
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
@ -59,7 +59,7 @@ app.get('/', function (req, res) {
|
|||
// req.hostname
|
||||
|
||||
res.render('qmining/main', {
|
||||
siteurl: siteUrl,
|
||||
siteurl: url,
|
||||
qa: actions.ProcessQA()
|
||||
})
|
||||
res.end()
|
||||
|
@ -82,7 +82,7 @@ app.get('/legacy', function (req, res) {
|
|||
data: d,
|
||||
scount: scount,
|
||||
qcount: qcount,
|
||||
siteurl: siteUrl
|
||||
siteurl: url
|
||||
})
|
||||
|
||||
logger.LogReq(req)
|
||||
|
@ -135,7 +135,13 @@ app.get('/greasy', function (req, res) {
|
|||
})
|
||||
|
||||
app.get('/install', function (req, res) {
|
||||
res.redirect(siteUrl + '/moodle-test-userscript/stable.user.js?install')
|
||||
res.redirect(url + '/moodle-test-userscript/stable.user.js?install')
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/install', function (req, res) {
|
||||
res.redirect(url + '/moodle-test-userscript/stable.user.js')
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
@ -206,5 +212,8 @@ app.post('*', function (req, res) {
|
|||
})
|
||||
|
||||
exports.app = app
|
||||
exports.setup = (x) => {
|
||||
url = x.url
|
||||
}
|
||||
|
||||
logger.Log('Qmining module started', logger.GetColor('yellow'))
|
||||
|
|
|
@ -23,6 +23,7 @@ const bodyParser = require('body-parser')
|
|||
const busboy = require('connect-busboy')
|
||||
const fs = require('fs')
|
||||
const app = express()
|
||||
let url = ''
|
||||
|
||||
const logger = require('../utils/logger.js')
|
||||
// const utils = require('../utils/utils.js')
|
||||
|
@ -49,7 +50,8 @@ app.use(bodyParser.json({
|
|||
// --------------------------------------------------------------
|
||||
|
||||
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)
|
||||
|
||||
if (relPath[relPath.length - 1] !== '/') { relPath += '/' }
|
||||
|
@ -63,37 +65,45 @@ app.get('/*', function (req, res) {
|
|||
|
||||
logger.LogReq(req)
|
||||
|
||||
if (fs.lstatSync(curr).isDirectory()) {
|
||||
if (curr[curr.length - 1] !== '/') { curr += '/' }
|
||||
try {
|
||||
if (fs.lstatSync(curr).isDirectory()) {
|
||||
if (curr[curr.length - 1] !== '/') { curr += '/' }
|
||||
|
||||
let f = []
|
||||
let f = []
|
||||
|
||||
fs.readdirSync(curr).forEach((item) => {
|
||||
if (item[0] !== '.') {
|
||||
let res = { name: item }
|
||||
let stats = fs.statSync(curr + '/' + item)
|
||||
fs.readdirSync(curr).forEach((item) => {
|
||||
if (item[0] !== '.') {
|
||||
let res = { name: item }
|
||||
let stats = fs.statSync(curr + '/' + item)
|
||||
|
||||
let fileSizeInBytes = stats['size']
|
||||
res.size = Math.round(fileSizeInBytes / 1000000)
|
||||
let fileSizeInBytes = stats['size']
|
||||
res.size = Math.round(fileSizeInBytes / 1000000)
|
||||
|
||||
res.path = relPath
|
||||
if (res.path[res.path.length - 1] !== '/') { res.path += '/' }
|
||||
res.path += item
|
||||
res.path = relPath
|
||||
if (res.path[res.path.length - 1] !== '/') { res.path += '/' }
|
||||
res.path += item
|
||||
|
||||
res.mtime = stats['mtime'].toLocaleString()
|
||||
res.mtime = stats['mtime'].toLocaleString()
|
||||
|
||||
f.push(res)
|
||||
}
|
||||
f.push(res)
|
||||
}
|
||||
})
|
||||
|
||||
res.render('stuff/folders', {
|
||||
folders: f,
|
||||
dirname: relPath,
|
||||
prevDir,
|
||||
url
|
||||
})
|
||||
} else {
|
||||
let fileStream = fs.createReadStream(curr)
|
||||
fileStream.pipe(res)
|
||||
}
|
||||
} catch (e) {
|
||||
res.render('stuff/nofile', {
|
||||
missingFile: curr,
|
||||
url
|
||||
})
|
||||
|
||||
res.render('stuff/folders', {
|
||||
folders: f,
|
||||
dirname: relPath,
|
||||
prevDir
|
||||
})
|
||||
} else {
|
||||
let fileStream = fs.createReadStream(curr)
|
||||
fileStream.pipe(res)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -111,5 +121,8 @@ app.post('*', function (req, res) {
|
|||
})
|
||||
|
||||
exports.app = app
|
||||
exports.setup = (x) => {
|
||||
url = x.url
|
||||
}
|
||||
|
||||
logger.Log('Stuff module started', logger.GetColor('yellow'))
|
||||
|
|
97
server.js
97
server.js
|
@ -32,11 +32,69 @@ const https = require('https')
|
|||
const stat = require('./utils/stat.js')
|
||||
stat.Load()
|
||||
|
||||
const qmining = require('./modules/qmining.js').app
|
||||
const main = require('./modules/main.js').app
|
||||
const sio = require('./modules/sio.js').app
|
||||
const stuff = require('./modules/stuff.js').app
|
||||
const old = require('./modules/old.js').app
|
||||
const loggableKeywords = [
|
||||
'user.js'
|
||||
]
|
||||
let modules = {
|
||||
qmining: {
|
||||
path: './modules/qmining.js',
|
||||
name: 'qmining',
|
||||
urls: [ 'qmining.frylabs.net', 'localhost' ]
|
||||
},
|
||||
main: {
|
||||
path: './modules/main.js',
|
||||
name: 'main',
|
||||
urls: [ 'frylabs.net', 'www.frylabs.net' ]
|
||||
},
|
||||
sio: {
|
||||
path: './modules/sio.js',
|
||||
name: 'sio',
|
||||
urls: [ 'sio.frylabs.net' ]
|
||||
},
|
||||
stuff: {
|
||||
path: './modules/stuff.js',
|
||||
name: 'stuff',
|
||||
urls: [ 'stuff.frylabs.net' ]
|
||||
},
|
||||
old: {
|
||||
path: './modules/old.js',
|
||||
name: 'old',
|
||||
urls: [ 'qmining.tk', 'www.qmining.tk' ]
|
||||
}
|
||||
}
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
let toLog = loggableKeywords.some((x) => {
|
||||
return req.url.includes(x)
|
||||
})
|
||||
if (toLog) { logger.LogReq(req) }
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
next()
|
||||
})
|
||||
|
||||
|
||||
Object.keys(modules).forEach(function (k, i) {
|
||||
let x = modules[k]
|
||||
try {
|
||||
let mod = require(x.path)
|
||||
if (mod.setup) {
|
||||
mod.setup({
|
||||
url: 'http://' + x.urls[0] // TODO http https or neither
|
||||
})
|
||||
}
|
||||
x.app = mod.app
|
||||
x.urls.forEach((url) => {
|
||||
app.use(vhost(url, x.app))
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
|
||||
const locLogFile = './stats/logs'
|
||||
const allLogFile = '/nlogs/log'
|
||||
|
@ -93,35 +151,6 @@ function setLogTimer () {
|
|||
|
||||
setLogTimer()
|
||||
|
||||
const app = express()
|
||||
|
||||
const loggableKeywords = [
|
||||
'user.js'
|
||||
]
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
let toLog = loggableKeywords.some((x) => {
|
||||
return req.url.includes(x)
|
||||
})
|
||||
if (toLog) { logger.LogReq(req) }
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
next()
|
||||
})
|
||||
|
||||
app.use(vhost('qmining.frylabs.net', qmining))
|
||||
app.use(vhost('sio.frylabs.net', sio))
|
||||
app.use(vhost('stuff.frylabs.net', stuff))
|
||||
app.use(vhost('frylabs.net', main))
|
||||
app.use(vhost('www.frylabs.net', main))
|
||||
|
||||
app.use(vhost('qmining.tk', old))
|
||||
app.use(vhost('www.qmining.tk', old))
|
||||
|
||||
app.use(vhost('localhost', qmining))
|
||||
|
||||
logger.Log('Node version: ' + process.version)
|
||||
logger.Log('Listening on port: ' + port)
|
||||
|
||||
|
|
255
utils/logger.js
255
utils/logger.js
|
@ -1,121 +1,134 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
Question Server
|
||||
GitLab: <https://gitlab.com/MrFry/question-node-server>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
module.exports = {
|
||||
GetDateString: GetDateString,
|
||||
Log: Log,
|
||||
GetColor: GetColor,
|
||||
LogReq: LogReq
|
||||
}
|
||||
|
||||
const DELIM = C('green') + '|' + C()
|
||||
|
||||
const utils = require('../utils/utils.js')
|
||||
const locLogFile = './stats/logs'
|
||||
const logFile = '/nlogs/nlogs'
|
||||
const allLogFile = '/nlogs/log'
|
||||
|
||||
const colors = [
|
||||
'red',
|
||||
'green',
|
||||
'yellow',
|
||||
'blue',
|
||||
'magenta',
|
||||
'cyan'
|
||||
]
|
||||
|
||||
function GetDateString () {
|
||||
const m = new Date()
|
||||
const d = m.getFullYear() + '/' +
|
||||
('0' + (m.getMonth() + 1)).slice(-2) + '/' +
|
||||
('0' + m.getDate()).slice(-2) + ' ' +
|
||||
('0' + m.getHours()).slice(-2) + ':' +
|
||||
('0' + m.getMinutes()).slice(-2) + ':' +
|
||||
('0' + m.getSeconds()).slice(-2)
|
||||
return GetRandomColor(m.getHours().toString()) + d + C()
|
||||
}
|
||||
|
||||
function Log (s, c) {
|
||||
let dl = DELIM + C(c)
|
||||
let log = C(c) + GetDateString() + dl + s
|
||||
|
||||
console.log(log)
|
||||
utils.AppendToFile(log, logFile)
|
||||
}
|
||||
|
||||
function LogReq (req, toFile, sc) {
|
||||
try {
|
||||
let ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||
|
||||
let logEntry = GetRandomColor(ip) + ip + C()
|
||||
let dl = DELIM
|
||||
if (req.url.includes('lred')) {
|
||||
dl += C('red')
|
||||
}
|
||||
|
||||
logEntry += dl + req.hostname + dl + req.headers['user-agent'] + dl + req.method + dl
|
||||
|
||||
logEntry += GetRandomColor(req.url.split('?')[0]) + req.url
|
||||
|
||||
if (sc !== undefined && sc === 404) { logEntry += dl + sc }
|
||||
|
||||
logEntry += C()
|
||||
if (!toFile) {
|
||||
Log(logEntry)
|
||||
} else {
|
||||
let defLogs = GetDateString() + dl + logEntry
|
||||
|
||||
utils.AppendToFile(defLogs, locLogFile)
|
||||
utils.AppendToFile(defLogs, allLogFile)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
Log('Error at logging lol', GetColor('redbg'), true)
|
||||
}
|
||||
}
|
||||
|
||||
function GetRandomColor (ip) {
|
||||
if (!ip) {
|
||||
return 'red'
|
||||
}
|
||||
|
||||
let res = ip.split('').reduce((res, x) => {
|
||||
return res + x.charCodeAt(0)
|
||||
}, 0)
|
||||
return C(colors[res % colors.length])
|
||||
}
|
||||
|
||||
function GetColor (c) {
|
||||
return c
|
||||
}
|
||||
|
||||
function C (c) {
|
||||
if (c !== undefined) { c = c.toLowerCase() }
|
||||
|
||||
if (c === 'redbg') { return '\x1b[41m' }
|
||||
if (c === 'bluebg') { return '\x1b[44m' }
|
||||
if (c === 'red') { return '\x1b[31m' }
|
||||
if (c === 'green') { return '\x1b[32m' }
|
||||
if (c === 'yellow') { return '\x1b[33m' }
|
||||
if (c === 'blue') { return '\x1b[34m' }
|
||||
if (c === 'magenta') { return '\x1b[35m' }
|
||||
if (c === 'cyan') { return '\x1b[36m' }
|
||||
return '\x1b[0m'
|
||||
}
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
||||
Question Server
|
||||
GitLab: <https://gitlab.com/MrFry/question-node-server>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
module.exports = {
|
||||
GetDateString: GetDateString,
|
||||
Log: Log,
|
||||
GetColor: GetColor,
|
||||
LogReq: LogReq
|
||||
}
|
||||
|
||||
const DELIM = C('green') + '|' + C()
|
||||
|
||||
const utils = require('../utils/utils.js')
|
||||
const locLogFile = './stats/logs'
|
||||
const logFile = '/nlogs/nlogs'
|
||||
const allLogFile = '/nlogs/log'
|
||||
|
||||
const colors = [
|
||||
'green',
|
||||
'red',
|
||||
'yellow',
|
||||
'blue',
|
||||
'magenta',
|
||||
'cyan'
|
||||
]
|
||||
|
||||
let noLogips = utils.ReadFile('./nolog').split('\n')
|
||||
setInterval(() => {
|
||||
noLogips = utils.ReadFile('./nolog').split('\n')
|
||||
}, 1000 * 60 * 30)
|
||||
|
||||
function GetDateString () {
|
||||
const m = new Date()
|
||||
const d = m.getFullYear() + '/' +
|
||||
('0' + (m.getMonth() + 1)).slice(-2) + '/' +
|
||||
('0' + m.getDate()).slice(-2) + ' ' +
|
||||
('0' + m.getHours()).slice(-2) + ':' +
|
||||
('0' + m.getMinutes()).slice(-2) + ':' +
|
||||
('0' + m.getSeconds()).slice(-2)
|
||||
return GetRandomColor(m.getHours().toString()) + d + C()
|
||||
}
|
||||
|
||||
function Log (s, c) {
|
||||
let dl = DELIM + C(c)
|
||||
let log = C(c) + GetDateString() + dl + s
|
||||
|
||||
console.log(log)
|
||||
utils.AppendToFile(log, logFile)
|
||||
}
|
||||
|
||||
function LogReq (req, toFile, sc) {
|
||||
try {
|
||||
let ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||
|
||||
let nolog = noLogips.some((x) => {
|
||||
return x.includes(ip)
|
||||
})
|
||||
if (nolog) {
|
||||
return
|
||||
}
|
||||
|
||||
let logEntry = GetRandomColor(ip) + ip + C()
|
||||
let dl = DELIM
|
||||
if (req.url.includes('lred')) {
|
||||
dl += C('red')
|
||||
}
|
||||
|
||||
const hostname = req.hostname.replace('www.', '').split('.')[0]
|
||||
logEntry += dl + hostname + dl + req.headers['user-agent'] + dl + req.method + dl
|
||||
|
||||
logEntry += GetRandomColor(req.url.split('?')[0]) + req.url
|
||||
|
||||
if (sc !== undefined && sc === 404) { logEntry += dl + sc }
|
||||
|
||||
logEntry += C()
|
||||
if (!toFile) {
|
||||
Log(logEntry)
|
||||
} else {
|
||||
let defLogs = GetDateString() + dl + logEntry
|
||||
|
||||
utils.AppendToFile(defLogs, locLogFile)
|
||||
utils.AppendToFile(defLogs, allLogFile)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
Log('Error at logging lol', GetColor('redbg'), true)
|
||||
}
|
||||
}
|
||||
|
||||
function GetRandomColor (ip) {
|
||||
if (!ip) {
|
||||
return 'red'
|
||||
}
|
||||
|
||||
let res = ip.split('').reduce((res, x) => {
|
||||
return res + x.charCodeAt(0)
|
||||
}, 0)
|
||||
return C(colors[res % colors.length])
|
||||
}
|
||||
|
||||
function GetColor (c) {
|
||||
return c
|
||||
}
|
||||
|
||||
function C (c) {
|
||||
if (c !== undefined) { c = c.toLowerCase() }
|
||||
|
||||
if (c === 'redbg') { return '\x1b[41m' }
|
||||
if (c === 'bluebg') { return '\x1b[44m' }
|
||||
if (c === 'green') { return '\x1b[32m' }
|
||||
if (c === 'red') { return '\x1b[31m' }
|
||||
if (c === 'yellow') { return '\x1b[33m' }
|
||||
if (c === 'blue') { return '\x1b[34m' }
|
||||
if (c === 'magenta') { return '\x1b[35m' }
|
||||
if (c === 'cyan') { return '\x1b[36m' }
|
||||
return '\x1b[0m'
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<head>
|
||||
<title>FryLabs.net</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<head>
|
||||
<title>All questions</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
@ -79,7 +80,12 @@
|
|||
<% include aludni.ejs %>
|
||||
|
||||
<% for (var i = 0; i < data.Subjects.length; i++) { %>
|
||||
<button class="collapsible">
|
||||
<button
|
||||
class="collapsible"
|
||||
style='<%= i % 2 === 0 ? "background-color: #2f2f37" : "" %>'
|
||||
onmouseenter='mouseEnter(this, <%= i %>)'
|
||||
onmouseleave='mouseLeave(this, <%= i %>)'
|
||||
>
|
||||
<h2>
|
||||
<table id=<%=i%>>
|
||||
<td>
|
||||
|
@ -90,41 +96,51 @@
|
|||
</td>
|
||||
</table>
|
||||
</h2>
|
||||
</button>
|
||||
</button>
|
||||
<div class="content">
|
||||
<% var a = data.Subjects[i].toString().split('\n')%>
|
||||
<% for (var j = 1; j < a.length; j++) { %>
|
||||
<% if (a[j][0] == '?') { %>
|
||||
</br>
|
||||
<% } %>
|
||||
<%=a[j] %>
|
||||
</br>
|
||||
<% } %>
|
||||
<% for (var j = 1; j < a.length; j++) { %>
|
||||
<% if (a[j][0] == '?') { %>
|
||||
</br>
|
||||
<% } %>
|
||||
<%=a[j] %>
|
||||
</br>
|
||||
<% } %>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
var coll = document.getElementsByClassName("collapsible");
|
||||
var i;
|
||||
<script>
|
||||
var coll = document.getElementsByClassName("collapsible");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < coll.length; i++) {
|
||||
coll[i].addEventListener("click", function() {
|
||||
this.classList.toggle("active");
|
||||
var content = this.nextElementSibling;
|
||||
if (content.style.display === "block") {
|
||||
content.style.display = "none";
|
||||
} else {
|
||||
content.style.display = "block";
|
||||
}
|
||||
});
|
||||
}
|
||||
function openall () {
|
||||
var coll = document.getElementsByClassName("content");
|
||||
var i;
|
||||
for (i = 0; i < coll.length; i++) {
|
||||
coll[i].style.display = "block";
|
||||
}
|
||||
for (i = 0; i < coll.length; i++) {
|
||||
coll[i].addEventListener("click", function() {
|
||||
this.classList.toggle("active");
|
||||
var content = this.nextElementSibling;
|
||||
if (content.style.display === "block") {
|
||||
content.style.display = "none";
|
||||
} else {
|
||||
content.style.display = "block";
|
||||
}
|
||||
</script>
|
||||
});
|
||||
}
|
||||
function openall () {
|
||||
var coll = document.getElementsByClassName("content");
|
||||
var i;
|
||||
for (i = 0; i < coll.length; i++) {
|
||||
coll[i].style.display = "block";
|
||||
}
|
||||
}
|
||||
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>
|
||||
<% include b.ejs %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<head>
|
||||
<title>All questions</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<head>
|
||||
<title>Question mining</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
<head>
|
||||
<title>Moodle/Elearning/KMOOC manual</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 17px Verdana;
|
||||
|
@ -196,12 +198,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
<hr> Jogosultságok:
|
||||
</br>GM_openInTab: help megnyitása új lapon, GM_xmlhttpRequest: online adatbázishoz.
|
||||
GM_getResourceText: a txt beolvasáshoz. Mást nem bír beolvasni, csak amit megadsz a @resouces
|
||||
tagnál. GM_info: a scriptről információ, a verzióváltozás érzékeléséhez. GM_getValue/
|
||||
GM_setValue: oldal bezárásakor megmaradó változók kezelése. Előző verzió tárolására, ugyanúgy
|
||||
verzióváltozás érzékeléséhez, néhány beállítás, illetve hogy melyik tárgyakból keressen
|
||||
kérdéseket. Ezek függvények, és a sciptben néhol meg vannak hívva, keresd meg.
|
||||
</br>GM_openInTab: help megnyitása új lapon, GM_xmlhttpRequest: online adatbázishoz. GM_info: a
|
||||
scriptről információ, a verzióváltozás érzékeléséhez. GM_getValue/ GM_setValue: oldal
|
||||
bezárásakor megmaradó változók kezelése. Előző verzió tárolására, ugyanúgy verzióváltozás
|
||||
érzékeléséhez, néhány beállítás, illetve hogy melyik tárgyakból keressen kérdéseket. Ezek
|
||||
függvények, és a sciptben néhol meg vannak hívva, keresd meg.
|
||||
</p> Elküldött adatok online módban: Minden teszt végén az összes kérdés, és rá a moodle szerint
|
||||
helyesnek vélt válaszok. Fogadott adatok: az összes eddig ismert moodle kérdés
|
||||
<hr>
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<body bgcolor="#212127">
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.8" />
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<head>
|
||||
<title><%=dirname%></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.6" />
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
|
@ -12,7 +13,12 @@
|
|||
}
|
||||
|
||||
td {
|
||||
vertical-align: top
|
||||
vertical-align: top;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
table-layout: fixed;
|
||||
padding: 0 12;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
textarea {
|
||||
|
@ -39,7 +45,6 @@
|
|||
border: none !important;
|
||||
}
|
||||
tr {
|
||||
line-height: 29px;
|
||||
width:32%;
|
||||
}
|
||||
.butt {
|
||||
|
@ -53,11 +58,6 @@
|
|||
font-size: 13px;
|
||||
}
|
||||
|
||||
.active,
|
||||
.butt:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<center>
|
||||
|
@ -65,27 +65,32 @@
|
|||
<%=dirname%>
|
||||
</h1>
|
||||
</center>
|
||||
<a href=<%= "http://stuff.frylabs.net" + prevDir%> > Up one level </a>
|
||||
<a href="<%= url + prevDir%>" > Up one level </a>
|
||||
</p>
|
||||
|
||||
<table class="maintable">
|
||||
<% for (var i = 0; i < folders.length; i++) { %>
|
||||
<tr>
|
||||
<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">
|
||||
<tr height="62">
|
||||
<td style='width:30%;'>
|
||||
<a href="<%= "http://stuff.frylabs.net" + folders[i].path%>"> <%=folders[i].name %> </a>
|
||||
</td>
|
||||
<td style='width:30%;'>
|
||||
<%=folders[i].path %>
|
||||
<%=folders[i].name %>
|
||||
</td>
|
||||
<td style='width:20%;'>
|
||||
<%=folders[i].mtime %>
|
||||
</td>
|
||||
<td style='width:10%;'>
|
||||
<%=folders[i].size %> MB
|
||||
<%= folders[i].size === 0 ? "Dir" : folders[i].size + 'MB' %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
|
@ -93,4 +98,20 @@
|
|||
<% } %>
|
||||
</table>
|
||||
</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>
|
||||
|
|
72
views/stuff/nofile.ejs
Normal file
72
views/stuff/nofile.ejs
Normal file
|
@ -0,0 +1,72 @@
|
|||
<html>
|
||||
|
||||
<body bgcolor="#212127">
|
||||
|
||||
<head>
|
||||
<title>No such file/folder</title>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
body {
|
||||
font: normal 14px Verdana;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
textarea {
|
||||
font: normal 14px Verdana;
|
||||
color: #999999;
|
||||
background-color: #212127;
|
||||
width: 100%;
|
||||
height: 700;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #9999ff;
|
||||
}
|
||||
.subtable {
|
||||
border-collapse: collapse;
|
||||
table-layout:fixed;
|
||||
width:100%
|
||||
}
|
||||
.maintable {
|
||||
border-collapse: collapse;
|
||||
table-layout:fixed;
|
||||
width:100%
|
||||
padding:0; margin:0;
|
||||
border: none !important;
|
||||
}
|
||||
tr {
|
||||
line-height: 29px;
|
||||
width:32%;
|
||||
}
|
||||
.butt {
|
||||
background-color: #212127;
|
||||
color: #999999;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
border: none;
|
||||
text-align: left;
|
||||
outline: none;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.active,
|
||||
.butt:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<center>
|
||||
<h1>
|
||||
No such file / folder:
|
||||
</br>
|
||||
<%= missingFile %>
|
||||
</br>
|
||||
<a href="<%= url %>" > Back to root </a>
|
||||
</h1>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue